Query editor
-- First winning wallet for each Prepunk hash, in on-chain event order.-- Top-ten wallets are ranked by distinct first registrations over the full-- window, then shown in each day's original finalizations.WITH events AS (SELECThash,owner,evt_block_time,row_number() OVER (PARTITION BY hash ORDER BY evt_block_number, evt_index) AS occurrenceFROM ethereumnameservice_ethereum.registrar_old_evt_hashregisteredWHERE contract_address = 0x6090a6e47849629b7245dfa1ca21d94cd15878efAND evt_block_date >= DATE '2017-05-09'AND evt_block_date < DATE '2017-07-01'AND evt_block_number < 3919721),first_wins AS (SELECTowner,CAST(date_trunc('day', evt_block_time) AS date) AS finalization_dayFROM eventsWHERE occurrence = 1),top_ten AS (SELECT ownerFROM first_winsGROUP BY ownerORDER BY count(*) DESC, ownerLIMIT 10),first_day_by_wallet AS (SELECT owner, min(finalization_day) AS first_dayFROM first_winsGROUP BY owner),new_winners_by_day AS (SELECT first_day, count(*) AS new_winning_walletsFROM first_day_by_walletGROUP BY first_day)SELECTw.finalization_day,count(*) AS names_registered,count(DISTINCT w.owner) AS winning_wallets,coalesce(n.new_winning_wallets, 0) AS new_winning_wallets,count_if(w.owner IN (SELECT owner FROM top_ten)) AS top_ten_wallet_names,round(100.0 * count_if(w.owner IN (SELECT owner FROM top_ten)) / count(*), 1)AS top_ten_share_pctFROM first_wins wLEFT JOIN new_winners_by_day n ON n.first_day = w.finalization_dayGROUP BY 1, n.new_winning_walletsORDER BY 1;