Query editor
WITH fee as (select distinct block_slot, sum(lamports/1e9) as fee_rewardfrom solana.rewardswhere reward_type in ('Fee','Rent')and lamports>0group by 1),inflation as (select distinct-- Use the minimum block_time for each epoch to ensure consistent timingmin(block_time) as block_time,block_slot/432000 as epoch,sum(lamports/1e9) as inflationary_rewardfrom solana.rewardswhere reward_type in ('Staking', 'Voting')group by 2),mev as (SELECTblock_slot / 432000 AS epoch,sum(balance_change/1e9) as jito_rewardsfrom solana.account_activitywhere address in('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5','HFqU5x63VTqvQss8hp11i4wVV8bD44PvwucfZ2bU7gRe','Cw8CFyM9FkoMi7K7Crf6HNQqf4uEMzpKw6QNghXLvLkY','ADaUMid9yfUytqMBgopwjb2DTLSokTSzL1zt6iGPaS49','DfXygSm4jCyNCybVYYK6DwvWqjKee8pbDmJGcLWNDXjh','ADuUkR4vqLUMWXxW9gh6D6L8pMSawimctcNZ5pGwDcEt','DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL','3AVi9Tg9Uo68tJfuvoKvqKNWKkC5wPdSSdeBnizKZ6jT')and token_mint_address is nulland balance_change > 0group by 1),price as (select date_trunc('day', minute) as day, avg(price) as pricefrom prices.usdwheresymbol = 'SOL'and contract_address is nulland minute >= date('2020-12-26')group by 1),epoch_earnings_base as (select block_time, epoch, inflationary_reward, sum(fee_reward) as fee_rewardfrom inflationleft join feeon epoch = floor(block_slot/432000)group by 1,2,3),epoch_earnings as (select block_time, a.epoch, inflationary_reward, fee_reward, jito_rewards as mev_rewardfrom epoch_earnings_base aleft join mev b