afonsoUntitled Query
    Updated 2023-01-21
    with arbitrum as (
    select
    date_trunc('week', block_timestamp)::date as day,
    count(distinct tx_hash) as arbitrum_txns_count,
    count(distinct from_address) as arbitrum_active_users_count,
    sum(tx_fee) as arbitrum_tx_total_fee,
    avg(tx_fee) as arbitrum_tx_avg_fee
    from arbitrum.core.fact_transactions
    group by day
    ),

    ethereum as (
    select
    date_trunc('week', block_timestamp)::date as day,
    count(distinct tx_hash) as ethereum_txns_count,
    count(distinct from_address) as ethereum_active_users_count,
    sum(tx_fee) as ethereum_tx_total_fee,
    avg(tx_fee) as ethereum_tx_avg_fee
    from ethereum.core.fact_transactions
    group by day
    ),

    optimism as (
    select
    date_trunc('week', block_timestamp)::date as day,
    count(distinct tx_hash) as optimism_txns_count,
    count(distinct from_address) as optimism_active_users_count,
    sum(tx_fee) as optimism_tx_total_fee,
    avg(tx_fee) as optimism_tx_avg_fee
    from optimism.core.fact_transactions
    group by day
    )

    select *,
    sum(arbitrum_txns_count) over (order by day asc) as cumulative_arbitrum_txns_count,
    sum(arbitrum_active_users_count) over (order by day asc) as cumulative_arbitrum_active_users_count,
    Run a query to Download Data