This repository holds the paper Practical Quantum Safe Bitcoin, its implementation and benchmark records, and a Lean formalization of its mathematical results. The paper builds two instances of practical quantum safe Bitcoin (PQSB): Legacy PQSB (PQSB-legacy in the paper), which depends on legacy Bitcoin Script, and SegWit PQSB (PQSB-segwit), which supports SegWit v0. They give three improvements:.

In a recent development, the level tables below give each setting's figures, and BENCHMARKS.md what was measured and what is estimated. Computation costs are separate from Bitcoin transaction fees.

The builder walks through a spend in either mode: pick SegWit or Legacy PQSB, mainnet or regtest, and a security level with its expected time to sign on your hardware; then set up the vault's secrets, fund the vault, and spend it. Each payment requires a upcoming set of secrets, so the builder makes a new vault for each and keeps a list of them. It comes as a page in your browser and as the same steps in the terminal, and both run the commands of pqai-btc-everything/implementation-app/ on your own machine.

It has been revealed that you need Python 3.12 or later (no packages), a C compiler for the solver, and Rust for the consensus library that checks every transaction. On Windows, run everything in WSL2 (Ubuntu 24.04 or later): the build script and the tools expect Linux or macOS. On Ubuntu (or WSL2), sudo apt install git build-essential gives git and the C compiler, and rustup installs Rust. Build once, then run everything below from implementation-app:.

With an NVIDIA GPU, solver/build.sh also builds the GPU solver, search, once nvcc (the CUDA compiler) is on the PATH, and the tools then use it instead of the CPU. On Linux, install NVIDIA's CUDA toolkit. On Windows, the NVIDIA driver you have already serves WSL2: install only the toolkit inside WSL2, from NVIDIA's WSL-Ubuntu repository (sudo apt install cuda-toolkit after adding it), and never a Linux driver. Then put /usr/local/cuda/bin on the PATH and run solver/build.sh again. nvidia-smi reveals the GPU and the newest CUDA version its driver takes; the toolkit must not be newer.

In a recent development, try it on regtest first. With Bitcoin Core installed, choose Regtest on the page, give it the folder that holds bitcoind, and start the regtest node: its wallet of play coins pays the vault and mines the transactions for you. In the terminal:.

Latest vaults start at 80 bits for SegWit and 124 for Legacy, and any level of the tables can be chosen; for SegWit with real value choose 80 bits or more. docs/pqsb-app.md describes both in full.

Recent findings suggest that the explorer finds every PQSB transaction on Bitcoin mainnet in the blocks of your own Bitcoin Core node, checks each spend (the script model, Bitcoin Core's consensus library, the relay limits, T's lengths, the pins), and shows them on a static page that reads only a JSON index. The node's RPC stays on localhost; the page never talks to it.

docs/explorer.md covers the node's setup, running the scanner as a service, and publishing the page.

This is experimental software. Do not trust it with coins you cannot afford to lose.

Run every step on regtest first, then lock a small amount.

A level is the classical forgery work, in bits: a forger who holds the openings of one spend succeeds with chance at most 2^-level a try. The signer's tries are the expected tries to find a spend. The times are expected times at the rates the optimised solvers of implementation-app/ measured on each machine; BENCHMARKS.md gives the measured spends, most of which ran on the builds before.

It has been revealed that segWit PQSB: the P2WSH lock with pins (docs/pins.md). The spend is standard: any node relays it.

Recent findings suggest that the table is a subset of the possible settings: a search over 7 to 10 positions, 1 to 6 pins and up to 127 commitments finds many layouts within P2WSH's limits, and these are some of those that need the fewest tries for their level. Levels 87 and 95 use 8 positions and 6 pins: about a bit below 88 and 96, for a quarter of the tries.

Sources indicate that every script has 201 operations. A spend is about 1,060 vB with 9 positions and about 1,076 vB with 8. The columns take 4.05 billion tries a second on the RTX 5090 (over 2^35 tries at level 80, on the lock without pins), 51.2 million on the M3's GPU (2^30 tries at level 72; two spends of the lock with pins at level 80 measured 51.6 million) and 42.1 million on four cores of an Intel Xeon with the SHA extensions and AVX-512 (level 64): docs/opt-cuda.md, docs/bench-macbook-metal.md and docs/opt-cpu.md in implementation-app/. The first SegWit PQSB, the P2WSH lock without pins (docs/p2wsh.md), is no longer built.

Legacy PQSB: the legacy lock with four components (docs/legacy.md). A nonce component and three subset components over one list of secrets, each with its own vector of committed scalars. Both transactions are nonstandard and go to a miner directly.

Every script has 198 or 199 operations and 9,987 to 10,000 bytes. Each column uses the component rates the optimised build measured at level 124: on the RTX 5090 4.34 billion nonce tries a second and about 0.6 billion subset tries, on the M3's GPU 53.3 million and about 12 million, on the x86 cores 33.4 million and about 7 million.

The builder above runs these same commands for you. The commands below run in pqai-btc-everything/implementation-app/, after the build above:.

The spend commands run Bitcoin Core's consensus library on every spend before they write it, when verifier/ is built. Build it.

It has been revealed that on regtest first. With Bitcoin Core's bitcoind in BITCOIN_BIN, a demo builds a lock, funds it, finds the spend, checks it and mines it on a private regtest node:.

To lock real coins, follow "How to spend" in the implementation README.

Secrets and one use. lock.json holds the secrets. It is written with mode 600; never commit it or send it. A lock is spent once. The tools refuse a second, different spend, which would show more openings.

pqsb-lean/README.md maps each result of the paper to its Lean theorem.

πŸ“Œ Read also:

β†’ Read original article