mucrypto2023-06-07 02:50 AM
    Updated 2023-06-06
    with txs_base as (
    select
    block_timestamp::date as day,
    to_address,
    gas_price,
    gas_used,
    tx_fee as tx_fee_eth
    from ethereum.core.fact_transactions
    -- left join eth_price
    -- on date_trunc('hour', block_timestamp) = hour

    where block_timestamp >= sysdate() - interval '1 year'
    and tx_fee > 0
    and tx_type = '0'

    -- and price > 0
    and to_address is not null),

    txs_base_agg as (
    select
    day,
    to_address,
    sum(tx_fee_eth) as tx_fee_eth_3_hours
    -- avg(gas_price) as avg_gas_price_3_hours,
    -- sum(gas_used) as total_gas_used_3_hours
    from txs_base
    group by 1,2
    order by 3 desc)

    select *
    from txs_base_agg
    Run a query to Download Data