Building a Post-Quantum Vault on Solana Today
Solana addresses are Ed25519 public keys, exposed from the moment the address exists. That is fine until a cryptographically relevant quantum computer exists, at which point Shor's algorithm turns a public key into a private key. No such machine exists today — but funds sitting still for years in a known address are the textbook target: the key is already public.
Cold storage is where this matters first, and where the fix is cheap: cold funds move rarely, so they can afford a signature scheme that is large, slow, and single-use — exactly what hash-based signatures are.
So I built a vault program whose withdrawals are authorized by WOTS+ one-time signatures (RFC 8391, SHA-256) instead of Ed25519. Only 32-byte hash commitments live on-chain, and there is no Ed25519 path to the funds — not for withdrawal, not for rotation, not for recovery.
Why hash-based, and why WOTS+
Hash-based signatures rest on the preimage resistance of a hash function. Grover's algorithm only halves a hash's effective strength, so SHA-256 keeps roughly 128 bits of post-quantum preimage resistance. No lattice assumption, no elliptic curve.
The parameters are the RFC 8391 set: n = 32, w = 16, len = 67 — 64 chains for the message digest's four-bit digits, plus 3 checksum chains. A signature is one 32-byte value per chain: 2,144 bytes. The public key is the 67 chain ends hashed into a single 32-byte commitment, which is all the vault stores. The private side is a 32-byte seed — never on-chain — from which every chain secret is PRF-derived.
Why not the standardized alternatives? SLH-DSA is stateless, which solves a problem I don't have — an on-chain program is a state machine, so state is free and rollback-proof — and charges a 7,856-byte signature for it. ML-DSA-44's 2,420-byte signature is still over the 1,232-byte transaction limit, and verifying it on-chain means hand-rolling the full ML-DSA verifier. Falcon would fit, but FIPS 206 is still a draft and its sampling is notoriously easy to implement insecurely. WOTS+ needs only the sol_sha256 syscall. (Not the first Winternitz vault on Solana, either — one shipped in January 2025 and proved the shape works; mine differs in construction, not in spirit.)
One-time discipline is a program rule, not a usage guideline
A WOTS+ signature reveals intermediate points on 67 hash chains. That is safe exactly once: sign twice with the same key and an attacker can interpolate between the revealed points and forge. Stateful schemes live or die on never reusing a key — NIST SP 800-208 approves XMSS and LMS only when state cannot roll back. So the vault doesn't ask the signer to be careful; it enforces the rule in the one place that cannot roll back: the account data, written in the same transaction that spends.
- Each vault holds up to 16 commitments — a deliberate v1 cap.
- Keys are spent strictly in order. The vault stores
next_key_index, and a withdrawal naming any other index fails. No skipping, no reordering, no reuse. -
ExecuteWithdrawalincrementsnext_key_indexbefore any token moves, so a spent key can never be replayed. - No instruction decrements, resets, or edits the index or a commitment. Rotation replaces the whole set atomically, authorized by a one-time signature from the next unconsumed key over a rotation digest with its own domain separator. There is deliberately no Ed25519-authorized rotation: an Ed25519 path to new keys is an Ed25519 path to the funds.
- Spend the last key without chaining a rotation first, and the balance freezes permanently — fail-closed, because the alternative is a recovery path, and a recovery path is a second authorization path, and a second authorization path is the vulnerability.
The signature also authorizes exactly one withdrawal: it signs a digest binding the domain separator, vault, key index, destination, exact amount, and mint.
Delivering a 2,144-byte signature in 1,232-byte transactions
The signature can't ride in a single transaction, so it travels the way large programs deploy: through a buffer account. CreateSigBuffer creates a PDA bound at creation to the vault, the key index, and the digest of the one withdrawal it serves. WriteSigChunk appends the signature in chunks of at most 1,000 bytes, strictly in order. At execution, the program re-derives the digest from the actual withdrawal parameters and requires equality with the buffer's binding, a complete 2,144-byte buffer, and a signature verifying against the stored commitment. Anyone can create a buffer (they pay its rent, returned when it closes); only the owner can abort one, so a squatted buffer can always be swept away.
What verification actually costs
This is where my estimate died. Verification completes each of the 67 chains, and the step count is data-dependent — the sum of (15 − digit), about 500 steps on average and at most 1,005. My pre-build estimate of 50k–120k CU priced roughly one hash per step. The catch: each step runs the hash three times — derive the step key, derive the bitmask, hash — so a typical verification is around 1,500 sol_sha256 calls.
Measured against the real SBF build in program-test:
-
ExecuteWithdrawal: 337,261 to 394,451 CU across repeated runs -
RotateKeys: 380,328 and 393,103 CU
The extrapolated worst case — every digit zero, all 1,005 steps — is roughly 700k CU: uncomfortable, but inside the 1,400,000 transaction maximum, so no valid signature is unexecutable. The practical consequence: verification blows through the 200,000 CU default budget, so every withdrawal and rotation transaction must carry a compute-budget instruction requesting more (the test suite requests 1,000,000). Without it, the transaction fails on budget before verification completes.
One optimization was measured and rejected: a single-buffer hash cost 402,454 CU against 340,266 for the three-slice form — the syscall iterates slices without copying, so the buffer pays for its copies.
Tested like it custodies money
The suite is 17 tests — 4 unit tests on the WOTS+ primitive, 13 integration tests in program-test against the real SPL token program — green natively and against the SBF build. The adversarial cases are the point:
- A replayed signature is rejected; the index is already consumed and no funds move.
- Forged signatures are rejected — wrong seed, and a single corrupted chain value.
- A second, different valid signature from a consumed key is worthless on-chain.
- Digest binding: amount X+1 fails, a different destination fails, the exact parameters succeed — all against the same uploaded signature.
- A signature for key 1 fails while
next_key_indexis 0; a forged buffer with a mismatched header is rejected as an invalid PDA. - Rotation signed by the owner's Ed25519 key alone buys nothing, and with all keys spent, the remaining balance never moves.
The honest limits
This vault does not make my chain quantum-resistant. Consensus, vote accounts, the bridge, ordinary wallets, and every other program still use Ed25519 — only funds inside this vault get hash-based withdrawal authorization. The fee payer is still an Ed25519 key; it authorizes nothing (stealing it lets an attacker pay fees, not move funds). Sixteen keys per vault is small; the documented path past it is the XMSS construction, a Merkle root over many WOTS+ keys instead of a flat list. A production deployment would also have to ship with the program's upgrade authority revoked or held to the same standard as the funds.
Most importantly: this is a prototype — localnet only, not deployed, not audited. It is future-proofing, not an emergency fix; the only hard clock is policy (NIST IR 8547 deprecates quantum-vulnerable signatures after 2030, disallows them after 2035). The code, the design note, and the full verification record — including the measurements that replaced my estimates — are all in the repo.




