Query editor
-- MINER REVENUE IN USD, WEEKLY: block subsidy + fees (BTC priced) + NAT credited to miners (priced from the Ethereum DEX pools).-- NAT price = weekly VWAP of every Uniswap v4 NAT swap against ETH/WETH (WETH priced daily) or USDC/USDT, on the bridged ERC-20-- 0x249130f5e2dd4cf278180c0df8273f3592ad1247. NAT amounts are whole units (the token has 0 decimals).-- NAT credited to miners = every block since 885,588 (query_8739102, the per-block emission with pool attribution),-- whether the pool has adopted or not; "adopting pools" is the subset that actually collects it.-- "NAT vs BTC revenue %" = NAT value / (subsidy + fees), the same denominator as the fee-share chart.-- Starts at the first week with a NAT price; current week excluded.-- 2026-09-17: both prices.usd_daily scans bounded to day >= 2025-08-01 (the first NAT price week); unbounded they timed out at 120s on the Small engine.with nat_px as (with pools as (select id as pool_id,case when currency1 = 0x249130f5e2dd4cf278180c0df8273f3592ad1247 then 1 else 0 end as nat_slot,case when currency1 = 0x249130f5e2dd4cf278180c0df8273f3592ad1247 then currency0 else currency1 end as pairedfrom uniswap_v4_ethereum.PoolManager_evt_Initializewhere currency0 = 0x249130f5e2dd4cf278180c0df8273f3592ad1247 or currency1 = 0x249130f5e2dd4cf278180c0df8273f3592ad1247),sw as (select s.evt_block_time, p.paired,abs(cast(case when p.nat_slot = 1 then s.amount1 else s.amount0 end as double)) as nat_amt,abs(cast(case when p.nat_slot = 1 then s.amount0 else s.amount1 end as double)) as other_amtfrom uniswap_v4_ethereum.PoolManager_evt_Swap s join pools p on p.pool_id = s.idwhere p.paired in (0x0000000000000000000000000000000000000000, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 0xdac17f958d2ee523a2206206994597c13d831ec7)),eth_px as (select day, price from prices.usd_daily where blockchain = 'ethereum' and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 and day >= date '2025-08-01')select date_trunc('week', sw.evt_block_time) as week,sum(case when paired in (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 0xdac17f958d2ee523a2206206994597c13d831ec7)then other_amt / 1e6 else other_amt / 1e18 * e.price end) / sum(nat_amt) as nat_usdfrom sw left join eth_px e on e.day = date_trunc('day', sw.evt_block_time)group by 1 having sum(nat_amt) > 0),btc_px as (select date_trunc('week', day) as week, avg(price) as btc_usdfrom prices.usd_daily where symbol = 'BTC' and (blockchain is null or blockchain = 'bitcoin') and day >= date '2025-08-01'group by 1),blocks as (select date_trunc('week', time) as week, count(*) as blocks,sum(mint_reward) as subsidy_btc, sum(total_fees) as fees_btc,sum(case when miner_credited then nat_emission else 0 end) as nat_to_miners,sum(case when miner_credited and pool_adopted then nat_emission else 0 end) as nat_to_adoptingfrom query_8739102where height >= 885588group by 1)select b.week, b.blocks, p.btc_usd,round(n.nat_usd * 1e12, 0) as "NAT price, $ per T NAT",round(b.subsidy_btc * p.btc_usd / b.blocks, 0) as "Subsidy per block, $",round(b.fees_btc * p.btc_usd / b.blocks, 0) as "Fees per block, $",round(b.nat_to_miners * n.nat_usd / b.blocks, 2) as "NAT per block, $",round(b.fees_btc * p.btc_usd / 1e3, 1) as "Fees, $k",round(b.nat_to_miners * n.nat_usd / 1e3, 2) as "NAT credited to miners, $k",round(b.nat_to_adopting * n.nat_usd / 1e3, 2) as "NAT to adopting pools, $k",round(100.0 * b.nat_to_miners * n.nat_usd / (b.fees_btc * p.btc_usd), 2) as "NAT vs fees %",round(100.0 * b.nat_to_miners * n.nat_usd / ((b.subsidy_btc + b.fees_btc) * p.btc_usd), 4) as "NAT vs all BTC revenue %",round(100.0 * b.fees_btc / (b.subsidy_btc + b.fees_btc), 2) as "Fee share %"from blocks bjoin nat_px n on n.week = b.weekjoin btc_px p on p.week = b.weekwhere b.week < date_trunc('week', now())