Query editor
with ev as (select *, case when debt_usd is not null and coll_usd is not null and debt_usd < 1e9 and coll_usd < 2*debt_usd + 1000 then greatest(coll_usd - debt_usd, 0) end bonusfrom dune.fadz2323.result_eth_liq_oct_dec_2026),t as (select h, min(proto) pgrp, max(miner) miner, max(gas_used) gas_used, sum(bonus) bonus, max(svr_idx) svr_idx, min(txi) txi from ev group by h),lab as (select address, max(name) name from labels.addresses where blockchain = 'ethereum' and address in (select miner from t) group by 1),b as (select 'BUILDER' sec, coalesce(lab.name, to_hex(t.miner)) k, count(*) n_tx, sum(bonus) bonus, sum(bonus) / (select sum(bonus) from t) share,count_if(svr_idx is not null and txi - svr_idx = 1) n_svr, null med_gas, null p90_gasfrom t left join lab on lab.address = t.miner group by 2),g as (select 'GAS' sec, pgrp k, count(*) n_tx, null bonus, null share, null n_svr, approx_percentile(gas_used, 0.5) med_gas, approx_percentile(gas_used, 0.9) p90_gasfrom t where gas_used is not null group by 2)select * from (select * from b order by bonus desc limit 12) union all select * from g