rajsEthereum Gas Fees
    Updated 2022-11-15
    with eth_price as
    (
    SELECT
    *
    -- distinct symbol
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    and hour >= CURRENT_DATE - interval '30 days'
    order by 1 desc
    -- limit 3
    )
    ,

    eth_gas as
    (
    SELECT
    '1. Ethereum' as blockchain,
    -- sum(tx_fee) as tx_fee_native,
    sum(tx_fee * price) as tx_fee_usd,
    count(distinct block_hash) as no_of_blocks
    from ethereum.core.fact_transactions eg
    left join eth_price ep
    on date_trunc('hour', eg.block_timestamp) = ep.hour
    where eg.block_timestamp >= CURRENT_DATE - interval '30 days'
    group by 1
    )
    ,

    sol_price as
    (
    SELECT
    recorded_hour,
    avg(close) as sol_price
    from solana.core.fact_token_prices_hourly
    where recorded_hour >= CURRENT_DATE - interval '30 days'
    and symbol = 'SOL'
    Run a query to Download Data