Query editor
-- rewards begin on block 1 rather than block 0 (mod 2100)select (tx.block_height - 666051) / 2100 as cycle, count(distinct tx.input[1].script_pub_key.address) FILTER(WHERE ox.index = 0) as miners_uniq, count(distinct ox.script_pub_key.address) FILTER(WHERE ox.script_pub_key.address <> '1111111111111111111114oLvT2'AND ox.index > 0) as stackers_uniq, coalesce(round(sum(ox.value) FILTER(WHERE ox.script_pub_key.address <> '1111111111111111111114oLvT2'AND ox.index > 0), 8), 0) as net_stack, coalesce(round(sum(ox.value) FILTER(WHERE ox.script_pub_key.address = '1111111111111111111114oLvT2'OR ox.index = 0 -- OP_RETURN), 8), 0) as net_burn, coalesce(round(sum(tx.fee) FILTER(WHERE ox.index = 0), 8), 0) as net_feesFROM bitcoin.transactions txCROSS JOIN UNNEST(tx.output) as oxWHERE tx.block_height >= 666050 -- Stacks 2.0 genesisAND tx.input_count = 1AND tx.output_count between 2 and 4AND starts_with(tx.output[1].script_pub_key.hex, 0x6a4c5058325b) -- OP_RETURN + OP_PUSHDATA1(0x50) + magic 'X2' + stx_op '['AND (ox.index = 0OR ox.script_pub_key.address <> tx.input[1].script_pub_key.address -- ignore change / pay to self)GROUP BY 1ORDER BY 1