How Leafzero works
How a wallet signature becomes a post-quantum identity, how a creator signs a coin, and how anyone can verify its origin. The cryptography lives in src/lib/pq and src/lib/vault.
#Overview
Each user holds a post-quantum identity: an XMSS-style Merkle tree over 256 Winternitz one-time signature (WOTS) keys, deterministically derived from a Solana wallet signature. The tree root is the public key; a hash of the root is the user's pq1… address.
A WOTS launch reserves a leaf before signing a digest of the mint, creator, name, ticker and image. Other signature schemes use keys certified by the same identity. The signature travels with the metadata so a verifier can independently check the creator's claim.
#Threat model
We assume an adversary who can eventually forge ed25519 signatures, either via a cryptographically relevant quantum computer (Shor's algorithm) or via an unexpected classical advance against elliptic-curve discrete log. On Solana this is total: an account address is its ed25519 public key, so unlike a never-spent Bitcoin address there is no hash shield.
| Asset | Pre-break | Post-break |
|---|---|---|
| SOL / tokens in ed25519 accounts | safe | exposed (needs on-chain PQ vault) |
| Coin provenance (who launched it) | wallet signature | WOTS attestation + anchor |
| Login / account ownership | wallet signature | WOTS challenge-response |
| PQ identity (hardened) | safe | safe, given passphrase entropy |
| PQ identity (wallet-only) | safe | re-derivable by the attacker |
#Primitives
Every hash in the protocol is SHA-256 with n = 32 bytes. Security reduces to second-preimage resistance of SHA-256; Grover's algorithm lowers this to roughly 2128 quantum work, which remains out of reach.
Tweakable hash
Following SPHINCS+, each call is domain-separated by a public seed and a 32-byte address ADRSthat pins it to exactly one position in the structure. This prevents multi-target attacks: an adversary cannot amortise a preimage search across many chains or users.
#WOTS one-time signatures
Winternitz parameter w = 16 trades signature size against hashing: each 4-bit digit of the message selects a position on a hash chain of length 15.
| Symbol | Value | Meaning |
|---|---|---|
| n | 32 | hash output, bytes |
| w | 16 | chain length + 1 |
| len₁ | 64 | ⌈8n / log₂ w⌉ message digits |
| len₂ | 3 | ⌊log₂(len₁(w−1)) / log₂ w⌋ + 1 checksum digits |
| len | 67 | chains per key |
Message encoding
The 32-byte digest is split into 64 nibbles d₀…d₆₃. A checksum over the "remaining distance" of every chain is appended as three more base-16 digits:
The checksum is what makes the scheme unforgeable: to change a message digit upward (which needs only extra hashing from a public σᵢ), a forger necessarily lowers C, and inverting a checksum chain requires a SHA-256 preimage.
Sign & verify
σᵢ = Fdᵢ(skᵢ) · verify: F15−dᵢ(σᵢ) ≟ pkᵢ
Signing costs Σdᵢ hashes, verification Σ(15−dᵢ); together exactly 67 × 15 = 1,005. Because σ reveals intermediate chain values, a key that signs two different messages leaks enough to forge a third. Leaf reuse is therefore refused at the database level (see leaf ledger).
#Merkle identities
The 67 chain ends of leaf i compress to one node, and 256 such leaves form a binary tree of height 8. The root, together with pk.seed, is the identity's 64-byte public key.
nh,j = SHA-256(pk.seed ‖ ADRS(2, h, j) ‖ nh−1,2j ‖ nh−1,2j+1)
A full signature is (leaf, σ, a₀…a₇): 4 + 67·32 + 8·32 = 2,404 bytes. Verification recomputes the leaf from σ and climbs 8 levels; it is valid iff the result equals the registered root.
#Key derivation
No new seed phrase. The wallet signs a fixed message; RFC 8032 ed25519 signatures are deterministic, so the same wallet always produces the same 64 bytes. An optional passphrase is stretched with scrypt and mixed in, contributing entropy the curve never sees.
Leafzero@https://leafzeroq.xyz — Post-Quantum Identity Derivation v2 Signing this message derives your hash-based (WOTS/XMSS) keys locally in your browser. It is not a transaction and costs nothing. Never sign this exact message on any other site. Wallet: 7xKX…AsU Domain: Leafzero@https://leafzeroq.xyz Version: 2
New identities sign the Leafzero derivation prompt bound to this site's origin. Existing identities use their recorded prompt version so returning users derive the same keys. Secrets stay in memory while the tab is unlocked.
#Registration
Registration binds the wallet and the root in both directions. One statement is signed twice: by the wallet (ed25519) and by leaf 0 (WOTS). The server verifies both before storing the public key; leaf 0 is burned as the genesis signature.
Leafzero@https://leafzeroq.xyz — Register Post-Quantum Identity Wallet: 7xKX…AsU PQ address: pq1Hn3…W8k Root: 3f9a1c…e07b Public seed: b41d02…9c55 Tree height: 8 Scheme: WOTS(w=16,SHA-256)+Merkle
#On-chain anchor
A registration in our database is only as trustworthy as our database. The anchor writes the root to Solana in an SPL Memo signed by the wallet, producing a public timestamp from the era when ed25519 signatures were still unforgeable. After a break, any claim about who owns a root can be checked against the earliest anchor.
Leafzero@https://leafzeroq.xyz:v2:anchor:pq1Hn3…W8k:3f9a1c…e07b
#Launch attestation
Leaf i signs a domain-separated digest over the coin's public fields, sorted by key. The same leaf deterministically owns the mint keypair, so the mint address itself is a commitment to the identity.
The server builds a versioned transaction for token creation and any initial purchase. An address lookup table can reduce its size when configured. The browser signs the prepared message. Before relaying it, the server compares the signed message with the bytes it prepared.
Metadata extension
The metadata stores the primary signature and the public identity fields. The example abbreviates the signature and authentication path. A verifier can compare the reconstructed root with the creator's independent anchor.
{
"name": "…", "symbol": "…", "image": "ipfs://…",
"website": "https://leafzeroq.xyz/coin/<mint>",
"pqc": {
"version": 1,
"schemeId": "wots",
"scheme": "WOTS(w=16,SHA-256)+Merkle(h=8)",
"pqAddress": "pq1…", "root": "…", "pubSeed": "…", "height": 8,
"messageHash": "…",
"signature": { "leaf": 4, "wots": "<4288 hex>", "auth": ["…", "…", "…", "…", "…", "…", "…", "…"] }
}
}Creator fees
pump.fun fixes a coin's fee recipient at mint time via the creator field of create_v2. Every Leafzero coin sets it to the platform treasury; the launching wallet is the signer and fee payer, and is recorded as the creator in the attestation.
#Signature schemes
Creators choose how a launch is signed. WOTS + Merkle is the identity's root of trust and burns one leaf per launch. The three NIST schemes are many-time keys derived from the same identity seed; each is certified once by a WOTS leaf signing a binding digest, after which it signs any number of launches.
| Scheme | Standard | Assumption | Signature | Public key |
|---|---|---|---|---|
| WOTS + Merkle | RFC 8391 style | SHA-256 second preimage | 2,404 B | 64 B |
| ML-DSA-65 (Dilithium) | FIPS 204 | Module-LWE / SIS lattices | 3,309 B | 1,952 B |
| SLH-DSA-SHA2-128s (SPHINCS+) | FIPS 205 | SHA-256 (stateless) | 7,856 B | 32 B |
| Falcon-512 (FN-DSA) | FIPS 206 draft | NTRU lattices | ≤ 666 B | 897 B |
| ML-DSA-87 (Dilithium5) | FIPS 204, level 5 | Module-LWE / SIS lattices | 4,627 B | 2,592 B |
| SLH-DSA-SHAKE-128f (SPHINCS+) | FIPS 205 | SHA-3 / SHAKE256 (stateless) | 17,088 B | 32 B |
| Falcon-1024 (FN-DSA) | FIPS 206 draft, level 5 | NTRU lattices | ≤ 1,280 B | 1,793 B |
| ed25519 + ML-DSA-65 (hybrid) | IETF composite draft | either curve or lattice must hold | 3,373 B | 1,984 B |
certs = WOTS.sign(H("bind" ‖ pq-address ‖ s ‖ H(pks)), leaf)
d = H("launch" ‖ creator ‖ image ‖ mint ‖ name ‖ scheme ‖ symbol)
The hybrid is a composite signature: a single seed expands (SHAKE256) into an ed25519 key and an ML-DSA-65 key, and a signature is both signatures concatenated. It verifies only if both verify, so it is secure as long as either assumption survives. SLH-DSA-SHAKE swaps the SHA-2 family for SHA-3, so the two SPHINCS+ options rest on different hash designs.
A scheme attestation carries its signature, the scheme public key and the WOTS certificate, so verification needs only the identity root: check the certificate against the root, then the signature against the certified key. The digest commits to the scheme id, so a signature can never be replayed under a different scheme. Implementations are@noble/post-quantum, audited and dependency-free.
#Proof of possession
A challenge-response login that never consults ed25519. The server issues a 32-byte nonce valid for five minutes; the client signs proofDigest({ leaf, nonce, wallet }) with its next unused leaf.
| Check | Failure |
|---|---|
| challenge exists, matches wallet, unused, unexpired | 404 / 409 / 410 |
| XMSS.verify(digest, σ, registered root) | verified: false |
| INSERT (identity, leaf) into leaf ledger | 409 leaf already used |
A successful proof consumes the challenge and commits the matching leaf reservation in one database transaction. An invalid signature returns a failed verification, and the challenge expires after five minutes.
#Wallets
A Leafzero wallet is an ed25519 keypair derived from the identity seed (deriveVaultKeypair(skSeed, index)), re-derived in the browser after unlock and never stored. Registration is a statement signed by the derived key itself, so the server only ever holds public addresses.
Every transfer is dual-signed: the derived key signs the Solana transaction (what the chain enforces), and a post-quantum key signs a transfer digest whose hash rides along in an SPL memo. Rotating a wallet sweeps everything to a freshly derived address and retires the old one.
Be clear about the boundary. Solana still enforces only the ed25519 signature on-chain. The post-quantum half is a quantum-proof record of authorization: after a curve break it lets an owner prove which transfers they signed and which were forged, but it does not stop a forged transfer from executing. Holding value under hash-based keys needs an on-chain verifier program: that is the quantum vault below, and the reason these wallets are labelled identity-derived rather than quantum-secured.
#Quantum vault
The vault is a Solana program that holds SOL, SPL and Token-2022 balances at a PDA which only a WOTS signature verified on-chain can spend. There is no ed25519 path: the wallet that pays the fees cannot move vault funds, and neither can anyone else who breaks a curve.
A withdrawal signs one digest with vault[i]'s one-time key. It binds the program, vault, recipient, mint, amount and the hash of vault[i+1], so the signature authorizes that exact spend and nothing else:
The 2,176-byte payload is staged in a buffer account over three transactions, then the withdraw instruction walks the 67 hash chains (45 to 990 SHA-256 calls), checks that the result derives the vault's address, pays the recipient, rolls everything else into vault[i+1] and turns vault[i] into a permanent tombstone. Deposits that arrive at a retired address afterwards can be forwarded by anyone, only ever to the next vault the tombstone names.
One key, one message. Two WOTS signatures from one key leak enough to forge a third. Before anything is broadcast, the browser records the spend, keyed by an HMAC only the identity owner can compute, and every retry or second device replays that record. Signing is deterministic, so a replay produces the identical signature. The vault index itself lives on-chain: it is the first vault that is not a tombstone.
The remaining dependency is how the identity is derived. A wallet-only identity is re-derivable by whoever holds the wallet key, so a post-quantum attacker who recovers that key could also derive the vault keys. A passphrase-hardened identity closes that gap.
#Post-quantum pools
Pools are built on the vault program; there is no separate pool contract. A position is a chain of vaults owned by a pool identity, derived from your identity under its own domain, so pool funds never mix with your personal vault and every withdrawal is the same on-chain WOTS spend described above.
The pool accepts SOL and USDC, plus the platform token when configured. The first deposit registers the position by its first vault's key hash; the server derives the address from that hash, so every registered position is a real WOTS-locked vault. To find where a position lives now, anyone can follow its tombstones, since each retired vault names the next one.
Yield is the pools' 20% of platform revenue, paid in SOL into each position's live vault on a fixed schedule, pro-rata by USD value. A position's weight is the smaller of its value now and its value at the previous payout, so a deposit starts earning from the payout after it lands. Payouts are plain transfers from a public rewards wallet, and the pools page totals them from the chain.
What this protects. Withdrawing needs a valid WOTS signature over the exact recipient, mint, amount and next vault. A forged or stolen ed25519 signature can't produce one. The remaining dependency is the same as the vault's: a wallet-only identity is re-derivable from the wallet key, and a passphrase-hardened identity closes that gap.
#Quantum holder rewards
A coin can launch with quantum holder rewards: half of its creator fees go to the people who hold it in a quantum vault. The coin's on-chain creator is still the treasury, like every launch; the mode is recorded with the launch, and the payouts are made from a public rewards wallet.
Fees per coin are read from pump.fun's own trade events. Every bonding-curve trade reports its creatorFee and every PumpSwap trade its coinCreatorFee, so the amount a coin has earned is the sum over its trades, in its quote token. The holders' share is half of that, converted to SOL at payout time.
Who earns: vault chains that hold the coin. A vault registers itself by its first key hash; the server derives the address from the hash, so only real WOTS-locked vaults count, and follows tombstones to the live vault. Rewards are paid in SOL into that vault, so only a hash-based signature can move them. Taking the smaller of the current and previous holding means a deposit starts earning from the payout after it lands. Each payout carries a memo naming the coin, so anyone can total what a coin's holders have received from the chain.
#Encrypted launches
An encrypted launch is sealed for a minute before the coin exists. The creator's browser encrypts the coin's details (mint address, name, ticker, description, image) with AES-256-GCM under a fresh random key and publishes only the ciphertext and its SHA-256. The home page shows the sealed launch counting down; nobody, the server included, can see what the coin is.
When the countdown ends, the creator signs the launch and the key goes with it. Before anything is pinned or any leaf is burned, the server decrypts the ciphertext with that key and checks every field against the coin being launched; one difference and the launch is refused. The ciphertext, key and commitment are stored with the coin, so its page can decrypt them in your browser and show they open to exactly that coin.
Cypherpunk-class cryptography. Authenticated encryption plus a hash commitment is the commit-then-encrypt pattern that Zcash's shielded notes are built on: a note is committed on-chain and its contents encrypted, readable only with the key. Encrypted coins trade against $CYPH (Cypherpunk Technologies' tokenized stock, via Backpack Securities), SOL or $ZEC (Zcash); the pair is part of what gets sealed.
Why AES-256. Symmetric encryption only loses half its key length to Grover's quantum search, so a 256-bit key keeps about 128 bits of security against a quantum computer, the same post-quantum margin as SHA-256. The coin itself is public once it launches, like every coin on Solana: the seal hides what's coming, not what's live.
#Four-signature launches
In a four-signature launch, four algorithms sign the coin's provenance. Two use hash-based signatures and two use lattice-based signatures. The coin page checks each one.
Each of the three additional keys signs the coin's scheme-specific launch digest with a key certified by the creator's WOTS root, the same chain as a single-scheme launch. The server checks all four, and every certificate, when preparing the launch. The metadata records the hashes of the additional signatures. The launch record stores their full bytes for verification in your browser.
The dev buy goes into the creator's quantum vault, as in a Quantum launch. Certifying the three extra keys uses one WOTS leaf per certificate.
#Security analysis
- Forgery
- Reduces to SHA-256 second-preimage resistance under the tweakable-hash model; ~2¹²⁸ quantum work.
- Key reuse
- The client reserves a leaf for one digest before signing. Retries use that reservation. Each identity and leaf index can appear only once in the ledger.
- Wallet compromise
- Wallet-only identities are re-derivable by anyone holding the wallet key, including a post-break attacker. Hardened identities additionally require the passphrase.
- Server compromise
- Creator signing keys remain in the browser. A server can misrepresent registrations or imported listings. Check the original creator’s root against its on-chain anchor.
- Capacity
- 256 one-time leaves per identity, including registration, key certification and proof operations.
#Parameters
| Item | Value |
|---|---|
| Hash | SHA-256 |
| WOTS | w = 16, 67 chains, 2,144 B |
| Tree | height 8, 256 leaves |
| Signature | 2,404 B |
| Public key | root ‖ pk.seed, 64 B |
| Address | pq1 ‖ base58(SHA-256(dom ‖ pk.seed ‖ root)[0..20]) |
| Passphrase KDF | scrypt N = 2¹⁵, r = 8, p = 1 |
| Seed KDF | HKDF-SHA256 |
| Mint derivation | deriveMintKeypair(skSeed, leaf), using HKDF-SHA256 |
#Verify it yourself
To check the primary signature independently, take the mint and signing wallet from the creation transaction, the creator's public key from a trusted registration, and the metadata URI from the mint. Use the verifier configured for the same signing origin.
import { verifyLaunch, type IdentityKey } from "@/lib/pq/verify-launch";
export async function verifyMetadata(
metadataUri: string, mint: string, creator: string, identity: IdentityKey,
) {
const response = await fetch(metadataUri);
if (!response.ok) throw new Error("Metadata lookup failed");
const { name, symbol, image, pqc } = await response.json();
if (pqc.pqAddress !== identity.pq_address) {
throw new Error("Unexpected creator identity");
}
return verifyLaunch({
mint, creator, name, symbol, image_url: image,
scheme: pqc.schemeId, attestation: pqc.signature,
leaf_index: pqc.signature.leaf ?? null,
}, identity);
}