dariustay_0512Polygon daily transactions and unique addresses — with date range
    Updated 2023-04-13
    WITH txs AS (
    SELECT
    date(block_timestamp) AS date,
    COUNT(DISTINCT tx_hash) AS tx_vol
    FROM polygon.core.fact_transactions
    WHERE status = 'SUCCESS'
    GROUP BY 1
    ),

    interact AS (
    SELECT
    block_timestamp,
    from_address
    FROM polygon.core.fact_transactions
    UNION ALL
    SELECT
    block_timestamp,
    to_address
    FROM polygon.core.fact_transactions
    ),

    users AS (
    SELECT
    date(block_timestamp) AS date,
    COUNT(DISTINCT from_address) AS addresses,
    CASE WHEN date >= '2022-07-01' THEN 'From 1 July 2022 onwards' ELSE 'Before 1 July 2022' END AS date_range
    FROM interact
    GROUP BY 1
    )

    SELECT
    t.date AS "Date",
    t.tx_vol AS "Transactions",
    u.addresses AS "Addresses",
    u.date_range AS "Date range"
    FROM txs t
    Run a query to Download Data