frankmaseotx_data
    Updated 2023-04-12
    -- forked from new wallets by chains @ https://flipsidecrypto.xyz/edit/queries/be7966bb-ad49-414d-a5ab-e4bbda8c9384

    -- metrics: new wallets, gas spend (7DMA), tx, new contracts created
    --New wallets
    WITH
    TX AS (
    SELECT
    'ARBITRUM' as chain, DATE_TRUNC('day', BLOCK_TIMESTAMP) as date_day, COUNT(DISTINCT TX_HASH) as TX_COUNT, SUM(TX_FEE) as total_gas
    FROM arbitrum.core.fact_transactions
    GROUP BY 1,2
    UNION ALL

    SELECT
    'AVALANCHE' as chain, DATE_TRUNC('day', BLOCK_TIMESTAMP) as date_day, COUNT(DISTINCT TX_HASH) as TX_COUNT, SUM(TX_FEE) as total_gas
    FROM avalanche.core.fact_transactions
    GROUP BY 1,2

    UNION ALL
    SELECT
    'BSC' as chain, DATE_TRUNC('day', BLOCK_TIMESTAMP) as date_day, COUNT(DISTINCT TX_HASH) as TX_COUNT, SUM(TX_FEE) as total_gas
    FROM bsc.core.fact_transactions
    GROUP BY 1,2

    UNION ALL
    SELECT
    'ETHEREUM' as chain, DATE_TRUNC('day', BLOCK_TIMESTAMP) as date_day, COUNT(DISTINCT TX_HASH) as TX_COUNT, SUM(TX_FEE) as total_gas
    FROM ethereum.core.fact_transactions
    GROUP BY 1,2

    UNION ALL
    SELECT
    'GNOSIS' as chain, DATE_TRUNC('day', BLOCK_TIMESTAMP) as date_day, COUNT(DISTINCT TX_HASH) as TX_COUNT, SUM(TX_FEE) as total_gas
    FROM gnosis.core.fact_transactions
    GROUP BY 1,2

    UNION ALL
    Run a query to Download Data