This repository contains the SQL query used to identify quantum-vulnerable Bitcoin addresses on the Bitcoin mainnet blockchain. This query powers the Bitcoin Risq List by analyzing the public Bitcoin blockchain data available through the BigQuery Bitcoin ETL.
An address becomes quantum-vulnerable when its public key has been exposed on the Bitcoin mainnet blockchain. This can happen in two ways:
- Address Type: Some address types (P2PK, P2MS, P2TR) expose their public key immediately when receiving funds.
- Address Reuse: Any address that has been used to send a transaction has its public key exposed. If funds remain in or are sent back to such an address, they become quantum-vulnerable.
The main query (btc_at_quantum_risk_query.sql) identifies addresses with exposed public keys and their current unspent balances. It:
- Tracks addresses exposed through spends
- Identifies inherently exposed address types
- Calculates current balances for all exposed addresses
- Uses table partitioning for efficient processing
To run this query:
- Sign up for Google Cloud Platform (includes free tier with 1TB monthly query quota)
- Open BigQuery Studio
- Configure the query:
-- Set your destination table CREATE OR REPLACE TABLE `your-project.your_dataset.your_table_name` AS -- Adjust analysis window (examples) DECLARE cutoff_month DATE DEFAULT '2011-01-01'; -- Early Bitcoin history DECLARE cutoff_block INT64 DEFAULT 100000; -- First ~100k blocks
- Read our detailed blog post about Quantum vulnerability of Bitcoin addresses
- Check our FAQs for common questions about the Bitcoin Risq List