Query editor
-- Canonical mainnet epoch-end storage flows and actual storage-fund rewards paid to validators.-- System and validator events label the NEW epoch; rewards belong to epoch - 1.-- Storage deposits are principal, not the validator payout. Payouts are the sum of-- ValidatorEpochInfoEvent[ V2 ].storage_fund_staking_reward, after reward adjustments.-- Pool rewards plus storage-fund rewards must reconcile to the system's distributed total.-- Matched 30/60/90 COMPLETED EPOCHS: last before Apr 22 vs first starting Apr 29 or later.-- Rate comparisons use elapsed epoch time; they are not the dashboard's exact UTC-day windows.-- January charts use epoch-end dates, include no incomplete epoch, and never fill missing data with zero.WITH raw AS (SELECT transaction_digest, event_index, _ingested_at, event_type,from_unixtime(cast(timestamp_ms AS double) / 1000) epoch_end_time,try_cast(json_extract_scalar(event_json, '$.epoch') AS bigint) new_epoch,json_extract_scalar(event_json, '$.validator_address') validator_address,try_cast(json_extract_scalar(event_json, '$.reference_gas_price') AS bigint) next_epoch_rgp_mist,try_cast(json_extract_scalar(event_json, '$.storage_charge') AS bigint) storage_charge_mist,try_cast(json_extract_scalar(event_json, '$.storage_rebate') AS bigint) storage_rebate_mist,try_cast(json_extract_scalar(event_json, '$.storage_fund_balance') AS bigint) fund_balance_mist,try_cast(json_extract_scalar(event_json, '$.total_stake') AS bigint) total_validator_stake_mist,try_cast(json_extract_scalar(event_json, '$.storage_fund_reinvestment') AS bigint) reinvestment_mist,try_cast(json_extract_scalar(event_json, '$.leftover_storage_fund_inflow') AS bigint) leftover_mist,try_cast(json_extract_scalar(event_json, '$.stake_subsidy_amount') AS bigint) subsidy_mist,try_cast(json_extract_scalar(event_json, '$.total_gas_fees') AS bigint) computation_mist,try_cast(json_extract_scalar(event_json, '$.total_stake_rewards_distributed') AS bigint) distributed_rewards_mist,try_cast(json_extract_scalar(event_json, '$.pool_staking_reward') AS bigint) pool_reward_mist,try_cast(json_extract_scalar(event_json, '$.storage_fund_staking_reward') AS bigint) storage_fund_reward_mistFROM sui.eventsWHERE date >= DATE '2025-12-23' AND date <= current_dateAND event_type IN ('0x3::sui_system_state_inner::SystemEpochInfoEvent','0x3::validator_set::ValidatorEpochInfoEvent','0x3::validator_set::ValidatorEpochInfoEventV2')), dedup AS (SELECT *, count(*) OVER (PARTITION BY transaction_digest, event_index) source_copies,row_number() OVER (PARTITION BY transaction_digest, event_index ORDER BY _ingested_at DESC) copy_rankFROM raw), aggregate_epochs AS (SELECT new_epoch, max(epoch_end_time) epoch_end_time,max(next_epoch_rgp_mist) next_epoch_rgp_mist,max(storage_charge_mist) storage_charge_mist,max(storage_rebate_mist) storage_rebate_mist,max(fund_balance_mist) fund_balance_mist,max(total_validator_stake_mist) total_validator_stake_mist,max(reinvestment_mist) reinvestment_mist,max(leftover_mist) leftover_mist,max(subsidy_mist) subsidy_mist,max(computation_mist) computation_mist,max(distributed_rewards_mist) distributed_rewards_mist,sum(pool_reward_mist) pool_rewards_mist,sum(storage_fund_reward_mist) storage_fund_rewards_mist,count_if(event_type = '0x3::sui_system_state_inner::SystemEpochInfoEvent') system_event_count,count_if(event_type <> '0x3::sui_system_state_inner::SystemEpochInfoEvent') validator_event_count,count(DISTINCT validator_address) distinct_validators,count_if(event_type = '0x3::validator_set::ValidatorEpochInfoEvent') validator_v1_count,count_if(event_type = '0x3::validator_set::ValidatorEpochInfoEventV2') validator_v2_count,count_if(source_copies <> 1) duplicate_source_event_count,count_if(event_type <> '0x3::sui_system_state_inner::SystemEpochInfoEvent'AND (validator_address IS NULL OR pool_reward_mist IS NULL OR storage_fund_reward_mist IS NULL)) incomplete_validator_eventsFROM dedup WHERE copy_rank = 1GROUP BY new_epoch