Query editor
WITH eth_monthly_txs AS (-- ethereum queryWITH monthly_txs AS (SELECTdate_trunc('month', block_time) AS tx_month,address,count(*)FROM safe_ethereum.transactionswhere block_time >= date('2023-01-01')and block_time < date('2023-10-01')GROUP BY 1, 2 -- group by month and address to have 1 row per user per monthhaving count(*) > {{tx_number}})SELECT'ethereum' as chain,tx_month,COUNT(DISTINCT address) AS active_usersFROM monthly_txsGROUP BY 1, 2ORDER BY 2), polygon_monthly_txs AS (-- polygon queryWITH monthly_txs AS (SELECTdate_trunc('month', block_time) AS tx_month,address,count(*)FROM safe_polygon.transactionswhere block_time >= date('2023-01-01')and block_time < date('2023-10-01')GROUP BY 1, 2 -- group by month and address to have 1 row per user per monthhaving count(*) > {{tx_number}})SELECT'polygon' as chain,tx_month,COUNT(DISTINCT address) AS active_usersFROM monthly_txsGROUP BY 1, 2ORDER BY 2), optimism_monthly_txs AS (-- optimism queryWITH monthly_txs AS (SELECTdate_trunc('month', block_time) AS tx_month,address,count(*)FROM safe_optimism.transactionswhere block_time >= date('2023-01-01')and block_time < date('2023-10-01')GROUP BY 1, 2 -- group by month and address to have 1 row per user per monthhaving count(*) > {{tx_number}})SELECT'optimism' as chain,tx_month,COUNT(DISTINCT address) AS active_usersFROM monthly_txsGROUP BY 1, 2ORDER BY 2