Query editor
with all_banana as (select block_time, block_date,block_number,"from","type",t.hash,t.gas_used/1e18 * (t.gas_price - base_fee_per_gas) as pri_fee,bb.block.extraData as extradatafrom ethereum.transactions tjoin ethereum.raw_0004 bb on bb.blocknumber = block_numberjoin ethereum.blocks b on b."number" = block_numberwhere (block_date between date('2024-01-01') and date('2024-06-01'))and (blockdate between date('2024-01-01') and date('2024-06-01'))and (b."date" between date('2024-01-01') and date('2024-06-01'))and "to" = 0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49), cb_transfer as (select tr.tx_hash, tr.value/1e18 as tipfrom ethereum.traces trjoin all_banana a on tr.tx_hash = a.hashjoin ethereum.blocks b on b."number" = tr.block_numberwhere tr."to" = b.miner and value != 0 -- tx has a eth transfer to builderand success = true -- make sure the trace was successfulAND (b.date between date('2024-01-01') and date('2024-06-01'))AND (tr.block_date between date('2024-01-01') and date('2024-06-01'))), titan_snipe_share as (select block_date,1.0000*sum(case when from_utf8(from_hex(extradata)) like '%Titan%' then pri_fee+tip else 0 end) / sum(pri_fee + tip) as titan_value_share,1.0000*count(distinct case when from_utf8(from_hex(extradata)) like '%Titan%' then block_number else null end) / count(distinct block_number) as titan_bg_order_sharefrom all_banana aleft join cb_transfer c on c.tx_hash = a.hashwhere "type" ='DynamicFee' and tip is not null -- snipegroup by 1), titan_manual_share as (select block_date,1.0000*sum(case when from_utf8(from_hex(extradata)) like '%Titan%' then pri_fee else 0 end) / sum(pri_fee) as titan_value_share,1.0000*count(distinct case when from_utf8(from_hex(extradata)) like '%Titan%' then block_number else null end) / count(distinct block_number) as titan_bg_order_sharefrom all_banana aleft join cb_transfer c on c.tx_hash = a.hashwhere tip is null -- manualgroup by 1)selectblockdate,min(m.titan_bg_order_share) as titan_manual_block_share,min(m.titan_value_share) as titan_manual_value_share,min(s.titan_bg_order_share) as titan_snipe_block_share,min(s.titan_value_share) as titan_snipe_value_share,1.0000*sum(case when from_utf8(from_hex(block.extraData)) like '%Titan%' then 1 else 0 end) / count(blocknumber) as titan_block_sharefrom ethereum.raw_0004 rjoin titan_snipe_share s on r.blockdate = s.block_datejoin titan_manual_share m on r.blockdate = m.block_datewhere blockdate between date('2024-01-01') and date('2024-06-01')group by 1