Query editor
-- 1) Grab the distinct tx_hash from existingWITH distinct_tfhe_tx AS (SELECT DISTINCTtx_hashFROM dune.zama_fhe.result_fhevm_executor_mainnet_internal_transactions),-- 2) Join directly to sepolia.transactions, group by monthmonthly_aggregates AS (SELECTDATE_TRUNC('month', t.block_time) AS month,-- sum of fees in ETHSUM((t.gas_used * t.gas_price)/1e18) AS monthly_total_feeFROM ethereum.transactions tJOIN distinct_tfhe_tx dON t.hash = d.tx_hashGROUP BY 1)SELECTmonth,monthly_total_fee,-- 3-month moving averageAVG(monthly_total_fee) OVER (ORDER BY monthROWS BETWEEN 2 PRECEDING AND CURRENT ROW) AS total_fee_moving_average,-- Running cumulative totalSUM(monthly_total_fee) OVER (ORDER BY month RANGE UNBOUNDED PRECEDING) AS cumulative_feeFROM monthly_aggregatesORDER BY month DESC;