Code: contracts/BitcoinPostQuantumSecurity.sol (ERC-20),
contracts/PqHtlcSwap.sol (HTLC),. Status: unaudited.
This document describes code that exists and makes no claim about price, listing or
liquidity.
Abstract
The name is the design statement: custody that survives a quantum break of ECDSA, because withdrawal is a hash preimage rather than a signature. It is not a claim that the chain's own signatures are post-quantum; they are not.
BTC-PQS is an ERC-20 token with a fixed supply of 21,000,000 units and no
administrative surface: no mint, no burn, no owner, no pause, no blacklist, no upgrade.
Supply is created once in the constructor and totalSupply never changes.
Two hash-based mechanisms surround the ledger. The PQ Vault locks tokens
against keccak256(secret ‖ to), where secret is 32 bytes generated
offline and to is the only address that can receive the funds. The secret is
absent from the deposit transaction, and the destination is bound into the hash, so copying
the withdrawal calldata cannot redirect the payout. Inside the vault the claim right is a
hash preimage, not a signature.
The HTLC swap locks tokens behind sha256(secret); a P2WSH
output on Bitcoin locks BTC behind the same hash with OP_SHA256. One preimage
settles both legs, with no custodian and no bridge. The protocol is peer-to-peer: it needs a
counterparty, an agreed rate, a communication channel and monitoring of both chains.
The limits are stated as precisely as the mechanisms. A token cannot change the signature scheme of its host chain, so ordinary accounts remain ECDSA and the Bitcoin leg of the swap remains ECDSA-authorized. There is no peg, no reserve, no automatic conversion and no audit.
1. Motivation and Design Goals
EVM accounts and Bitcoin outputs are guarded by ECDSA over secp256k1. The best classical
attack on the elliptic-curve discrete logarithm costs about 2^128 group
operations (Pollard's rho) — infeasible, but by a margin that a fault-tolerant quantum
computer running Shor's algorithm would remove. For a long-lived asset the risk is not that
such a machine exists today; it is that keys and signed transactions recorded today stay
attackable later.
Most tokens advertising "post-quantum" contain no mechanism that can be pointed at. The goal here was a small contract whose security statement can be read from its code and checked by compiling and running it.
- Fixed supply, no issuer. All units exist after deployment; no function creates or destroys them and no address has privileges over another.
- Minimal surface. No proxy, no upgrade, no calls to unknown contracts,
no hooks, no fallback, no
permit. Every state-changing function fits in one file. - Hash-based custody. A holder can move tokens into a state claimed by a hash preimage, with the destination fixed at deposit time.
- Settlement against BTC without an intermediary. Either both legs settle or neither does, with no bridge and no wrapped asset.
- Verifiable claims. Compiler settings, bytecode sizes, gas figures and test results are published and reproducible.
- Stated limits. What the mechanism does not protect is documented as prominently as what it does.
Non-goals: replacing bitcoin, issuing a pegged representation, privacy, yield, or changing the host chain's signature scheme. The last is not a design choice; it is outside the authority of a smart contract.
Immutability is deliberate. No admin key can patch a bug after deployment. That protects against issuer abuse and exposes the code to its own defects; Section 9 treats it as a liability.
2. What This Token Is and Is Not
The symbol BTC is reused, which creates predictable confusion. Wallets index
by contract address, so adding the token produces a second entry named "BTC" with 18
decimals. It is not bitcoin, it is not redeemable for bitcoin, and it is not connected to
Bitcoin Core.
| Claim | Status | Reason |
|---|---|---|
| "Quantum-proof token" | False | The contract cannot change the chain's ECDSA. Protection is confined to the vault and, partly, to the hashlock. |
| "Wrapped or pegged BTC" | False | No bridge, no reserve, no mint-and-redeem, no custody. |
| "Fixed supply" | True | MAX_SUPPLY is constant, minted once; totalSupply cannot change. |
| "No owner, no blacklist" | True | Those functions do not exist in the ABI. |
| "Censorship-resistant" | Partly | The contract cannot censor; validators can. |
| "Audited" | False | No third-party audit has been performed. |
| "Affiliated with Bitcoin Core" | False | No affiliation of any kind. |
| "Swaps 1:1 with BTC" | Policy | The published tooling computes 1:1 minus the fee in tokens; the contracts enforce the amount the seller locks, never a rate. No liquidity, no order book. |
"Post-quantum" here means exactly two things: the vault's claim right is a
keccak256 preimage, and the HTLC's settlement condition is a sha256
preimage. Shor does not apply to either; Grover halves the effective preimage strength,
leaving about 128 bits for a 256-bit hash. Neither statement extends to account keys, to the
OP_CHECKSIG branches of the Bitcoin script, or to the ledger, which is ordinary
ECDSA-authorized state.
2.5 Do not trust us — verify
This document asks you to trust nobody, including the people who wrote it. Every claim is either checkable on-chain in a few minutes or it is marked as unverified. There is no team page, no company, no legal entity, no support desk, and no "foundation" that can intervene.
| Thing that is usually a risk | Status here |
|---|---|
| Owner / admin key | Does not exist. No owner(), no transferOwnership, no Ownable import. |
| Mint after deploy | Does not exist. totalSupply has no writer; MAX_SUPPLY is constant. |
| Burn / pause / blacklist / freeze | Not in the ABI. |
| Proxy / upgrade path | Not a proxy. The bytecode cannot be replaced. |
| Fee switch | feeBps is set once in the constructor, capped at 500 bps, with no setter. |
How the 21,000,000 were created. In the deployment transaction, and only there:
Transfer(from = 0x0000000000000000000000000000000000000000,
to = <recipient>,
value = 21000000000000000000000000)
One event, one transaction: no vesting, no reserve wallet, no second issuance, no "team
allocation" created later. After that transaction the supply is a constant — the only thing
that can change is who holds it, one transfer at a time. Nobody, including the
deployer and the authors, can add a token or take one back.
The honest disclosure. At deployment the entire supply sits at one address. That is public, permanent, and it is the main risk of the distribution: whoever controls that address can sell into whatever market exists, and can do so before you. There is no lock-up and no vesting contract, so do not assume otherwise.
Verify it yourself, in five minutes, without trusting this page:
- Open the contract address on a block explorer, or query your own node.
- Read
name,symbol,decimals,totalSupply,MAX_SUPPLY. Expect21000000000000000000000000and nothing else. - Scan the ABI for
owner,transferOwnership,mint,burn,blacklist,pause,upgradeTo. There are 15 functions; none of those is among them. - Open the deployment transaction: one
Transferfrom0x0to the recipient with the whole supply, and no other token contract in the same transaction. - Hash the deployed bytecode and compare it with the hash published in
build/. If they differ, the deployed contract is not the published one. - Verify the source on the explorer. If the source is not verified, stop — do not interact.
If any of these checks fails, treat every claim in this paper as false.
What you still have to trust: the website you are reading (it can be altered or spoofed — use the contract address, not the site, as the source of truth), the explorer or RPC you query (query two), the wallet software (it signs; a malicious wallet can send your funds elsewhere), and your counterparty in an OTC swap (the HTLC removes custody, not the need to read what you sign).
No promises. No audit has been performed. No liquidity, no listing, no price support, no guaranteed swap. The token may be worth zero.
2.6 Why the old BTC is destroyed and not stored
If the premise of this project is that ECDSA can fail, then a reserve made of old BTC is a lock made of the material that is failing: a quantum attacker able to derive private keys can take the vault, and an operator running the vault can take it earlier and more cheaply. Holding the coins would also break the accounting argument — the same BTC could back two claims.
So a migration retires the coins instead of storing them: the BTC leg ends in an
OP_RETURN output carrying the swap id and the amount, unspendable by consensus
rather than by promise. The token is issued 1:1 from the pre-minted supply. The receipt is
public, permanent and replicated by every node, which is the only form of "backup" that
survives the failure the project is built around.
This is why the token is described as an exit from signature-based custody and never as a wrapper around BTC. A reserve would contradict the thesis; a receipt proves it.
3. Token Specification
| Parameter | Value |
|---|---|
| Name / symbol / decimals | Bitcoin Post Quantum Computer Security / BTC / 18 |
| Maximum supply | 21_000_000 * 10^18 = 21000000000000000000000000 base units |
| Standard | ERC-20, no extensions |
| Compiler | Solidity 0.8.26, optimizer 200 runs, evmVersion: paris |
| Creation / deployed bytecode | 2,871 / 2,469 bytes |
| ABI functions | 15 |
| Deploy gas (local EVM) | 639,068 |
The constructor rejects the zero address and mints the entire supply to
recipient_. There is no vesting, reserve, treasury or later issuance.
uint256 public constant MAX_SUPPLY = 21_000_000 * 10 ** 18;
constructor(address recipient_) {
require(recipient_ != address(0), "BTC-PQS: zero recipient");
_mint(recipient_, MAX_SUPPLY);
}
3.1 State-changing functions
| Function | Effect |
|---|---|
transfer(to, value) | Moves the caller's balance. |
approve(spender, value) | Sets an allowance. |
transferFrom(from, to, value) | Moves balance against an allowance; type(uint256).max is not decremented. |
pqDeposit(commitment, amount) | Moves tokens into the contract, credits vaultBalance[commitment]. |
pqWithdraw(secret, to) | Verifies the preimage, zeroes the commitment, pays to. |
Five functions can alter balances. The other ten ABI entries are constants and views:
name, symbol, decimals, MAX_SUPPLY,
totalSupply, balanceOf, allowance,
vaultBalance, totalVaulted, pqCommitment.
3.2 Absent by construction
There is no mint, so supply is fixed at creation; no burn, so
totalSupply cannot decrease even by the deployer; no owner, role
system, pause or blacklist; no proxy or upgrade hook, so the
deployed bytecode is final; no fallback or receive; no recipient
hooks, so the token cannot call into another contract and no reentrancy path exists through a
callback (ERC-777-style hooks are deliberately absent); and no permit, so
approvals require a transaction and the signature surface stays at zero.
3.3 Invariants
totalSupply == 21_000_000 * 10^18in every block after deployment.Σ balanceOf(a) == totalSupply, including the token contract's own balance.totalVaulted == Σ vaultBalance(c)over all commitments.balanceOf(address(this)) >= totalVaulted: the contract holds at least what it owes.- No address has a privilege another lacks:
transfer(a → b, v)succeeds iffbalanceOf[a] >= vandb != 0.
Solidity 0.8 arithmetic is checked. Two unchecked blocks exist — vault
accounting and the balance update in _transfer — both after a
require that rules out underflow. totalVaulted is decremented by
the amount just read and zeroed in the same call.
4. The Quantum Threat Model
Shor's algorithm solves the hidden-subgroup problem, including the
elliptic-curve discrete logarithm. On a fault-tolerant quantum computer it recovers a
private key from a public key in polynomial time, breaking ECDSA and Schnorr — the account
model of every EVM chain and the signature checks of every Bitcoin script.
Grover's algorithm gives a quadratic speedup for unstructured search,
reducing a 256-bit preimage search to about 2^128 evaluations. It does not break
hash-based commitments; it halves their nominal strength, which remains out of reach.
| Primitive | Classical | Quantum | Used for |
|---|---|---|---|
| ECDSA secp256k1 | ~2^128 (Pollard's rho) | polynomial (Shor, needs a CRQC) | account authorization |
keccak256 preimage | 2^256 | ~2^128 (Grover) | vault commitment |
sha256 preimage | 2^256 | ~2^128 (Grover) | HTLC hashlock |
4.1 What the 2026 literature says
The published numbers describe a machine that does not exist. They answer "what would it take", not "what is available".
- PRX Quantum 7, 031001 (21 August 2026) estimates the secp256k1
discrete logarithm at no more than 1,200 logical qubits and 90 million Toffoli gates, or
alternatively 1,450 logical qubits and 70 million Toffoli gates, executable in minutes on
fewer than 500,000 physical qubits at a physical error rate of
1e-3. It separates fast-clock and slow-clock architectures and analyzes the on-spend attack, where a transaction is attacked in the mempool while its public key is visible. - IonQ (2026) published a full-stack blueprint around roughly 20,000 qubits, an estimated 26 days per attempt, and success probabilities of 40.7% under rigorous assumptions (63.3% heuristic). It is an architecture study, not a hardware demonstration.
- Google Quantum AI (March 2026) estimated fewer than 500,000 physical qubits for the same computation.
No fault-tolerant quantum computer exists as of this writing, and no elliptic-curve key has been recovered by Shor outside small demonstrations. The practical risk today is store-now, attack-later: keys, signatures and ciphertexts recorded now remain attackable if a CRQC arrives. On both chains a public key is revealed when funds move, creating an on-spend window; address reuse widens it.
4.2 Consequence for this design
The vault and hashlock move the trust anchor for one specific claim from ECDSA to a hash preimage. They cannot change how a transaction is authorized. Deposits and withdrawals are signed with ECDSA, and the withdrawal destination is an ordinary account. The defensible statement is narrow: while tokens are in the vault, the right to them is a 256-bit preimage, not a signature. The same qualification applies to the swap, whose hashlock is post-quantum while its Bitcoin signature branches are not.
5. Post-Quantum Vault
A commitment is C = keccak256(secret ‖ to), with a 32-byte secret and a
20-byte address. Both fields are fixed-length, so abi.encodePacked introduces no
concatenation ambiguity: there is exactly one way to split the 52-byte input. The derivation
is a pure function so wallets need not reimplement the encoding.
function pqCommitment(bytes32 secret, address to) public pure returns (bytes32) {
return keccak256(abi.encodePacked(secret, to));
}
function pqDeposit(bytes32 commitment, uint256 amount) external {
require(commitment != bytes32(0), "BTC-PQS: empty commitment");
require(amount > 0, "BTC-PQS: zero amount");
_transfer(msg.sender, address(this), amount);
unchecked {
vaultBalance[commitment] += amount;
totalVaulted += amount;
}
emit PqDeposit(msg.sender, commitment, amount);
}
function pqWithdraw(bytes32 secret, address to) external {
require(to != address(0), "BTC-PQS: zero to");
bytes32 commitment = pqCommitment(secret, to);
uint256 amount = vaultBalance[commitment];
require(amount > 0, "BTC-PQS: nothing to withdraw");
vaultBalance[commitment] = 0;
unchecked { totalVaulted -= amount; }
_transfer(address(this), to, amount);
emit PqWithdraw(commitment, to, amount);
}
5.1 Flow
- The depositor generates 32 bytes from a CSPRNG, offline. This is the only secret.
- The depositor chooses
to, which cannot be changed later. - The depositor computes
Cand callspqDeposit(C, amount). The transaction carriesCand the amount, never the secret. - Anyone holding
(secret, to)callspqWithdraw(secret, to). The contract recomputesC, checks the balance, zeroes it and pays the whole amount toto.
There is no check on msg.sender: authorization is the preimage, not the
caller. A relayer can pay the gas and the funds still go to to.
5.2 Properties and limits
| Property | Mechanism | Limit |
|---|---|---|
| Hash-based claim right | keccak256 preimage | 128-bit under Grover |
| Destination fixed | to hashed into C | Changing it needs a second preimage |
| Secret hidden at deposit | Only C in calldata | The depositor's account activity is still public |
| Safe relay | Payout address fixed by C | The relayer chooses when, not where |
| One-shot withdrawal | Balance zeroed before transfer | Replay yields nothing; a new deposit is a new event |
| No recovery | No owner, no pause | Lost secret or wrong to locks funds forever |
A leaked secret is not a theft. An attacker can only call
pqWithdraw(secret, to), which pays to, so the owner receives the
tokens and loses only control of timing. Theft would require (secret', to') with
keccak256(secret' ‖ to') == C and to' != to: a second preimage on a
256-bit hash. A lost secret is a permanent loss, as is a commitment built
with an address the depositor does not control; there is no recovery and no upgrade.
Deposits accumulate: pqDeposit adds to
vaultBalance[C], so a commitment can be topped up and the withdrawal pays the
total.
Secret handling is strict by necessity: 32 bytes from a secure random source, generated offline where practical, backed up outside the machine that signs the deposit, never reused across commitments. A secret is a bearer instrument over the timing of a withdrawal, not a password, and it cannot be rotated.
6. Atomic Swap with Bitcoin (HTLC)
6.1 Model
There is no bridge and no custodian. Each ledger enforces one half of the trade, and one
32-byte value connects them: H = sha256(S). The EVM side checks
sha256(S) in Solidity; the Bitcoin side checks the same value with
OP_SHA256 inside a P2WSH redeem script. Whoever learns S can settle
the Bitcoin leg; whoever settles the EVM leg must publish S to do it. That
asymmetry is the protocol.
PqHtlcSwap is deployed with the token address as an immutable constructor
argument. It has no owner and no function that moves locked funds anywhere except to the
beneficiary on claim or the initiator on refund.
6.2 Interface
| Function | Caller | Preconditions | Effect |
|---|---|---|---|
lock(hashlock, beneficiary, timelock, amount) | initiator | allowance; timelock ∈ [block.number+100, +1_000_000]; beneficiary not zero or self; amount > 0 | Pulls tokens, stores the swap, emits Locked with a unique id |
claim(id, secret) | beneficiary | LOCKED; sha256(secret) == hashlock | Sets CLAIMED, then pays the beneficiary |
refund(id) | initiator | LOCKED; block.number >= timelock | Sets REFUNDED, then returns the amount |
getSwap(id) / hashOf(secret) | anyone | — | Full record / sha256(abi.encodePacked(secret)) |
Identifiers are derived, not supplied:
id = keccak256(abi.encode(msg.sender, beneficiary, hashlock, amount, timelock, swapCount));
swapCount += 1;
swapCount is monotonic and part of the preimage, so identical swaps cannot
collide and no function resets the counter.
6.3 Protocol
Alice holds tokens and wants bitcoin; Bob holds bitcoin and wants tokens. They agree off-chain on an amount and a rate. The chain enforces amounts, not prices.
| Step | Actor | Chain | Action |
|---|---|---|---|
| 0 | both | off-chain | Agree amount, rate, T_evm, T_btc, payout addresses. Alice generates S, sends H to Bob. |
| 1 | Alice | EVM | approve, then lock(H, Bob, T_evm, amount). Bob verifies the Locked event: token address, amount, beneficiary, hashlock, timelock. |
| 2 | Bob | Bitcoin | Funds a P2WSH HTLC with the same H and T_btc > T_evm. |
| 3 | Bob | EVM | claim(id, S). The tokens move; S is public in calldata. |
| 4 | Alice | Bitcoin | Spends the HTLC with S before T_btc. |
If Bob never claims, Alice calls refund(id) after T_evm. If Bob
never funds the Bitcoin leg, Alice refunds as soon as T_evm passes; her capital
was locked for the timelock duration, which is the cost of quoting first.
The order in step 3 is not cosmetic. Bob reveals S on EVM before Alice
reveals it on Bitcoin, because Alice's Bitcoin claim is what pays her. If Alice claimed
Bitcoin first she would publish S while Bob could still decline to claim,
leaving her with the BTC and Bob with nothing — an ordering no buyer accepts. The prescribed
order gives Bob his tokens first and Alice a bounded window to collect the BTC.
6.4 Bitcoin side
The BTC leg is a native segwit v0 output whose witness program is the SHA-256 of this redeem script:
OP_IF
OP_SHA256 <H> OP_EQUALVERIFY
OP_DUP OP_HASH160 <seller_pkh> OP_EQUALVERIFY OP_CHECKSIG
OP_ELSE
<locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP
OP_DUP OP_HASH160 <buyer_pkh> OP_EQUALVERIFY OP_CHECKSIG
OP_ENDIF
<H> is the 32-byte hashlock, <seller_pkh> is Alice's
public key hash (this branch receives the BTC), <buyer_pkh> is Bob's (the
refund branch). <locktime> is an absolute locktime; values below
500,000,000 are block heights.
- Claim (Alice, the token seller): witness
⟨sig_Alice, S, 1⟩plus the redeem script.OP_IFtakes the first branch,OP_SHA256hashesS,OP_EQUALVERIFYcompares it with<H>,OP_CHECKSIGverifies Alice's key. - Refund (Bob, the token buyer): witness
⟨sig_Bob, 0⟩plus the redeem script.OP_IFtakes the else branch,OP_CHECKLOCKTIMEVERIFYrequires the spending transaction'snLockTimeto be at least<locktime>with a non-final input sequence,OP_DROPremoves the locktime value, andOP_CHECKSIGverifies Bob's key.
The redeem script is committed by its SHA-256 in the witness program and revealed only
when spent. H becomes visible then, which is expected: H is public
by design, S is not.
6.5 Timelock rules
T_evm ∈ [deployBlock + 100, deployBlock + 1_000_000], enforced bylock. At 12-second blocks that is roughly 20 minutes to 4.6 months: a floor against unrefundable swaps and a ceiling against funds parked indefinitely by mistake.T_btc > T_evm, with a margin covering the time Alice needs to seeS, get a Bitcoin transaction confirmed, and survive congestion on both chains. 24 hours is a reasonable operational default, not a protocol constant.- Timelocks must be compared in wall-clock terms.
T_evmis an EVM block number andT_btca Bitcoin height; converting requires the 12-second versus ~10-minute block intervals and their variance. - Both parties should treat timelocks as expiring earlier than nominal during congestion.
6.6 Failure modes
| Failure | Consequence | Recovery |
|---|---|---|
| Bob never funds BTC | Alice's tokens idle until T_evm | refund(id) |
| Bob funds BTC, never claims | Both legs idle | Alice refunds tokens after T_evm; Bob refunds BTC after T_btc |
Bob claims, Alice misses T_btc | Bob refunds BTC and keeps the tokens; Alice loses the trade | Sufficient margin, watchtower, prompt claiming |
| Private-relay claim | S may not reach Alice in time | Require public mempool broadcast, or watch for Claimed |
| Reorg near a boundary | Claim or refund reordered | Margins inside the timelock; wait for confirmations |
| Fee spike | Claim or refund delayed | Adequate fees, fee bumping, margins |
The private-relay case is the sharpest operational risk. If Bob's claim is
mined without entering the public mempool, Alice learns S only when the block is
published, and only if she is watching. The mitigation is procedural: require public
broadcast, or run a watcher that reads the Claimed transaction calldata. The
event alone carries the beneficiary and amount, not the secret.
6.7 Requirements and non-claims
The protocol requires a counterparty (there is no order book, matching engine or pool), a
communication channel for H, amounts, addresses and timelocks, and monitoring of
both chains. Bob must verify the token address, the Locked fields and the
timelock before funding BTC; Alice must verify the Bitcoin output's script, amount and
locktime before claiming. Settlement takes at least one Bitcoin confirmation plus the EVM
claim.
It is not an exchange, provides no liquidity, and does not make the assets fungible. "Atomic" means the legs are bound by one preimage so that a rational party cannot take one without enabling the other. It does not mean instant, and it does not remove counterparty risk; it bounds that risk in time.
7. Security Analysis
| Threat | Vector | Mitigation | Residual limit |
|---|---|---|---|
| Reentrancy via hooks | Callback during transfer | Token makes no external calls; no hooks | None in the token |
| Reentrancy in HTLC | Token re-enters claim/refund | State set before the external call (CEI) | HTLC trusts the token fixed at deploy |
| Integer overflow | Balance arithmetic | 0.8 checked math; unchecked only after bound checks | None known |
| Withdrawal front-run | Copying calldata | to bound into C; a copy pays the same to | Attacker can force timing |
| Claim front-run | Copying claim calldata | msg.sender must be the beneficiary | Copy reverts |
| Unauthorized refund | Third-party refund | Initiator only, after timelock | None |
| Griefing | Anyone locking for anyone; swapCount inflation | Funds move only to recorded parties | Counter and storage dust are permanent |
| Vault preimage attack | Inverting keccak256 | 256-bit preimage | 128-bit under Grover, still infeasible |
| Redirect via second preimage | Finding (secret', to') for C | 256-bit second-preimage resistance | None known |
| Deployer key compromise | Post-deployment privilege | No privileged function exists | Key controls only the recipient balance |
| Symbol collision | Impostor "BTC" contract | Address is identity | User error remains the main risk |
Lost secret / wrong to | Operator error | None | Permanent lock, no recovery |
| Quantum attack on accounts | Shor against ECDSA | Outside token control | Vault protects custody, not the account |
| Quantum attack on BTC leg | Shor against OP_CHECKSIG | Hashlock is post-quantum | Signature branches are not |
ERC-20's approve race — changing a non-zero allowance to another non-zero
value — is present, because the standard is implemented literally and no
increaseAllowance helper was added. Conversely, the absence of fees, rebasing
and callbacks removes a large class of integration bugs.
The HTLC trusts exactly one external contract, the token passed to its constructor, for
transfer and transferFrom semantics. That address is immutable. A
user who deploys the swap against a malicious token gets a malicious swap; the code cannot
detect it.
7.5 Verifying Bitcoin inside an EVM contract
An HTLC connects the two chains for a single trade. A stronger connection is possible without
a federation: an SPV light client. BitcoinSpvLightClient stores Bitcoin headers and
verifies merkle proofs. For each new header it checks the 80-byte structure and the parent link,
the proof of work (double-SHA256 read as a little-endian number must be at or below the target
in nBits), the median time past over the last 11 blocks plus the two-hour drift
rule, the difficulty rule (equal to the parent's, except every 2016 blocks where the real
retarget is applied: timespan clamped to 3.5–56 days, target scaled, capped at the pow limit),
and cumulative work, so the tip is the heaviest chain and a relayer cannot win by sending a
longer but lighter branch.
Tested against live mainnet data: a checkpoint at height 978,839, the child header at 978,840 accepted, a real transaction verified with an 11-hash proof, a forged transaction rejected, a header below its target rejected, a replayed header rejected, an orphan rejected.
It does not validate blocks — transactions, scripts, the UTXO set — and the checkpoint in the constructor is a trust anchor: the chain is trusted from that point forward by work, not by a signature.
7.6 Releasing tokens against a proven Bitcoin payment
PqBtcBridge closes the loop. It holds pre-minted tokens and releases them when
someone proves, with the SPV client, that a Bitcoin transaction paid the bridge's script. The
transaction bytes are parsed in the contract (legacy and segwit, witness stripped); the txid is
recomputed from the stripped serialization, so a modified transaction cannot pass; the merkle
proof is checked against the header; every output paying the bridge script is summed, with a
minimum; and the txid is marked used, so one payment can never be claimed twice.
The rate and the minimum are fixed in the constructor. There is no owner, no pause and no mint: the tokens come out of the contract's own balance, which is the whole supply at the start.
Tested on a real mainnet payment of 6,900,000 sats: the contract released exactly 0.069 tokens, refused a replay, refused a payment proven against an unknown block, and refused a transaction with a single byte modified. The contract does not believe a relayer — it recomputes everything.
8. Limitations and Risks
- No audit. The code is compiled and exercised by a local test suite; it has not been reviewed by an independent firm. Absence of findings is not evidence of absence.
- The chain's signatures are unchanged. Every transfer, approval and withdrawal is ECDSA-authorized. A CRQC breaks accounts regardless of this token; the vault changes the custody primitive, not the account model.
- The Bitcoin leg is not post-quantum. Both HTLC branches end in
OP_CHECKSIG. An adversary able to forge those signatures could take the BTC leg; only the hashlock is hash-based. - No peg, no reserve, no redemption. Nothing backs the token and no entity will exchange it. Its only route to BTC is a peer-to-peer HTLC with a willing counterparty.
- No liquidity. The protocol creates no price, pool or market maker. A holder who wants BTC must find a counterparty and agree a rate.
- Symbol collision. "BTC" is bitcoin's ticker. Wallets show two assets with the same symbol; verification by contract address is mandatory.
- Irreversible operator errors. A lost secret, a commitment built with
the wrong
to, or a deposit nobody can open locks funds forever. There is no recovery and no upgrade. - Immutability cuts both ways. A defect found after deployment cannot be patched, the supply cannot be reissued, and the contract cannot be migrated.
- Timing control. Whoever learns a secret can settle at a moment of their choosing, to the correct destination. That is a griefing surface, not a theft surface.
- No privacy. Deposits, commitments, amounts, swaps and claims are public. The secret is hidden until withdrawal; the activity graph is not.
- Host-chain risk. Congestion, reorgs, validator censorship and fee spikes affect every operation, and block-measured timelocks inherit block-time variance.
- Undefined legal status. Nothing here is a security, a share, a claim on an issuer, or investment advice.
8.1 Quantum exposure by location
The Bitcoin literature classifies exposure by address type: P2PK, bare multisig and Taproot have long exposure, because the public key is visible while unspent, while P2PKH, P2SH, P2WPKH and P2WSH have short exposure, because the key appears when the owner spends. Hash functions and the supply cap are not meaningfully threatened. Glassnode's November 2026 estimate puts 7.12M BTC, 35.4% of supply, behind visible keys. The same classification maps onto this project:
| Location | Exposure | Reason |
|---|---|---|
| Plain EVM account | Long | The public key is recoverable from any signature that account has ever produced; every active account behaves like a reused address. |
| PQ Vault | Protected at rest | Withdrawal needs a keccak256 preimage, not a signature. |
| HTLC, token side | Protected while locked | Preimage or timelock, enforced by contract state. |
| Sale contract | Protected | No private key exists for a contract address. |
| Bitcoin leg (P2WSH) | Short | The script contains hash160 of the keys; the keys appear in the witness of the claim or refund. |
| Withdrawal destination | Short after arrival | Receiving reveals nothing; the next signature from that address reveals the key. |
Practical rules: use a fresh to address for every deposit, keep long-term
holdings inside a commitment rather than in an account, and treat a swap as settlement
rather than storage.
9. Roadmap
Engineering work, not commitments about markets.
- Independent review. Commission an audit of the token, vault and HTLC, and publish the report as prominently as this document. Until then the code is labeled unaudited everywhere.
- Deployment and source verification. Deploy with the exact settings in Section 3 and verify the source so anyone can compare the bytecode.
- Swap tooling. A CLI and watchtower that build the P2WSH script, verify
the
Lockedevent, monitor both chains and claim with correct margins. The protocol works but is currently manual. - Wallet support for commitments. A flow that generates the secret offline, derives the commitment, stores the backup and builds the withdrawal. Secret handling is the main usability risk.
- Operational checklist. A step-by-step swap procedure with pre-flight verification of amounts, addresses and timelocks.
No item promises a listing, a market, a price or a conversion facility.
Appendix A: API Reference
| Token function | Mutability | Description |
|---|---|---|
name / symbol / decimals | view | Metadata |
MAX_SUPPLY / totalSupply | view | Constant 21_000_000 * 10^18 |
balanceOf / allowance | view | Balances and allowances |
vaultBalance / totalVaulted | view | Vault accounting |
pqCommitment(secret, to) | pure | keccak256(abi.encodePacked(secret, to)) |
transfer / approve / transferFrom | nonpayable | Standard ERC-20 |
pqDeposit(commitment, amount) | nonpayable | Locks tokens against a commitment |
pqWithdraw(secret, to) | nonpayable | Pays the commitment balance to to |
Events: Transfer,
Approval, PqDeposit(address indexed from, bytes32 indexed commitment,
uint256 amount), PqWithdraw(bytes32 indexed commitment, address indexed to,
uint256 amount).
| HTLC function | Mutability | Description |
|---|---|---|
token() | view | Immutable token address |
MIN_DELAY() / MAX_DELAY() | view | 100 / 1_000_000 blocks |
swapCount() | view | Monotonic counter used in ids |
hashOf(secret) | pure | sha256(abi.encodePacked(secret)) |
lock(hashlock, beneficiary, timelock, amount) | nonpayable | Pulls tokens, opens a swap, returns id |
claim(id, secret) | nonpayable | Beneficiary claims with the preimage |
refund(id) | nonpayable | Initiator refunds after the timelock |
getSwap(id) | view | Full swap record |
State: NONE = 0,
LOCKED = 1, CLAIMED = 2, REFUNDED = 3. Events:
Locked, Claimed, Refunded.
Appendix B: Verification Evidence
Compilation with optimizer 200 and evmVersion: paris:
COMPILE OK BitcoinPostQuantumSecurity bytecode 2871 b deployed 2469 b fns 15
COMPILE OK PqHtlcSwap bytecode 5553 b deployed 4815 b fns 16
solc 0.8.26+commit.8a97fa7a.Emscripten.clang | 3 contracts written to build/
scripts/test.js runs against an in-process Ganache EVM (chain id 1337). Every
state-changing call supplies an explicit gas limit of 900,000, because Ganache's
eth_estimateGas evaluates nested calls against a stale state and misreports some
reverts; with an explicit limit the transactions execute normally and revert on-chain.
== token deployed 0x17e9...2352 | gas 639068 ==
htlc 0x1BB3...3bB7 | gas 1124805
ALL TESTS PASSED (0 failures)
The suite executes 52 assertion-level checks, all passing:
| Group | Checks | Examples |
|---|---|---|
| Metadata, immutable supply | 11 | metadata values, totalSupply = 21M, no mint/burn/owner/blacklist/fallback, exact mutator set |
| ERC-20 behavior | 7 | transfer, approve/transferFrom, allowance decrement, reverts on over-transfer and zero address |
| PQ Vault | 11 | credit, totalVaulted, contract holds tokens, wrong secret and destination revert, relay pays to, replay reverts |
| HTLC | 23 | hash equals sha256, timelock bounds, claim by non-beneficiary reverts, refund before timelock reverts, double claim and double refund revert, contract empty at the end |
Gas on the local EVM: token deployment 639,068 (including minting the whole
supply), HTLC deployment 844,710. Per-call gas is measured in the run but not
asserted as a constant. These are local figures, not a prediction of mainnet cost.
References
- PRX Quantum 7, 031001 (21 August 2026). Resource estimates for the secp256k1 elliptic-curve discrete logarithm with Shor's algorithm, including the fast-clock/slow-clock distinction and the on-spend attack on transactions in the mempool.
- IonQ (2026). Full-stack quantum computing blueprint: an architecture study around 20,000 qubits, an estimated 26 days per attempt, success probabilities of 40.7% (rigorous) and 63.3% (heuristic). A design study, not a hardware demonstration.
- Google Quantum AI (March 2026). Resource estimates for elliptic-curve key recovery, below 500,000 physical qubits.
- Source artifacts:
contracts/BitcoinPostQuantumSecurity.sol,contracts/PqHtlcSwap.sol,scripts/compile.js,scripts/test.js,build/*.json.
This document describes software. It is not investment advice, not an offer of any asset, and not a security audit. Verify the contract address before interacting with any token that uses this symbol.
Back to overview · Romanian version:
whitepaper.ro.html · Markdown source:
docs/WHITEPAPER_EN.md