Query editor
-- =============================================================================-- BNB Chain: every contract first deployed before 2024-01-01, with a compact-- bytecode fingerprint for the local multisig/wallet-factory filtering step.---- Cost-control choices (see chat for full reasoning):-- * Filters on block_month, the table's date-partition column, rather than-- only block_time -- lets the engine skip data outside the range instead-- of scanning everything and discarding rows after. Jan 1 is a month-- boundary, so this is an EXACT filter, not an approximation.-- * Never SELECTs the raw `code` column -- could be many KB/contract across-- potentially millions of rows. Only its length and a hash survive, which-- is all the clustering step needs.---- Verified live earlier in this project (address, "from", block_time,-- block_number, length(code) against ethereum.creation_traces, same schema/-- engine as bnb.creation_traces). NOT verified: sha256()/to_hex() -- standard-- Trino functions, expected to work, but untested on Dune specifically. If-- that line errors, paste the message back for a fallback.---- Before running: consider setting Dune's per-execution cost cap (no dry-run-- exists here the way BigQuery has one) as a safety backstop.-- =============================================================================SELECTaddress,deployer,deployed_at,deployed_block,bytecode_len,bytecode_hash -- group by this locally to spot wallet-factory clusters (Safe, Argent, etc.)FROM (SELECTaddress,"from" AS deployer,block_time AS deployed_at,block_number AS deployed_block,length(code) AS bytecode_len,to_hex(sha256(code)) AS bytecode_hash,ROW_NUMBER() OVER (PARTITION BY address ORDER BY block_time, block_number) AS rnFROM bnb.creation_tracesWHERE block_month < DATE '2024-01-01' -- partition-pruning filter; exact at month granularity)WHERE rn = 1 -- first deployment only (collapses CREATE2 redeploys)