0-MIDper Time frame Average stats
    Updated 2023-04-13
    with tab1 as (
    select date_trunc('{{Time_Frame}}',BLOCK_TIMESTAMP) as date
    ,count(distinct BLOCK_HASH) as "BLOCK COUNT"
    ,count(distinct FROM_ADDRESS) as "ACTIVE USERS"
    ,sum(TX_FEE) as "TX FEE(ETH)"
    ,count(distinct TX_HASH) as "TX COUNT"
    from arbitrum.core.fact_transactions
    where STATUS='SUCCESS'
    and BLOCK_TIMESTAMP>='{{Start_Date}}' and BLOCK_TIMESTAMP<='{{End_Date}}'
    group by 1),
    tab2 as (
    select date_trunc('{{Time_Frame}}',BLOCK_TIMESTAMP) as date
    ,count(distinct BLOCK_HASH) as "BLOCK COUNT"
    ,count(distinct FROM_ADDRESS) as "ACTIVE USERS"
    ,sum(TX_FEE) as "TX FEE(ETH)"
    ,count(distinct TX_HASH) as "TX COUNT"
    from optimism.core.fact_transactions
    where STATUS='SUCCESS'
    and BLOCK_TIMESTAMP>='{{Start_Date}}' and BLOCK_TIMESTAMP<='{{End_Date}}'
    group by 1)
    select 'ARBITRUM'as chain
    ,avg ("BLOCK COUNT") as "AVG BLOCK COUNT"
    ,avg ("ACTIVE USERS") as "AVG ACTIVE USERS"
    ,avg ("TX COUNT") as "AVG TX COUNT"
    ,avg ("TX FEE(ETH)") as "AVG TX FEE(ETH)"
    from tab1
    union all
    select 'OPTIMISM'as chain
    ,avg ("BLOCK COUNT") as "AVG BLOCK COUNT"
    ,avg ("ACTIVE USERS") as "AVG ACTIVE USERS"
    ,avg ("TX COUNT") as "AVG TX COUNT"
    ,avg ("TX FEE(ETH)") as "AVG TX FEE(ETH)"
    from tab2


    Run a query to Download Data