Practical Quantum Safe Bitcoin releases code, with spends mined on mainnet

The EspressoSystems/PQSB repository on GitHub holds the paper "Practical Quantum Safe Bitcoin", its implementation and benchmark records, and a Lean formalization of the paper's mathematical results. The paper builds two instances of quantum safe Bitcoin (PQSB). Legacy PQSB depends on legacy Bitcoin Script. SegWit PQSB supports SegWit v0. The README lists three improvements.
The first is faster signing. A "level" is the classical forgery work in bits: a forger who holds the openings of one spend succeeds with a chance of at most 2^-level per try. The signer's cost is the expected number of tries to find a spend. At a 124-bit classical forgery target, Legacy PQSB needs about 2^28.7 expected signing trials. Thirty spends at that level took 0.76 s on average in the solver on one RTX 5090. With the optimised solvers the estimate is about 24 s on a MacBook M3's GPU, where five spends on the previous build took 10 to 23 s (about 9 to 21 s at the faster build's rates), and about 41 s on four x86 cores with the SHA extensions. A spend at that level was mined on mainnet in block 978,560.
The second is a tradeoff between signing time and forgery resistance. Raising Legacy PQSB's forgery target to about 132 bits requires about 2^35.2 signing trials: about 9 s expected on one RTX 5090, where three spends on the previous build took 8 to 20 s, and about 12 minutes on the M3's GPU. Legacy PQSB comes at seven levels, from 92 to 140 bits. SegWit PQSB comes at six, from 64 to 95 bits.
The third is SegWit compatibility with mempool propagation. SegWit PQSB fits the standard P2WSH relay limits, so any node relays its spends. At an 80-bit classical forgery target it needs about 2^31.8 signing trials: about a second on one RTX 5090, where ten regtest spends took 0.09 to 2.21 s, and about 72 s on the M3's GPU, where two spends took 75 and 78 s. SegWit PQSB spends have been mined on mainnet at 91 bits (block 978653), 88 bits (block 978,542) and 80 bits (block 978,456). Legacy PQSB is different: its transactions are nonstandard and go to a miner directly. Computation costs are separate from Bitcoin transaction fees.
The README gives script and size figures. Every SegWit PQSB script has 201 operations, and a spend is about 1,060 vB with 9 positions and about 1,076 vB with 8. Every Legacy PQSB script has 198 or 199 operations and 9,987 to 10,000 bytes. Legacy PQSB uses a nonce component and three subset components over one list of secrets. On the RTX 5090 at level 124 it runs 4.34 billion nonce tries a second and about 0.6 billion subset tries. The SegWit table assumes 4.05 billion tries a second on the RTX 5090. The times are expected times at the rates the optimised solvers measured on each machine, and most of the measured spends ran on earlier builds. BENCHMARKS.md separates what was measured from what was estimated.
The repository also ships a "builder" that walks through a spend: pick SegWit or Legacy PQSB, mainnet or regtest, and a security level with its expected signing time on your hardware; then set up the vault's secrets, fund the vault and spend it. It runs as a browser page (tools/pqsb_app.py) or in the terminal (tools/pqsb_cli.py). Each payment needs a new set of secrets, so the builder makes a new vault for each one. You need Python 3.12 or later with no packages, a C compiler for the solver, and Rust for the consensus library that checks every transaction. On Windows the README says to use WSL2 with Ubuntu 24.04 or later. The solver builds for CPU, Metal on Apple silicon, or CUDA where nvcc is found. The README advises trying regtest first with Bitcoin Core installed. New vaults default to 80 bits for SegWit and 124 for Legacy; for SegWit with real value it says to choose 80 bits or more. An explorer scans a user's own Bitcoin Core node from block 978,243 to the tip, finds every PQSB transaction, checks each spend and shows them on a static page. The Lean project builds with lake exe cache get and lake build.
The README is blunt about maturity. It says: this is experimental software, and you should not trust it with coins you cannot afford to lose. Nothing in it has been audited.
Key facts
- The repository holds the Practical Quantum Safe Bitcoin paper, an implementation, benchmark records and a Lean formalization, with two schemes: Legacy PQSB (legacy Bitcoin Script) and SegWit PQSB (SegWit v0).
- Legacy PQSB at a 124-bit classical forgery target needs about 2^28.7 expected signing trials: 0.76 s on average over thirty spends on one RTX 5090, an estimated 24 s on a MacBook M3 GPU, and about 41 s on four x86 cores. A spend at that level was mined in block 978,560.
- SegWit PQSB fits the standard P2WSH relay limits, so any node relays its spends. At 80 bits it needs about 2^31.8 trials, about a second on an RTX 5090 and about 72 s on the M3 GPU. Spends at 91, 88 and 80 bits were mined on mainnet.
- Legacy PQSB transactions are nonstandard and go to a miner directly. Raising its target to about 132 bits needs about 2^35.2 trials: about 9 s on an RTX 5090 and about 12 minutes on the M3 GPU.
- The README calls the software experimental and unaudited. The Lean formalization checks the paper's mathematics, not the scripts.
Why it matters
The repository claims practical signing of quantum safe spends on today's Bitcoin Script, with timings measured on consumer hardware. Legacy PQSB at 124 bits is estimated at about 24 s on a MacBook M3 GPU, and SegWit PQSB at 80 bits at about 72 s on the same GPU. The SegWit variant also fits standard P2WSH relay limits, so any node relays its spends and no direct miner arrangement is needed. Spends of both kinds have been mined on mainnet, which means the scripts have passed real consensus checks, not only a test node. The README also describes a tradeoff: a higher forgery target costs more signing trials, for example about 12 minutes on the M3 GPU at about 132 bits for Legacy PQSB.
Who it affects
The material is aimed at people who can build and run research code: it needs Python 3.12 or later, a C compiler, Rust, and ideally an NVIDIA GPU with CUDA, Apple silicon with Metal, or a multi-core x86 CPU with SHA extensions. It is relevant to anyone studying how to protect Bitcoin spends against quantum forgery, and to those who run Bitcoin Core nodes, since the explorer reads blocks from a user's own node. Legacy PQSB spends need a miner willing to take a nonstandard transaction directly.
How to use it
Clone the repository, go to PQSB/pqai-btc-everything/implementation-app, run solver/build.sh and build the verifier with cargo build --release. Then run python3 tools/pqsb_app.py for the browser builder or python3 tools/pqsb_cli.py for the terminal. The README tells users to try regtest first (BITCOIN_BIN pointing at Bitcoin Core's binaries, then pqsb_cli.py with --regtest) and to lock only a small amount afterwards. Each payment needs fresh secrets, and a lock is spent once: the tools refuse a second, different spend, which would reveal more openings. The file lock.json holds the secrets, is written with mode 600 and should never be committed or sent. Tests run with python3 tests/run.py, and the Lean proofs build in pqsb-lean with lake exe cache get and lake build.
How solid is it
The mainnet spends are the strongest evidence in the README: Legacy at 124 bits in block 978,560, and SegWit at 91, 88 and 80 bits in blocks 978653, 978,542 and 978,456. Timings are a mix of measurement and estimate. The 0.76 s figure is an average over thirty spends on an RTX 5090, but the M3 and x86 figures are estimates at the optimised solvers' measured rates, and most measured spends ran on earlier builds. The forgery figures rest on the authors' own security arguments and on assumptions in docs/security.md. The Lean formalization checks the paper's mathematics, not the scripts, and no proof has been machine-checked for the scripts themselves. The claim that every accepted Legacy PQSB spend selects the disclosed entries is an argument tried by the tests, not a proof. The README says nothing here has been audited. The security levels are classical forgery work only.
Risks and caveats
The README says plainly: experimental software, do not trust it with coins you cannot afford to lose. A mistake in a script, in key generation or in the handling of lock.json can lose the coins for good. Secrets are stored in plaintext in this demo, so it should not be used to secure large sums. Legacy PQSB's list selections have no clamp. Reusing a lock is unsafe by design: a second, different spend would show more openings, which is why the tools refuse it. Legacy spends are nonstandard, so they depend on reaching a miner directly. The SegWit table is only a subset of possible settings, and the README says to choose 80 bits or more for SegWit with real value. Its advice is to run every step on regtest first, then lock a small amount.
“This is experimental software. Do not trust it with coins you cannot afford to lose.”
— Repository README