Query editor
-- Shared stage, builder attribution step 2 of 3, one UTC day: builder clusters derived from the block facts.-- A bid address recurring at least MIN_BID_BLOCKS times belongs to its settlement: the non-validator sender present in the-- largest share of its blocks, at least 50% of them, and at least five times more present there than in blocks outside-- every bid address that shares that sender, so a builder's own other bid addresses never count against it.-- Names: builder tag, else registry brand, else "unnamed" plus the settlement's first four bytes. declared says whether the-- bid address is in the public builder lists; the clusters never depend on the lists, an untagged cluster's name does.-- Transient table.---- Cost: written as one chain that reads the day's transactions once. Dune inlines every reference to a named subquery, so-- the earlier form, which joined its sender summaries back and grouped the names apart, read the day's transactions about-- eight times. The per-sender counts and the names are now window functions over the same rows; the result is unchanged.-- Tokens: START, END, FACTS, MIN_BID_BLOCKS, REGISTRY_VALUES.WITH f AS (SELECT * FROM dune.blockspace_forensics_consortium.result_sw_bfacts_20261130),big AS (SELECT bid_address, count(*) AS blocks FROM f WHERE bid_address IS NOT NULL GROUP BY 1 HAVING count(*) >= 20),day_blocks AS (SELECT count(*) AS n FROM f),miners AS (SELECT DISTINCT miner FROM f),bid_blocks AS (SELECT f.block_number, f.bid_address FROM f JOIN big g ON g.bid_address = f.bid_address),allpairs AS ( -- every (block, sender) of the day, read once; sender_n is the number of blocks the sender appears inSELECT block_number, sender, count(*) OVER (PARTITION BY sender) AS sender_nFROM (SELECT DISTINCT t.block_number, t."from" AS senderFROM bnb.transactions tWHERE t.block_time >= timestamp '2026-11-30 00:00:00' AND t.block_time < timestamp '2026-12-01 00:00:00') x),cosend AS ( -- senders in the blocks of each recurring bid address, validators excludedSELECT bb.bid_address, p.sender, count(*) AS n, max(p.sender_n) AS sender_nFROM allpairs pJOIN bid_blocks bb ON bb.block_number = p.block_numberLEFT JOIN miners m ON m.miner = p.senderWHERE m.miner IS NULLGROUP BY 1, 2),top AS (SELECT bid_address, sender, n, sender_nFROM (SELECT cosend.*, row_number() OVER (PARTITION BY bid_address ORDER BY n DESC, sender) AS rnk FROM cosend) xWHERE rnk = 1),topx AS ( -- all bid addresses whose top sender is S are S's home blocks; elsewhere is every other blockSELECT tp.bid_address, tp.sender, tp.n, tp.sender_n, g.blocks,sum(tp.n) OVER (PARTITION BY tp.sender) AS n_home, sum(g.blocks) OVER (PARTITION BY tp.sender) AS blocks_homeFROM top tp JOIN big g ON g.bid_address = tp.bid_address),bid_tag AS (SELECT bid_address, max_by(tag_name, n) AS tag_nameFROM (SELECT bid_address, tag_name, count(*) AS n FROM f WHERE bid_address IS NOT NULL AND tag_name IS NOT NULL GROUP BY 1, 2) xGROUP BY 1),registry (bid_address, brand) AS (VALUES (0x0557e8cb169f90f6ef421a54e29d7dd0629ca597, 'blockrazor'), (0x0da52e9673529b6e06f444fbbed2904a37f66415, 'bloxroute'), (0x0f6d8b72f3687de6f2824903a83b3ba13c0e88a0, 'inblock'), (0x10353562e662e333c0c2007400284e0e21cf74ff, 'bloxroute'), (0x1319be8b8ec4aa81f501924bdcf365fbcaa8d753, 'blockbus'), (0x17e9f0d7e45a500f0148b29c6c98efd19d95f138, 'blockbus'), (0x2873fc7ad9122933becb384f5856f0e87918388d, 'bloxroute'), (0x2b217a4158933aade6d6494e3791d454b4d13ae7, 'bloxroute'), (0x2d3cc0a25a05e6eb3d5d3ea21d72c8d71b436a7f, 'trustnet'), (0x3265a3243ee84e667a73073504ca4cded1413d82, 'darwinbuilder'), (0x345324dc15f1cdcf9022e3b7f349e911fb823b4c, 'jetbldr'), (0x36cb523286d57680efbbfb417c63653115bcebb5, 'jetbldr'), (0x3ad6121407f6edb65c8b2a518515d45863c206a8, 'jetbldr'), (0x3fc0c936c00908c07723ffbf2d536d6e0f62c3a4, 'blockbus'), (0x432101856a330aafdeb049dd5fa03a756b3f1c66, 'bloxroute'), (0x4827b423d03a349b7519dda537e9a28d31ecbb48, '48club'), (0x487e5dfe70119c1b320b8219b190a6fa95a5bb48, '48club'), (0x488e37fcb2024a5b2f4342c7de636f0825de6448, 'blockrazor'), (0x48a5ed9abc1a8fbe86cec4900483f43a7f2dbb48, '48club'), (0x48b2665e5e9a343409199d70f7495c8ab660bb48, '48club'), (0x48b4bbebf0655557a461e91b8905b85864b8bb48, '48club'), (0x48fee1bb3823d72fdf80671ebad5646ae397bb48, '48club'), (0x49d91b1ab0cc6a1591c2e5863e602d7159d36149, 'blockrazor'), (0x4f24ce4cd03a6503de97cf139af2c26347930b99, 'nodereal'), (0x50061047b9c7150f0dc105f79588d1b07d2be250, 'blockrazor'), (0x5054b21d8baea3d602dca8761b235ee10bc0231e, 'blocksmith'), (0x539e24781f616f0d912b60813ab75b7b80b75c53, 'blockrazor'), (0x5532cdb3c0c4278f9848fc4560b495b70ba67455, 'blockrazor'), (0x5b526b45e833704d84b5c2eb0f41323da9466c48, 'nodereal'), (0x6dddf681c908705472d09b1d7036b2241b50e5c7, 'blocksmith'), (0x76736159984ae865a9b9cc0df61484a49da68191, 'blocksmith'), (0x79102db16781dddff63f301c9be557fd1dd48fa0, 'nodereal'), (0x7f5fbfd8e2eb3160df4c96757deef29e26f969a3, 'jetbldr'), (0x812720cb4639550d7bdb1d8f2be463f4a9663762, 'xzbuilder'), (0x89434fc3a09e583f2cb4e47a8b8fe58de8be6a15, 'bloxroute'), (0x89b08890751b28511541f5fed08d7d964caae911, 'flashblock'), (0x9a3234b450518fada098388b88e00decad96ad38, 'inblock'), (0x9c6b0870752cdd1b3f9aac28c0207e8126f8e1b8, 'flashblock'), (0xa0cde9891c6966fce740817cc5576de2c669ab43, 'jetbldr'), (0xa547f87b2bade689a404544859314cbc01f2605e, 'nodereal'), (0xa6d6086222812efd5292ff284b0f7ff2a2b86af4, 'darwinbuilder'), (0xb49f86586a840ab9920d2f340a85586e50fd30a2, 'inblock'), (0xba4233f6e478db76698b0a5000972af0196b7be1, 'blockrazor'), (0xd0d56b330a0dea077208b96910ce452fd77e1b6f, 'nodereal'), (0xd4376fdc9b49d90e6526daa929f2766a33bffd52, 'bloxroute'), (0xdf11cd23992fd48cf2d245ac144010673275f285, 'darwinbuilder'), (0xe1ec1aece7953ecb4539749b9aa2eef63354860a, 'bloxroute'), (0xfd38358475078f81a45077f6e59dff8286e0dca1, 'jetbldr'), (0xfd3f1ad459d585c50cf4630649817c6e0cec7335, 'nodereal')),base AS (SELECT tx.sender AS settlement, tx.bid_address, tx.blocks,round(100.0 * tx.n / tx.blocks, 1) AS settle_presence,round(100.0 * (tx.sender_n - tx.n_home) / (d.n - tx.blocks_home), 2) AS presence_elsewhere,bt.tag_name, rg.brand AS registry_brandFROM topx txCROSS JOIN day_blocks dLEFT JOIN bid_tag bt ON bt.bid_address = tx.bid_addressLEFT JOIN registry rg ON rg.bid_address = tx.bid_address