BlockTracker[nORMALIZE] Users Distribution by number of transaction
    Updated 2025-04-22
    WITH users AS (
    SELECT
    block_timestamp,
    from_address,
    tx_hash
    -- MIN(block_timestamp) OVER (PARTITION BY from_address) AS initial_timestamp,
    -- MAX(block_timestamp) OVER (PARTITION BY from_address) AS last_timestamp
    FROM monad.testnet.fact_transactions
    WHERE block_timestamp::date >= '2025-02-18'
    ),
    transactions AS (
    SELECT
    from_address,
    COUNT(DISTINCT DATE_TRUNC('day', block_timestamp)) AS n_days,
    COUNT(DISTINCT DATE_TRUNC('week', block_timestamp)) AS n_weeks,
    COUNT(DISTINCT DATE_TRUNC('month', block_timestamp)) AS n_months,
    COUNT(DISTINCT tx_hash) AS n_txns
    FROM users
    GROUP BY from_address
    ),
    total_user_count AS (
    SELECT
    COUNT(DISTINCT from_address) AS total_users
    FROM transactions
    ),
    user_counts AS (
    SELECT
    t.from_address,
    t.n_days,
    t.n_weeks,
    t.n_months,
    t.n_txns,
    tuc.total_users
    FROM transactions t
    CROSS JOIN total_user_count tuc
    ),
    QueryRunArchived: QueryRun has been archived