superflyuncertain-jade
    Updated 2025-03-18
    WITH total_metrics AS (
    SELECT
    COUNT(DISTINCT tx_hash) as total_transactions,
    COUNT(DISTINCT from_address) as total_users,
    SUM(tx_fee) as total_volume_fee,
    AVG(tx_fee) as overall_avg_fee,
    COUNT(DISTINCT block_timestamp::date) as total_days,
    COUNT(DISTINCT tx_hash) / COUNT(DISTINCT block_timestamp::date) as avg_daily_transactions,
    COUNT(DISTINCT from_address) / COUNT(DISTINCT block_timestamp::date) as avg_daily_users,
    SUM(tx_fee) / COUNT(DISTINCT block_timestamp::date) as avg_daily_volume
    FROM
    ronin.core.fact_transactions
    WHERE
    tx_succeeded
    AND block_timestamp >= DATEADD(day, -365, CURRENT_DATE())
    )
    SELECT
    total_transactions,
    total_users,
    total_volume_fee,
    overall_avg_fee,
    total_days,
    avg_daily_transactions,
    avg_daily_users,
    avg_daily_volume,
    (total_transactions - LAG(total_transactions) OVER (ORDER BY total_days)) / NULLIF(LAG(total_transactions) OVER (ORDER BY total_days), 0) * 100 as total_transaction_change,
    (total_users - LAG(total_users) OVER (ORDER BY total_days)) / NULLIF(LAG(total_users) OVER (ORDER BY total_days), 0) * 100 as total_user_change,
    total_transactions / NULLIF(total_users, 0) as transactions_per_user,
    total_volume_fee / NULLIF(total_transactions, 0) as avg_value_per_transaction
    FROM
    total_metrics;
    Last run: about 1 month ago
    TOTAL_TRANSACTIONS
    TOTAL_USERS
    TOTAL_VOLUME_FEE
    OVERALL_AVG_FEE
    TOTAL_DAYS
    AVG_DAILY_TRANSACTIONS
    AVG_DAILY_USERS
    AVG_DAILY_VOLUME
    TOTAL_TRANSACTION_CHANGE
    TOTAL_USER_CHANGE
    TRANSACTIONS_PER_USER
    AVG_VALUE_PER_TRANSACTION
    1
    2005783647860217390131.1358952610.0019450311691186854.22485246510.1597632308.46825973525.5181710.001945031
    1
    129B
    12s