dariustay_0512Ethereum total daily and cumulative fees
    Updated 2023-04-13
    WITH poly_fees AS (
    SELECT
    date(block_timestamp) AS date,
    avg(tx_fee) AS avg_fee,
    sum(tx_fee) AS total_daily_fee,
    sum(total_daily_fee) OVER (ORDER BY date) AS cumulative_fee
    FROM polygon.core.fact_transactions
    WHERE status = 'SUCCESS'
    GROUP BY 1
    ),

    eth_fees AS (
    SELECT
    date(block_timestamp) AS date,
    avg(tx_fee) AS avg_fee,
    sum(tx_fee) AS total_daily_fee,
    sum(total_daily_fee) OVER (ORDER BY date) AS cumulative_fee
    FROM ethereum.core.fact_transactions
    WHERE status = 'SUCCESS'
    GROUP BY 1
    )

    SELECT
    e.date AS "Date",
    e.total_daily_fee AS "Total daily fee (ETH)",
    e.cumulative_fee AS "Cumulative fee (ETH)"
    FROM eth_fees e
    WHERE e.date BETWEEN '2022-06-30' AND '2022-07-08'
    ORDER BY 1;
    Run a query to Download Data