Query editor
with config as (selectdate '2023-12-27' as deployed_date,0 as deployed_height,0x736f70686f6e as request_ticker,'0x000000' as mint_bitworkc,'0x' as mint_bitworkr,100000 as mint_amount,0 as mint_height,420000 as max_mints,'sophon' as symbol),raw_mint AS(SELECTspent_tx_id AS commit_txid,tx_id AS reveal_txidFROM bitcoin.inputsWHERE block_date >= (SELECT deployed_date FROM config)AND block_height >= (SELECT deployed_height FROM config)AND block_height >= (SELECT mint_height FROM config)AND cardinality(witness_data) >= 2AND cast(witness_data[2] AS varchar) LIKE '%0461746f6d03646d74%' -- atom dmtAND substr(witness_data[2],bytearray_position(witness_data[2], 0x6b6d696e745f7469636b6572) + 13,LENGTH((SELECT request_ticker FROM config))) = (SELECT request_ticker FROM config)AND substr(cast(spent_tx_id AS varchar),1,LENGTH((SELECT mint_bitworkc FROM config))) = (SELECT mint_bitworkc FROM config)AND substr(cast(tx_id AS varchar),1,LENGTH((SELECT mint_bitworkr FROM config))) = (SELECT mint_bitworkr FROM config)),success AS(select*from(SELECTRANK() OVER (ORDER BY r.block_height, r.index) AS num,c.block_time AS commit_block_time,r.block_time AS reveal_block_time,c.block_height AS commit_block_height,r.block_height AS reveal_block_height,c.index AS commit_tx_index,r.index AS reveal_tx_index,c.fee AS commit_fee_btc,r.fee AS reveal_fee_btc,commit_txid,reveal_txid,r.output[1].script_pub_key.address AS address, -- primary(SELECT mint_amount FROM config) AS mint_amount,r.output[1].value AS valueFROM raw_mintLEFT JOIN bitcoin.transactions cON c.block_date >= (SELECT deployed_date FROM config) AND c.block_height >= (SELECT deployed_height FROM config) AND c.block_height >= (SELECT mint_height FROM config) AND commit_txid = c.idLEFT JOIN bitcoin.transactions rON r.block_date >= (SELECT deployed_date FROM config) AND r.block_height >= (SELECT deployed_height FROM config) AND r.block_height >= (SELECT mint_height FROM config) AND reveal_txid = r.idORDER BY1) awhere num<=(select max_mints from config)),failure AS(