Query editor
withlatest_block as (select max(block_height) as max_block from bitcoin.transactions),outputs as (select * from bitcoin.outputswhere block_time > date'2024-08-22'and block_height >= 857909),transactions as (select id,indexfrom bitcoin.transactionswhere block_time > date'2024-08-22'and block_height >= 857909),restaking_txs as (selecto.tx_id,substr(o.script_hex,7,1) as version,substr(o.script_hex,8,32) as staker,substr(o.script_hex,40,32) as finality_provider,substr(o.script_hex,72,2) as stakingtime,t.indexfrom outputs ojoin transactions ton o.tx_id = t.idwhere substr(script_hex, 1,6) = 0x6a4762626e31),restake_info as (selecto.block_time,o.block_height,o.tx_id,o.value,o.address,o.type,r.version,r.staker,r.finality_provider,r.stakingtime,r.index,d.data__description__moniker as finality_provider_namefrom outputs ojoin restaking_txs ron o.tx_id = r.tx_idleft join dune.pyor_xyz.dataset_babylon_finality_providers_metadata don r.finality_provider = from_hex('0x'||d.data__btc_pk)where o.index = 0),data as (select i.*,sum(value) over(order by block_height,index) as total_btc,casewhen i.block_height < l.max_block-6then 'confirmed'else 'pending'end as statusfrom restake_info i,latest_block l),