Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with decodes as (select *from (SELECT-- row_number() OVER (order by t.block_height asc, t.index asc) as ordinal_number,output_value, t.block_time, t.block_height, t.size, t.virtual_size, t.fee*1e8 as fee, t.fee*1e8/t.virtual_size as sat_per_vbyte, t.output[1].script_pub_key.address as minter_address, t.index, t.id as tx_id, case when cast(t.hex as varchar) LIKE '%0063036f726401%' then 'Ordinal Tx' else 'Non-Ordinal Tx' end as is_ord_tx-- , t.hexFROM bitcoin.transactions twhere t.block_height >= 770250-- AND cast(t.hex as varchar) LIKE '%0063036f726401%' -- OP_FALSE (0x00) OP_IF (0x63) OP_PUSHBYTES3 (0x03) "ord" (0x6f7264) OP_1 (0x01) https://docs.ordinals.com/inscriptions.html-- and cast(t.hex as varchar) LIKE '%626974706978656c%' -- bitpixel-- AND t.input[1].witness_data[2] LIKE '%0063036f726401%' AND t.input[1].type = 'witness_v1_taproot' thenthis doesn't wwhenk because of array length checks-- order by ordinal_number desc-- and MOD(length(regexp_extract(cast(hex as varchar), '7b2(?:[^7]|7[^bd])*7d(?=[06])')),2) = 0)),ord_txs as (select case when date(block_time) > current_date - interval '1' day then 'D-1' else 'not D-1' end as is_d1, case when date(block_time) > current_date - interval '7' day then 'D-7' else 'not D-7' end as is_d7, case when date(block_time) > current_date - interval '30' day then 'D-30' else 'not D-30' end as is_d30, is_ord_tx, count(distinct tx_id) as count_txsfrom decodesgroup by 1,2,3,4)SELECT total_ord_txs, total_non_ord_txs, total_ord_txs_d1, total_ord_txs_d7, total_ord_txs_d30, total_non_ord_txs_d1, total_non_ord_txs_d7, total_non_ord_txs_d30, ord_tx_share * 100 as ord_tx_share_perc, ord_tx_share_d1 * 100 as ord_tx_share_d1_perc, ord_tx_share_d7 * 100 as ord_tx_share_d7_perc, ord_tx_share_d30 * 100 as ord_tx_share_d30_perc, case when ord_tx_share_d30 > 0.01 then 'NO' else 'YES' end as are_ordinals_dead -- if ord share of last day >1% then NOfrom (selectsum(case when is_ord_tx = 'Ordinal Tx' then a.count_txs * 1.00 else 0 end) as total_ord_txs,sum(case when is_ord_tx = 'Non-Ordinal Tx' then a.count_txs * 1.00 else 0 end) as total_non_ord_txs,SUM(case when a.is_d1 = 'D-1' and is_ord_tx = 'Ordinal Tx' then a.count_txs * 1.00 else 0 end) as total_ord_txs_d1,