Blaze2024-02-07 07:14 PM copy
    WITH CHAIN_DATA AS (
    SELECT
    'ETHEREUM' AS CHAIN,
    DATE_TRUNC('day', BLOCK_TIMESTAMP) AS "DATE",
    FROM_ADDRESS,
    tx_hash
    FROM
    ETHEREUM.CORE.FACT_TRANSACTIONS
    where date_trunc('month',BLOCK_TIMESTAMP) >date_trunc('month',CURRENT_TIMESTAMP) - interval '12 months'

    UNION ALL
    SELECT
    'SOLANA' AS CHAIN,
    DATE_TRUNC('day', BLOCK_TIMESTAMP) AS "DATE",
    signers[0] as FROM_ADDRESS,
    tx_id as tx_hash
    FROM
    SOLANA.CORE.FACT_TRANSACTIONS
    where date_trunc('month',BLOCK_TIMESTAMP) >date_trunc('month',CURRENT_TIMESTAMP) - interval '12 months'
    )
    SELECT
    CHAIN, DATE,
    COUNT(DISTINCT FROM_ADDRESS) AS "ACTIVE_USERS",
    COUNT(DISTINCT tx_hash) AS "Total Transactions"
    FROM
    CHAIN_DATA
    GROUP BY
    1,2
    ORDER BY
    1,2
    Run a query to Download Data