Sardius-0626Flow Blockchain SQL Practice
    Updated 2022-12-05

    WITH total_wallets AS (
    SELECT
    min_date,
    COUNT(proposer) new_wallets,
    SUM(new_wallets) OVER (order by min_date ASC) AS total_wallets_to_date
    FROM (
    SELECT
    proposer,
    date_trunc('day', min(block_timestamp)) AS min_date
    FROM flow.core.fact_transactions
    GROUP BY proposer
    )
    GROUP BY min_date
    ),
    active_wallets AS ( -- done any transaction in that month itself
    SELECT
    date_trunc('month', block_timestamp) AS month,
    COUNT(distinct proposer) AS active_wallets
    FROM flow.core.fact_transactions
    GROUP BY month
    )

    SELECT
    min_date,
    new_wallets,
    active_wallets,
    total_wallets_to_date,
    100 * (active_wallets / total_wallets_to_date) AS percent_of_active_over_total
    FROM total_wallets
    LEFT JOIN active_wallets
    ON total_wallets.min_date = active_wallets.month



    Run a query to Download Data