Yousefi_1994Gas Guzzlers - Flow Daily Average Block Gas Price
    Updated 2022-12-18
    -------------------------------------flow-------------------------------------
    with flow_fee_transactions as (
    select
    block_timestamp,
    tx_id as tx_hash,
    block_height as block_number,
    event_data:amount as fee
    from flow.core.fact_events
    where event_contract = 'A.f919ee77447b7497.FlowFees'
    and event_type = 'FeesDeducted'
    and block_timestamp::date > current_date - 31
    ),
    flow_fee_transactions_with_user as (
    select
    fee.*,
    transactions.proposer as from_address
    from flow_fee_transactions fee
    join flow.core.fact_transactions transactions
    on fee.tx_hash = transactions.tx_id
    ),
    flow_price_usd as (
    select
    timestamp::date as days,
    avg(price_usd) as price_usd
    from flow.core.fact_prices
    where token_contract = 'A.1654653399040a61.FlowToken'
    and timestamp::date > current_date - 31
    group by days
    ),
    flow_fee_transactions_with_price as (
    select
    gas.*,
    price.price_usd
    from flow_fee_transactions_with_user gas
    join flow_price_usd price
    Run a query to Download Data