Query editor
-- Ethereum mainnet base fee and priority fee, last hour, per block, 5-minute (25-block) moving averages (gwei)-- Priority fee = effective gas price minus block base fee, median across transactions in the block-- Extra lookback so the moving averages are full-width from the first block shownWITH blocks AS (SELECT number, time, base_fee_per_gas, gas_used, gas_limitFROM ethereum.blocksWHERE date >= current_date - INTERVAL '1' DAYAND time >= now() - INTERVAL '65' MINUTE), tips AS (SELECTt.block_number,approx_percentile((t.gas_price - b.base_fee_per_gas) / 1e9, 0.50) AS tip_p50_gwei,count(*) AS txsFROM ethereum.transactions tJOIN blocks b ON b.number = t.block_numberWHERE t.block_date >= current_date - INTERVAL '1' DAYAND t.block_time >= now() - INTERVAL '65' MINUTEGROUP BY 1), smoothed AS (SELECTb.time AS bucket,b.number AS block_number,b.base_fee_per_gas / 1e9 AS p50_gwei,b.gas_used,b.gas_limit,tips.tip_p50_gwei,tips.txs,avg(b.base_fee_per_gas / 1e9) OVER (ORDER BY b.number ROWS BETWEEN 24 PRECEDING AND CURRENT ROW) AS ma_gwei,avg(tips.tip_p50_gwei) OVER (ORDER BY b.number ROWS BETWEEN 24 PRECEDING AND CURRENT ROW) AS tip_ma_gweiFROM blocks bLEFT JOIN tips ON tips.block_number = b.number)SELECT * FROM smoothedWHERE bucket >= now() - INTERVAL '1' HOURORDER BY bucket