Query editor
-- part of a query repo-- query name: Scroll verification base-- query link: https://dune.com/queries/3916549with eth_gas_price as (SELECT DATE_TRUNC('day', tx.block_time) AS day, APPROX_PERCENTILE(tx.gas_price / 1e18, 0.5) AS median_legacy_gas_price, APPROX_PERCENTILE( (b.base_fee_per_gas + tx.priority_fee_per_gas) / 1e18, 0.5) AS median_dynamic_gas_pricefrom ethereum.transactions txINNER JOIN ethereum.blocks b ON tx.block_number = b.numbergroup by 1), eth_usd_price as (select date_trunc('day', minute) as day, avg(price) as avg_eth_pricefrom prices.usdwhere blockchain is null and symbol = 'ETH'group by 1)select-- tr.*tr.block_date, count(distinct tx_hash) as verifying_calls, sum(case when tx.type = 'Legacy' then 319662 * median_legacy_gas_price -- legacywhen tx.type = 'DynamicFee' then 319662 * median_dynamic_gas_price -- dynamic-- should only be these 2 txn types, blob and AccessList don't applyend) as verifying_cost_ETH, sum(case when tx.type = 'Legacy' then 319662 * median_legacy_gas_price * avg_eth_price -- legacywhen tx.type = 'DynamicFee' then 319662 * median_dynamic_gas_price * avg_eth_price -- dynamicend) as verifying_cost_usdfrom ethereum.transactions txleft join ethereum.traces tr on tr.block_number = tx.block_number and tr.tx_hash = tx.hashleft join eth_usd_price ep on tr.block_date = ep.dayleft join eth_gas_price gp on tr.block_date = gp.daywhere 1=1-- and varbinary_substring(tx.data, 1, 4) = 0x00b0f4d7 -- finalizeBatchWithProof4844, not neededand tx."from" = 0x356483dC32B004f32Ea0Ce58F7F88879886e9074 -- bathch finalizer, per Scroll team this is the correct addressand tr.to in ( -- filter for calls to the actual proof verifier0x4B8Aa8A96078689384DAb49691E9bA51F9d2F9E1 -- L1_PLONK_VERIFIER_V0_ADDR, 0x2293cd12e8564e8219d314b075867c2f66ac6941 -- L1_PLONK_VERIFIER_V1_ADDR, 0x03a72B00D036C479105fF98A1953b15d9c510110 -- L1_PLONK_VERIFIER_V2_ADDR)and tr.call_type = 'staticcall' -- assuming that verifier contract should be called as readonly staticcalls (next best to identifying all verifier contracts which is pretty impossible manually)-- and tx.block_date >= now() - interval '7' day-- and tx.block_number = 20301391 and tx.hash = 0x59fd8268be53ba38b267696270e3a09d2768036295552f19ca5edc607a3faa41 -- https://etherscan.io/tx/0x59fd8268be53ba38b267696270e3a09d2768036295552f19ca5edc607a3faa41/advanced#internal --> 200,549group by 1