Query editor
WITH node_addr_reverse AS (-- namehash('addr.reverse')SELECTkeccak(keccak(from_hex('0000000000000000000000000000000000000000000000000000000000000000')|| keccak(to_utf8('reverse')))|| keccak(to_utf8('addr'))) AS nh),contracts_with_labelhash AS (SELECTaddress,keccak(to_utf8(lower(to_hex(address)))) AS reverse_labelhashFROM ethereum.creation_traces),reverse_events AS (SELECTc.address,e.evt_block_timeFROM contracts_with_labelhash cJOIN ethereumnameservice_ethereum.ENSRegistryWithFallback_evt_NewOwner eON e.label = c.reverse_labelhashWHERE e.node = (SELECT nh FROM node_addr_reverse)),first_named_per_address AS (SELECTaddress,MIN(evt_block_time) AS first_named_atFROM reverse_eventsGROUP BY address),-- Generate the last 12 months using DATEsmonths AS (SELECT m AS monthFROM UNNEST(SEQUENCE(date_trunc('month', CURRENT_DATE) - INTERVAL '11' MONTH,date_trunc('month', CURRENT_DATE),INTERVAL '1' MONTH)) AS t(m)),counts AS (SELECTdate_trunc('month', first_named_at) AS month,COUNT(*) AS contracts_namedFROM first_named_per_addressWHERE first_named_at >= (SELECT MIN(month) FROM months)GROUP BY 1)SELECTformat_datetime(CAST(months.month AS timestamp), 'MMM yyyy') AS month_label,COALESCE(counts.contracts_named, 0) AS contracts_named,months.month AS sort_keyFROM monthsLEFT JOIN countsON months.month = counts.monthORDER BY months.month ASC;