Query editor
WITH transaction_details AS (SELECTDATE(block_time) AS transaction_day,DATE_TRUNC('week', block_time) AS transaction_week,DATE_TRUNC('month', block_time) AS transaction_month,hash,value / 1e18 AS value_eth,gas_used * gas_price / 1e18 AS gas_spent_eth,"to"FROM base.transactionsWHERE "from" = FROM_HEX(SUBSTRING('{{wallet}}', 3))),eth_price AS (SELECTDATE_TRUNC('day', minute) AS price_day,AVG(price) AS eth_usd_priceFROM prices.usdWHERE blockchain = 'base'AND contract_address = 0x4200000000000000000000000000000000000006GROUP BY 1),summary AS (SELECTMIN(transaction_day) AS first_transaction_date,COUNT(hash) AS total_tx_count,SUM(value_eth) AS total_value_eth,SUM(value_eth * ep.eth_usd_price) AS total_value_usd,SUM(gas_spent_eth) AS total_gas_spent_eth,SUM(gas_spent_eth * ep.eth_usd_price) AS total_gas_spent_usd,COUNT(DISTINCT transaction_day) AS unique_active_days,COUNT(DISTINCT transaction_week) AS unique_active_weeks,COUNT(DISTINCT transaction_month) AS unique_active_months,COUNT(DISTINCT "to") AS unique_contracts_interacted,((SUM(value_eth * ep.eth_usd_price) + SUM(gas_spent_eth * ep.eth_usd_price)) * 0.1) / 100 AS wallet_scoreFROM transaction_details tdLEFT JOIN eth_price epON td.transaction_day = ep.price_day),wallet_rankings AS (SELECTwallet,NTILE(10) OVER (ORDER BY wallet_score) AS wallet_score_rankFROM (SELECT"from" AS wallet,SUM(value / 1e18 * ep.eth_usd_price) AS total_value_usd,SUM(gas_used * gas_price / 1e18 * ep.eth_usd_price) AS total_gas_spent_usd,((SUM(value / 1e18 * ep.eth_usd_price) + SUM(gas_used * gas_price / 1e18 * ep.eth_usd_price)) * 0.1) / 100 AS wallet_scoreFROM base.transactions tLEFT JOIN eth_price epON DATE(t.block_time) = ep.price_dayGROUP BY "from") wallet_scores)SELECT 'First Transaction Date' AS metric, CAST(first_transaction_date AS VARCHAR) AS value FROM summaryUNION ALLSELECT 'Total Transactions', CAST(total_tx_count AS VARCHAR) FROM summaryUNION ALLSELECT 'Total Transaction Volume',