Query editor
-- Bitcoin quantum dashboard: permanently exposed supply trend (stock series)-- 21Shares Research | Quantum Vulnerability Monitor---- Corrected dashboard version.-- Builds true monthly stock series from 2020 onward by:-- 1) computing the exposed supply baseline as of 2020-01-01-- 2) adding monthly created outputs-- 3) subtracting monthly spent outputs---- This yields an as-of-month approximation of exposed supply for P2PK and P2TR,-- suitable for the migration velocity chart.WITH months AS (SELECT monthFROM UNNEST(SEQUENCE(DATE '2020-01-01', DATE_TRUNC('month', CURRENT_DATE), INTERVAL '1' MONTH)) AS t(month)),baseline AS (SELECTo.type,SUM(o.value) AS baseline_btcFROM bitcoin.outputs oWHERE o.type IN ('pubkey', 'witness_v1_taproot')AND o.block_date < DATE '2020-01-01'AND NOT EXISTS (SELECT 1FROM bitcoin.inputs iWHERE i.spent_tx_id = o.tx_idAND i.spent_output_number = o.indexAND i.block_date < DATE '2020-01-01')GROUP BY 1),monthly_created AS (SELECTDATE_TRUNC('month', o.block_time) AS month,o.type,SUM(o.value) AS btc_created_this_monthFROM bitcoin.outputs oWHERE o.type IN ('pubkey', 'witness_v1_taproot')AND o.block_date >= DATE '2020-01-01'GROUP BY 1, 2),monthly_spent AS (SELECTDATE_TRUNC('month', i.block_time) AS month,i.type,SUM(i.value) AS btc_spent_this_monthFROM bitcoin.inputs iWHERE i.type IN ('pubkey', 'witness_v1_taproot')AND i.block_date >= DATE '2020-01-01'GROUP BY 1, 2),base AS (SELECTm.month,COALESCE(pb.baseline_btc, 0) AS p2pk_baseline_btc,COALESCE(tb.baseline_btc, 0) AS p2tr_baseline_btc,COALESCE(pc.btc_created_this_month, 0) AS p2pk_created_btc,COALESCE(ps.btc_spent_this_month, 0) AS p2pk_spent_btc,COALESCE(tc.btc_created_this_month, 0) AS p2tr_created_btc,