Query editor
WITHPriorityFees AS (SELECTindex,t.hash,block_number,CASEWHEN (type = 'Legacy' OR type = 'AccessList') THEN ((CAST(t.gas_price AS DOUBLE) - CAST(b.base_fee_per_gas AS DOUBLE)) / 1e9)WHEN CAST(b.base_fee_per_gas AS DOUBLE) + CAST(max_priority_fee_per_gas AS DOUBLE) <= CAST(max_fee_per_gas AS DOUBLE) THEN ((CAST(t.gas_price AS DOUBLE) - CAST(b.base_fee_per_gas AS DOUBLE)) / 1e9)WHEN CAST(b.base_fee_per_gas AS DOUBLE) + CAST(max_priority_fee_per_gas AS DOUBLE) > CAST(max_fee_per_gas AS DOUBLE) THEN ((CAST(t.max_fee_per_gas AS DOUBLE) - CAST(b.base_fee_per_gas AS DOUBLE)) / 1e9)END AS eff_prio_fee_per_gasFROM {{chain}}.transactions tINNER JOIN {{chain}}.blocks b ON b.number = t.block_number-- remove system txsWHERE (to NOT IN (SELECTaddressFROM labels.system_addressesWHERE blockchain = '{{chain}}')OR to NOT IN (0x4200000000000000000000000000000000000015,0x4200000000000000000000000000000000000006,0x4200000000000000000000000000000000000007)-- handle null to addres for contract creation/OR to IS NULL)AND "type" != '126'), MaxFee AS (SELECTblock_number,MAX(eff_prio_fee_per_gas ) AS max_prio_feeFROM PriorityFeesGROUP BY 1), BlockTxCount AS (SELECTblock_number,COUNT(*) AS txsFROM {{chain}}.transactions-- remove system txsWHERE (to NOT IN (SELECTaddressFROM labels.system_addressesWHERE blockchain = '{{chain}}')OR to NOT IN (0x4200000000000000000000000000000000000015,0x4200000000000000000000000000000000000006,0x4200000000000000000000000000000000000007)-- handle null to addres for contract creation/OR to IS NULL)AND "type" != '126'GROUP BY 1)