Query editor
-- DUNE Query to fetch Daily Transactions across Ethereum, Optimism and Arbitrum--> Showcases the activity levels and user preference across these networks.--> Helps developers decide which platforms might be best suited for their applications based on current usage.-- CTE for Ethereum daily transactionsWITH eth_daily AS (-- Extract the date and count the transactions for EthereumSELECT DATE_TRUNC('day', block_time) AS day, COUNT(*) as eth_tx_countFROM ethereum.transactionsGROUP BY DATE_TRUNC('day', block_time)),-- CTE for Optimism daily transactionsoptimism_daily AS (-- Extract the date and count the transactions for OptimismSELECT DATE_TRUNC('day', block_time) AS day, COUNT(*) as optimism_tx_countFROM optimism.transactionsGROUP BY DATE_TRUNC('day', block_time)),-- CTE for Arbitrum daily transactionsarbitrum_daily AS (-- Extract the date and count the transactions for ArbitrumSELECT DATE_TRUNC('day', block_time) AS day, COUNT(*) as arbitrum_tx_countFROM arbitrum.transactionsGROUP BY DATE_TRUNC('day', block_time))-- Main query to join all CTEs and get the daily transaction counts for each chainSELECT-- Use COALESCE to ensure we get a date even if one or more chains do not have transactions for a given dayCOALESCE(eth.day, optimism.day, arbitrum.day) AS day,-- Use COALESCE to provide a default of 0 for days without transactionsCOALESCE(eth_tx_count, 0) as Ethereum_Daily_Tx,COALESCE(optimism_tx_count, 0) as Optimism_Daily_Tx,COALESCE(arbitrum_tx_count, 0) as Arbitrum_Daily_Tx-- Joining Ethereum daily data with Optimism and Arbitrum using FULL OUTER JOINs to ensure we don't miss days present in one CTE but absent in othersFROM eth_daily ethFULL OUTER JOIN optimism_daily optimism ON eth.day = optimism.dayFULL OUTER JOIN arbitrum_daily arbitrum ON eth.day = arbitrum.day OR optimism.day = arbitrum.day-- Filter for the last 30 daysWHERE eth.day >= (NOW() - INTERVAL '30' DAY)-- Order the results by date in descending orderORDER BY day DESC;