Query editor
-- OG ENS, rebuilt from the old registrar's HashRegistered events.-- Uses the club's uploads plus later ENS registration and renewal events.-- Never infer the original label from a current NFT name.WITH first_events AS (SELECThash AS labelhash,evt_block_time AS registered_date,evt_block_number AS registered_block,evt_index AS registration_log_index,evt_tx_hash AS registration_tx,row_number() OVER (PARTITION BY hashORDER BY evt_block_number, evt_index) AS occurrenceFROM ethereumnameservice_ethereum.registrar_old_evt_hashregisteredWHERE contract_address = 0x6090a6e47849629b7245dfa1ca21d94cd15878efAND evt_block_date >= DATE '2017-05-01'AND evt_block_date < DATE '2020-08-01'),ranked AS (SELECTrow_number() OVER (ORDER BY registered_block, registration_log_index) AS chain_rank,labelhash,registered_date,registered_block,registration_txFROM first_eventsWHERE occurrence = 1),club_rows AS (SELECTtry(from_hex(substr(hash, 3))) AS labelhash,nameFROM dune.prepunkclub.dataset_prepunk_recordsWHERE name IS NOT NULLAND name <> ''AND length(hash) = 66AND keccak(to_utf8(name)) = try(from_hex(substr(hash, 3)))),old_preimages AS (SELECTtry(from_hex(substr(hash, 3))) AS labelhash,nameFROM dune.prepunkclub.dataset_b_old_preimagesWHERE name IS NOT NULLAND name <> ''AND length(hash) = 66AND keccak(to_utf8(name)) = try(from_hex(substr(hash, 3)))),later_registrations AS (SELECTlabel AS labelhash,max_by(name, evt_block_time) AS nameFROM ens.view_registrationsWHERE evt_block_time >= TIMESTAMP '2019-05-01'AND name IS NOT NULLAND name <> ''