Query editor
-- AX1 | Base Agentic — Token Economy & ETH Flow Analysis-- Tracks ETH and gas flows through Base agentic ecosystemWITH weekly_economics AS (SELECTDATE_TRUNC('week', t.block_time) AS week,COUNT(*) AS total_txns,COUNT(DISTINCT t."from") AS active_senders,COUNT(DISTINCT t.to) AS active_contracts,SUM(t.gas_used) AS total_gas_units,AVG(t.gas_used) AS avg_gas_per_txn,SUM(t.gas_used * t.gas_price) / 1e18 AS total_eth_fees,AVG(t.gas_price) / 1e9 AS avg_gas_price_gwei,SUM(CASE WHEN t.value > 0 THEN t.value ELSE 0 END) / 1e18 AS total_eth_transferred,COUNT(CASE WHEN t.value > 0 THEN 1 END) AS eth_value_txns,SUM(CASE WHEN t.value = 0 THEN 1 ELSE 0 END) AS zero_value_txns,MAX(t.gas_price) / 1e9 AS max_gas_price_gwei,approx_percentile(t.gas_price, 0.5) / 1e9 AS median_gas_price_gweiFROM base.transactions tWHERE t.block_time >= TIMESTAMP '2024-09-01'AND t.block_time < NOW()AND t.success = TRUEAND t.to IN (0x1bb0b3bc29e03dab0eed2b14a8b2d61fa3ee7e16,0x5d64d14d2cf4fe5db89cd71fb9b6e24cc65e7347,0x7e7a0e201fd38d3adaa9523da6c109a07118c96a,0x09188484e1ab980daef1b89c673a87f89fca674a,0x0b0d3fdb861b4c2827c8c97ec84a6d1a44f05a55,0x4ed4e862860bed51a9570b96d89af5e1b0efefed,0xcf205808ed36593aa40a44f10c7f7c2f67d4ef0a,0x940181a94a35a4569e4529a3cdfb74e38fd98631,0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22)GROUP BY 1),with_growth AS (SELECTweek,total_txns,active_senders,active_contracts,ROUND(avg_gas_per_txn, 0) AS avg_gas_per_txn,ROUND(total_eth_fees, 6) AS total_eth_fees,ROUND(avg_gas_price_gwei, 4) AS avg_gas_price_gwei,ROUND(median_gas_price_gwei, 4) AS median_gas_price_gwei,ROUND(total_eth_transferred, 6) AS total_eth_transferred,eth_value_txns,zero_value_txns,ROUND(total_eth_fees / NULLIF(total_txns, 0) * 1e6, 2) AS eth_fee_per_txn_microeth,ROUND(100.0 * (total_txns - LAG(total_txns) OVER (ORDER BY week)) / NULLIF(LAG(total_txns) OVER (ORDER BY week), 0), 2) AS txn_wow_growth_pct,ROUND(100.0 * (total_eth_fees - LAG(total_eth_fees) OVER (ORDER BY week)) / NULLIF(LAG(total_eth_fees) OVER (ORDER BY week), 0), 2) AS fee_wow_growth_pct,ROUND(100.0 * (active_senders - LAG(active_senders) OVER (ORDER BY week)) / NULLIF(LAG(active_senders) OVER (ORDER BY week), 0), 2) AS users_wow_growth_pct,SUM(total_eth_fees) OVER (ORDER BY week ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_eth_fees,SUM(total_txns) OVER (ORDER BY week ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_txns,ROUND(total_eth_fees / NULLIF(active_senders, 0), 8) AS eth_fee_per_user,ROUND(100.0 * eth_value_txns / NULLIF(total_txns, 0), 2) AS pct_value_bearing_txnsFROM weekly_economics)