Query editor
-- Bitcoin quantum vulnerability: P2SH + P2WSH reuse exposure-- 21Shares Research | Quantum Vulnerability Monitor---- P2SH and P2WSH outputs hide the redeem/witness script behind a hash.-- When spent, the full script (containing public keys) is revealed.-- If the same address receives more BTC after spending, those new UTXOs-- sit behind an already-revealed script — exposed to quantum attack.---- This query finds all UNSPENT P2SH/P2WSH outputs at addresses that-- have previously appeared in bitcoin.inputs.WITH exposed_script_addresses AS (SELECT DISTINCT addressFROM bitcoin.inputsWHERE type IN ('scripthash', 'witness_v0_scripthash')AND address IS NOT NULLAND address != '')SELECTo.type AS script_type,COUNT(*) AS reused_utxo_count,COUNT(DISTINCT o.address) AS reused_address_count,ROUND(SUM(o.value), 4) AS total_btc_exposed_via_reuse,ROUND(SUM(o.value) * 68000, 0) AS approx_usd_at_68kFROM bitcoin.outputs oINNER JOIN exposed_script_addresses ea ON o.address = ea.addressWHERE o.type IN ('scripthash', 'witness_v0_scripthash')AND NOT EXISTS (SELECT 1FROM bitcoin.inputs iWHERE i.spent_tx_id = o.tx_idAND i.spent_output_number = o.index)GROUP BY o.typeORDER BY total_btc_exposed_via_reuse DESC