# PQB: Post-Quantum Bitcoin
Lock bitcoin in a quantum-resistant output on mainnet **today**, with no soft fork.
| Cost | ~$3 for renting GPUs (8 RTX 4090-hours) |
| Security | NIST Level 1: 128 bits classical (64 bits under Grover's algorithm) |
| Script size | 4,696 bytes |
| Signature scheme | Hybrid: a hash-based one-time signature and a normal ECDSA signature |
**How it works:** the locking script is a table of hashed one-time secrets. To spend, you reveal some of them, and three GPU-solved hash puzzles tie that reveal to your exact transaction. To redirect the spending transaction, an attacker has to solve all three again at once, without knowledge of the unrevealed secrets.
Builds on Robin Linus's Binohash and StarkWare's QSB. Details in the [whitepaper](whitepaper/PQB.pdf).
> [!WARNING]
> This is **unaudited research code**. See [SECURITY.md](SECURITY.md).
## Quickstart: lock and spend bitcoin
You need Python 3.9+ and a wallet with some bitcoin. You don't need a GPU: spending rents some, typically for 10-30 minutes.
```console
$ git clone https://github.com/fireblocks-labs/pqb && cd pqb
$ python3 -m venv .venv && . .venv/bin/activate && pip install -U pip && pip install -e ./pqb
$ pqb new --testnet # first run also creates ~/.pqb/seed
$ pqb deposit # address + QR, waits for the payment, moves it into the vault
$ pqb watch --follow # until the vault is mined
$ pqb spend --to ADDRESS # rents GPUs, signs, broadcasts
```
For mainnet, drop `--testnet`.
**Back up `~/.pqb/seed`.** It is one line of hex and it recovers every vault (`pqb restore`).
`deposit` shows an address and a QR code. Send it **one** payment of at least 40,000 sats.
To fund it from your own wallet in one transaction instead (a PSBT), see
[INTEGRATIONS.md](pqb/docs/INTEGRATIONS.md).
`spend` rents GPUs on [vast.ai](https://vast.ai) to solve the vault's hash puzzles, for about
$3 expected and at most `--max-usd` (default 20). You need a vast.ai API key and an SSH key on
your account; `pqb cloud check` says what is missing. A vault is spent **once**, so check the
address. If `spend` stops part way, run it again: it continues where it was. On mainnet, `spend`
checks the transaction with the included Bitcoin Core script checker before anything is published
([GETTING-STARTED.md](pqb/docs/GETTING-STARTED.md#0-what-you-need)).
On an Apple-silicon Mac, `pqb spend --local --to ADDRESS` grinds on the Mac's own GPU instead:
nothing rented, about 8 days on an M1 Pro
([OUTSOURCING.md](pqb/docs/OUTSOURCING.md#on-an-apple-silicon-mac)).
More: [GETTING-STARTED.md](pqb/docs/GETTING-STARTED.md) (step by step),
[pqb/README.md](pqb/README.md) (every command),
[INTEGRATIONS.md](pqb/docs/INTEGRATIONS.md) (wallets, PSBTs, deposit addresses).
## Explorer
**** is a public demo of [`explorer/`](explorer/README.md):
it finds PQB and QSB locking scripts and spending transactions on mainnet and testnet4, labels every byte of a
locking script, and re-executes a spending transaction in an in-browser Script interpreter.
## On mainnet
A PQB vault on Bitcoin mainnet:
| | txid | |
|---|---|---|
| **Locking transaction** | [`7bad128d…c0d66788`](https://pqbexplorer.com/tx/7bad128d9968b6256977061ea896b838fd2564a51d1dd6ecc9c95bc4c0d66788) | Block 975,813: a 4,696-byte bare script, 17,730 sats |
| **Spending transaction** | [`0b2b0ea1…b1611757`](https://pqbexplorer.com/tx/0b2b0ea10d58adf4e35e6010ad345d53ff0c40b75ef0c9b5d6082223b1611757) | Block 975,838: 1,508 vB |
Vault: [`pqb1qjnl38f5saqt7wed0mn54ww0d9qqkdwfycg5am3j5m7xe33kvvnlqnle3rn`](https://pqbexplorer.com/address/pqb1qjnl38f5saqt7wed0mn54ww0d9qqkdwfycg5am3j5m7xe33kvvnlqnle3rn)
## What is here
| directory | what |
|---|---|
| [`pqb/`](pqb/README.md) | **pqb**, the Python CLI and library: build, fund, grind, spend and check PQB vaults; its tests and long-form docs |
| [`js/`](js/README.md) | **@pqb/core**, the TypeScript library, byte-identical to the Python |
| [`grinder/`](grinder/README.md) | the CUDA grinder that `pqb cloud grind` builds on rented NVIDIA GPUs |
| [`explorer/`](explorer/README.md) | **PQB Explorer**, a block explorer for post-quantum Bitcoin transactions, and its Cloudflare Worker |
| [`whitepaper/`](whitepaper/README.md) | the PQB whitepaper: [PQB.pdf](whitepaper/PQB.pdf) and its LaTeX source |
## How to cite
```bibtex
@techreport{yomtov2026pqb,
author = {Oren Yomtov},
title = {{PQB}: Post-Quantum {B}itcoin Outputs under Today's Consensus Rules},
institution = {Fireblocks},
year = {2026},
month = nov,
type = {Whitepaper},
url = {https://github.com/fireblocks-labs/pqb/blob/main/whitepaper/PQB.pdf},
note = {Research code}
}
```
## Contributing and security
See [CONTRIBUTING.md](CONTRIBUTING.md), which also has the commands to run the test suites.
Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md), not in a public
issue.
## License
MIT, see [LICENSE](LICENSE). Copyright (c) 2026 Fireblocks Ltd. Third-party components (notably
Bitcoin Core's Python test framework, vendored verbatim under its own MIT notice) are listed in
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).