Query editor
-- Bitcoin quantum vulnerability: BTC in reused addresses (exposed public keys)-- 21Shares Research | Quantum Vulnerability Monitor---- When a P2PKH or P2WPKH address spends, the public key is revealed in the-- transaction input. If that address then receives MORE bitcoin, those new-- UTXOs sit behind an already-exposed public key — making them vulnerable-- to at-rest quantum attacks (no time constraint).---- This query finds: all UNSPENT outputs at P2PKH/P2WPKH addresses where-- the same address has appeared in bitcoin.inputs (meaning it spent before,-- exposing the public key).---- IMPORTANT: This is a HEAVY query scanning both tables fully.-- Run on LARGE tier. Expected runtime: 10-30 minutes.WITH exposed_addresses AS (-- Find all addresses that have ever spent (public key revealed)SELECT DISTINCT addressFROM bitcoin.inputsWHERE type IN ('pubkeyhash', 'witness_v0_keyhash')AND address IS NOT NULLAND address != ''),unspent_at_exposed AS (-- Find unspent outputs at those same addressesSELECTo.type,o.address,o.value,o.tx_id,o.indexFROM bitcoin.outputs oINNER JOIN exposed_addresses ea ON o.address = ea.addressWHERE o.type IN ('pubkeyhash', 'witness_v0_keyhash')AND NOT EXISTS (SELECT 1FROM bitcoin.inputs iWHERE i.spent_tx_id = o.tx_idAND i.spent_output_number = o.index))SELECTtype AS script_type,COUNT(*) AS reused_utxo_count,COUNT(DISTINCT address) AS reused_address_count,ROUND(SUM(value), 8) AS total_btc_exposed_via_reuse,ROUND(SUM(value) * 68000, 0) AS approx_usd_value_at_68kFROM unspent_at_exposedGROUP BY typeORDER BY total_btc_exposed_via_reuse DESC