grahamBSC Activity Stats
    Updated 2023-04-19
    SELECT FROM_ADDRESS as user_address,
    count(1) as n_txn,
    count(DISTINCT(date_trunc('DAY', block_timestamp))) as n_days_active,
    DATEDIFF(day, MAX(BLOCK_TIMESTAMP), CURRENT_DATE()) as days_since_last_txn,
    -- a complex tx is any tx that is NOT a simple ETH transfer; i.e., has input data!
    count_if(INPUT_DATA != '0x') as n_complex_txn,
    COUNT (DISTINCT CASE WHEN INPUT_DATA != '0x' THEN TO_ADDRESS END) as n_contracts
    FROM bsc.core.fact_transactions
    WHERE
    BLOCK_TIMESTAMP >= '{{start_date}}' and
    BLOCK_TIMESTAMP <= '{{end_date}}' and
    user_address not in (select distinct address
    from crosschain.core.address_tags
    where creator = 'flipside'
    and blockchain = 'bsc'
    and tag_name = 'contract address')
    and user_address not in (select distinct address from bsc.core.dim_labels)
    GROUP BY FROM_ADDRESS
    Run a query to Download Data