Query editor
WITH DailyUniqueAddresses AS (SELECT'Avalanche' AS chain_name,DATE(tc.block_date) AS date,tx."from" AS tx_fromFROM avalanche_c.traces tcJOIN avalanche_c.transactions tx ON tc.tx_hash = tx.hashWHERE tc.to = 0x4305FB66699C3B2702D4d05CF36551390A4c69C6AND tx.block_date <= (NOW() - INTERVAL '1' DAY)AND tx.successGROUP BY 1, 2, 3UNION ALLSELECT'Base' AS chain_name,DATE(tc.block_date) AS date,tx."from" AS tx_fromFROM base.traces tcJOIN base.transactions tx ON tc.tx_hash = tx.hashWHERE tc.to = 0x8250f4aF4B972684F7b336503E2D6dFeDeB1487aAND tx.block_date <= (NOW() - INTERVAL '1' DAY)AND tx.successGROUP BY 1, 2, 3UNION ALLSELECT'Arbitrum' AS chain_name,DATE(tc.block_date) AS date,tx."from" AS tx_fromFROM arbitrum.traces tcJOIN arbitrum.transactions tx ON tc.tx_hash = tx.hashWHERE tc.to = 0xff1a0f4744e8582DF1aE09D5611b887B6a12925CAND tx.block_date <= (NOW() - INTERVAL '1' DAY)AND tx.successGROUP BY 1, 2, 3),CumulativeAddresses AS (SELECTa.chain_name,a.date,COUNT(DISTINCT b.tx_from) AS cumulative_unique_addressesFROM DailyUniqueAddresses aJOIN DailyUniqueAddresses b ON a.chain_name = b.chain_name AND a.date >= b.dateGROUP BY 1, 2ORDER BY 1, 2)SELECTa.chain_name,a.date,COUNT(DISTINCT a.tx_from) AS daily_unique_addresses,COALESCE(b.cumulative_unique_addresses, 0) AS cumulative_unique_addressesFROM DailyUniqueAddresses aLEFT JOIN CumulativeAddresses b ON a.chain_name = b.chain_name AND a.date = b.dateGROUP BY 1, 2, 4ORDER BY 1, 2;