Query editor
-- Ethereum mainnet base fee and priority fee, last 24 hours, 5-minute buckets, 1-hour moving averages (gwei)-- Priority fee = effective gas price minus block base fee, median across transactions in the bucket-- Extra lookback so the moving averages are full-width from the first bucket shownWITH blocks AS (SELECT number, time, base_fee_per_gas,date_add('minute', (minute(time) / 5) * 5, date_trunc('hour', time)) AS bucketFROM ethereum.blocksWHERE date >= current_date - INTERVAL '2' DAYAND time >= now() - INTERVAL '25' HOUR), base AS (SELECTbucket,min(base_fee_per_gas) / 1e9 AS min_gwei,approx_percentile(base_fee_per_gas, 0.10) / 1e9 AS p10_gwei,approx_percentile(base_fee_per_gas, 0.25) / 1e9 AS p25_gwei,approx_percentile(base_fee_per_gas, 0.50) / 1e9 AS p50_gwei,approx_percentile(base_fee_per_gas, 0.75) / 1e9 AS p75_gwei,approx_percentile(base_fee_per_gas, 0.90) / 1e9 AS p90_gwei,max(base_fee_per_gas) / 1e9 AS max_gwei,count(*) AS blocksFROM blocksGROUP BY 1), tips AS (SELECTb.bucket,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 '2' DAYAND t.block_time >= now() - INTERVAL '25' HOURGROUP BY 1), smoothed AS (SELECT base.*, tips.tip_p50_gwei, tips.txs,avg(p50_gwei) OVER (ORDER BY base.bucket ROWS BETWEEN 11 PRECEDING AND CURRENT ROW) AS ma_gwei,avg(tip_p50_gwei) OVER (ORDER BY base.bucket ROWS BETWEEN 11 PRECEDING AND CURRENT ROW) AS tip_ma_gweiFROM baseLEFT JOIN tips ON tips.bucket = base.bucket)SELECT * FROM smoothedWHERE bucket >= now() - INTERVAL '24' HOURORDER BY bucket