elenahoointernal_tx_p1
    Updated 2022-06-27
    with block as(
    select block_number
    , block_timestamp
    , sum(gas) total_gas
    , sum(gas_used) total_gas_used
    , count(tx_hash) tx_count
    from avalanche.core.fact_traces
    where block_timestamp >='2022-06-20'
    and tx_status = 'SUCCESS'
    group by 1,2
    order by block_number asc
    )
    select block.*
    , date_trunc('hour', block_timestamp) as timestamp_h
    , TIMESTAMPDIFF(SECONDS, LAG(block_timestamp, 1) OVER (ORDER BY block_timestamp), block_timestamp) block_second
    , (block_number - LAG(block_number, 1) over (order by block_number)) block_number_diff
    from block
    order by block_number asc


    Run a query to Download Data