Query editor
-- ArbR/XRouter node performance and Dune index-health report.-- 8 is the only dashboard parameter. Production addresses are kept-- here explicitly so the saved query and this checked-in copy stay identical.---- Attribution rules:-- * non-zero-gwei node rows require a successful router transaction AND a-- WBNB profit transfer to the production collector;-- * nodeid is gas_limit % 1,000,000 only after the above ownership check;-- * failed calls cannot be proven to belong to a node from gas_limit alone,-- so they are reported separately by sender as UNATTRIBUTED_FAILURE.-- Native BNB is intentionally not mixed into WBNB profit. This keeps the-- profit unit auditable and avoids the expensive bnb.traces scan.withparams as (selectcast(8 as bigint) as hours,0x31fe40e6732847147a1f54177e357ee8fc0c86db as xrouter,0xde9e1611328d00f03af46daf60738865f967b517 as xrouter_multi,0x84c8c1ebb698c5e32b1bae48f2026a30085f7a9c as xrouter_basket,0xba74ed7c01b874fdfc68300d4fe7e976996523d5 as collector,0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c as wbnb),index_bounds as (selectmax(number) filter (where time <= now() - interval '1' hour * p.hours) as requested_start_block,max(time) filter (where time <= now() - interval '1' hour * p.hours) as requested_start_time,max(number) as dune_end_block,max(time) as dune_end_timefrom bnb.blockscross join params pwhere date >= date(now() - interval '1' hour * p.hours) - interval '1' day),router_txs as (selectt.hash,t.block_number,t.block_time,t."from" as sender,t."to" as target,t.success,t.gas_price,t.gas_used,t.gas_limit,casewhen t.gas_price = 0 then nullwhen t.gas_limit >= 1000000 and mod(t.gas_limit, 1000000) < 100then cast(mod(t.gas_limit, 1000000) as bigint)else nullend as nodeid_candidatefrom bnb.transactions tcross join params pwhere t.block_time >= now() - interval '1' hour * p.hoursand t.block_date >= date(now() - interval '1' hour * p.hours) - interval '1' dayand t."to" in (p.xrouter, p.xrouter_multi, p.xrouter_basket)),wbnb_profit as (selectl.tx_hash,sum(varbinary_to_uint256(l.data)) as profit_wei