Tari L1 Quantum Findings
What a quantum attacker could do to Tari L1, what the current code lets us do about it today, and what still needs consensus changes. Every claim is labelled with how well it is supported.
Summary
Theft of funds can largely be prevented for people who prepare, using tools that already exist. Inflation cannot be prevented once discrete log is cheap. It can only be limited and undone, and that needs consensus changes. The findings that shape the plan:
Covenants are disabled on mainnet Verified
max_covenant_length is 0 in the base constants for mainnet, nextnet, stagenet and Esmeralda, and the code treats 0 as disabled. Only localnet and Igor allow covenants. A destination-pinning vault therefore needs a constants change at an activation height. No new code is needed, because covenants are already enforced in body validation and the mempool.
Payments to a published address are fully exposed Verified by reading
For one-sided and stealth outputs, the commitment mask comes from a Diffie-Hellman shared secret, and a derived script key is Blake2b(mask) + root spend key. The sender-offset key is on chain and addresses publish the view and spend public keys. A quantum attacker who knows an address could derive everything needed to spend, with no earlier exposure. No end-to-end exploit was run.
A 35-byte hash-lock holds even if every key is forged Verified
The script HashSha3 PushHash(H) EqualVerify was run inside a real transaction input with genuine signatures. The right preimage verifies. A wrong or missing preimage is rejected by the script alone, with all keys and signatures valid.
Wallet keys come from one Blake2b step Verified
Spend and view keys are Blake2b-512 over (seed entropy, branch, account index). Argon2 only encrypts the stored seed file and is not in the key path. Entropy is 16 bytes. That makes a hash-only proof of seed knowledge feasible in principle.
Inflation is not solved by any of this Design
An attacker who can compute discrete logs can satisfy every balance equation and open any commitment to any value. A vault does not touch that. Containment needs a public-amount pool, a capped turnstile, rate-limited exits and chokepoint freezes. See the inflation section.
The P-384 / P-521 stopgap is slow and not quantum-safe Measured
Even with OpenSSL and the best build flags, verification was about 10 times slower than Ristretto, and keys and signatures grew 53% (P-384) or 109% (P-521). Shor's algorithm breaks these curves just as it breaks Ristretto.
Threat model
A quantum attacker running Shor's algorithm breaks discrete log. Hash functions only lose about half their strength to Grover's algorithm, so 256-bit hashes stay usable. Four kinds of harm need different defences.
| Harm | What breaks | Can it be prevented? |
|---|---|---|
| Theft | Schnorr signatures (kernel, script, metadata) and key pairs | Mostly, for people who move funds into vaults beforehand |
| Inflation | Pedersen binding, Bulletproofs+ soundness, kernel balance | No. Only limit and undo |
| Retroactive privacy loss | Diffie-Hellman keys used to encrypt amounts, masks and memos in recorded outputs | No, for data already on chain |
| Network compromise | X25519 in the Noise_XX_25519_ChaChaPoly_BLAKE2b peer handshake | Partly, with a hybrid post-quantum handshake |
Proof of work is not threatened by Shor and Grover gives only a small speedup. Merge mining depends on Monero's own migration. These two points are expectations, not tested here.
What is exposed on chain
Every output carries its commitment, script, sender-offset public key, covenant, encrypted data, metadata signature and range proof. Every input carries input data and a script signature. Verified
| Output kind | What a quantum attacker gets | Status |
|---|---|---|
Non-stealth, PushPubKey(spend key) | The script key is on chain permanently. Easiest target. | Verified |
| One-sided / stealth to a published address | Shared secret from the on-chain sender-offset key plus the address view key gives the mask and encryption key. The address spend key gives the script key. | Verified by reading |
Stealth with Nop script | Believed to reveal the script key only at spend time, but exposed anyway when the recipient address is known. | Unverified |
| Encrypted amounts, masks, memos | Recorded chain data can be decrypted later when the encryption key comes from a Diffie-Hellman secret. | Verified by reading |
| Block headers | Commit to the output set, kernel set, sizes, offsets and proof of work, so a block hash is a complete checkpoint. | Verified |
Consequences for the plan
- The vault campaign should target
PushPubKeyoutputs and payments to reused or published addresses first. - Address reuse guidance becomes a headline item.
- Checkpoints need no new data structure.
Hash-lock vault
The existing opcodes HashSha3, PushHash and EqualVerify express a spend condition that depends only on a hash. Consensus runs the script, so an attacker who forges every key and signature still needs the preimage.
HashSha3 PushHash(H) EqualVerify // 35 bytes, 3 opcodes
// limits: 512 B on mainnet, 128 opcodes
| Test | Result | Status |
|---|---|---|
| Script alone: right, wrong and missing preimage infrastructure/tari_script/tests/quantum_vault.rs | Right passes and leaves the script key on the stack. Wrong and missing are rejected. | Verified |
| Real transaction input with genuine script signature transaction_components/quantum_vault_test.rs | Right preimage verifies and returns the script key. Wrong or missing is rejected with all keys valid. | Verified |
| Covenant pinning the destination covenants/covenant.rs, vault_covenant_pins_destination | A spend without the pinned output fails. With it, one match. Extra outputs beside it are allowed. A look-alike output is rejected. | Verified |
| Full block body, script offset, balance, live network | Not run. | Unverified |
What it does and does not do
- The secret becomes public when the spend is broadcast. Without a covenant, a fast attacker could copy it into a replacement transaction. A covenant that pins the destination output limits the copy to completing the owner's own move.
- Covenants are evaluated over the whole aggregate body, and each output can satisfy the covenant of at most one input. The rule is "at least one matching output", so extra outputs are allowed. Theft is then blocked only because the balance equation must hold. A forger who can break commitments is not stopped. That is the inflation problem.
- Pinning fixes the amount and fee at lock time. It suits cold storage and planned moves, not flexible payments.
- Scripts are fixed when an output is created, so existing unmoved outputs cannot be retrofitted.
- TariScript cannot verify a post-quantum signature because a script cannot see the transaction. Its context holds only the block height, the previous block hash and the output's own commitment.
Vault v1 is the hash-lock alone and works on mainnet today. Vault v2 adds the covenant pin and needs covenants enabled.
P-384 and P-521 as a stopgap
Moving to a larger NIST curve was suggested in the community thread as a simple interim step. A micro-benchmark outside the Tari code compared Schnorr signing, verification and Pedersen commitment on Ristretto (curve25519-dalek) against P-384 and P-521, in pure Rust and with OpenSSL 3.5. Measured
Schnorr verification, lower is better. Bars share one linear scale.
| Backend | Sign | Verify | Commit | Public key | Signature | Est. BP+ proof |
|---|---|---|---|---|---|---|
| Ristretto (dalek) | 23 µs | 31 µs | 33 µs | 32 B | 64 B | 576 B |
| P-384 RustCrypto | 407 µs | 728 µs | 649 µs | 49 B | 97 B | 879 B |
| P-384 OpenSSL | 169 µs | 391 µs | 388 µs | 49 B | 97 B | 879 B |
| P-521 RustCrypto | 568 µs | 924 µs | 983 µs | 67 B | 133 B | 1203 B |
| P-521 OpenSSL | 137 µs | 323 µs | 336 µs | 67 B | 133 B | 1203 B |
Reading the numbers
- Best realistic case is about 10 times slower to verify than Ristretto. Sizes grow 53% (P-384) or 109% (P-521).
- OpenSSL helps most for P-521, which has a dedicated 64-bit implementation. It is a C dependency, so it would work for the node but not for the WASM builds.
- The Bulletproofs+ column is a size formula (15 points plus 3 scalars for one 64-bit proof), not a measurement. No Bulletproofs+ implementation exists for these curves, so a port would be needed.
- Verification and commitment in the OpenSSL runs use two separate multiplications. A combined multi-scalar multiplication would save roughly a quarter. Batch verification would help more.
- The second Pedersen generator in the benchmark has a known discrete log, so commitment timings are valid but the commitments are not secure.
- Machine: AMD Ryzen 5 7500F, release build, fat LTO, native CPU flags.
Conclusion. The stopgap raises the cost of a classical or AI-assisted attack on the curve. It gives no quantum resistance. Its cost is high and it needs a Bulletproofs+ port, so it is worth doing only if the classical threat is judged near.
Inflation
Once discrete log is cheap, an attacker can forge signatures, open any commitment to any value, forge range proofs, and satisfy the kernel balance equation with arbitrary excess points. They can mint outputs of any size. Pedersen hiding is unaffected, so the chain looks normal. Supply cannot be audited from hidden amounts. Design
The defences have to move the audit somewhere discrete log cannot reach.
1. Public-amount pool
Outputs with public amounts authorised by hash-based proofs. Supply there is a plain sum. Costs privacy until a private post-quantum pool exists. The RevealedValue range-proof type is a format building block but still relies on Pedersen balance, so it is not safe by itself.
2. Capped turnstile
After an activation height, legacy outputs can leave only by a claim into the public pool. Total claims are capped using the public emission schedule (supply_at_block). Only outputs in the checkpoint block are eligible.
3. Rate-limited exits
Claims reveal amounts, so exit volume per window can be capped, for example 1% of the cap per day. This buys time to detect and roll back.
4. Chokepoint freezes
Inflated coins only hurt if they can be sold. Exchanges and the L1 to L2 bridge accept only public-pool value after the flag and can pause earlier.
The hard parts
The amount-lie problem Design
After binding breaks, a claimant can open a genuine pre-attack commitment to a larger value. Nothing on chain authenticates the original amount. Encrypted data is not authoritative either, because a sender could have written any value into it and consensus does not check it against the commitment.
Mitigations: move funds into the public pool before Q-day while binding still holds (exact, and the main defence); scale claims pro rata if unattested claims exceed the remaining cap; delay and add evidence requirements for large claims.
Lost coins give slack Design
The emission schedule counts coins that are lost forever. Inflated claims can hide inside that share, so the bound on inflation is the lost-coin fraction, not zero.
Quiet inflation before detection Design
Coins minted before anyone notices can sit inside the checkpoint. Canaries, dormancy monitoring and a conservative checkpoint help, at the cost of rolling back honest transactions.
Consensus changes involved
| Change | Where in the code | Risk |
|---|---|---|
| Enable covenants | consensus constants, mainnet | Low: already enforced and tested |
| Public-amount output type and balance rule | output type, range proof type, body validator | Medium |
| Turnstile claim and legacy-spend ban | body validator, mempool | High |
| Claim proof verifier | new consensus-critical component | High, research |
| Cap and rate-limit state | chain state | High |
| Emergency rule | constants, validators | High, governance |
Everything consensus-critical needs a testnet period and an external audit before an activation height is set.
Claims without elliptic curves
A claim has to prove ownership without any signature on the legacy curve, since the attacker can forge it. Design built on verified key derivation.
- A quantum attacker can already compute every curve private key from the public keys. So the claim can simply reveal the output's private key, and the verifier checks
d·G = Pnatively and cheaply. - A zero-knowledge proof then only has to show that the revealed scalars were derived from entropy the claimant knows. That is a few Blake2b evaluations, with no curve arithmetic inside the proof.
- The proof's public inputs include a hash of the destination output, so a claim cannot be redirected or front-run.
- Cost: revealing keys exposes that wallet's outputs to everyone. A wallet should claim all its outputs together.
Unverified Proof size and verification cost. Hardware (Ledger) wallets derive keys on the device by a different scheme and need their own path. With 16-byte entropy, Grover leaves about 264 security, which is fine now but worth tracking.
Plan
Two tracks. Track A is the contingency if quantum arrives first and uses only what the protocol can do. Track B is the real migration to post-quantum cryptography.
Track A, contingency
| Workstream | Content |
|---|---|
| Analysis | Exposure map, key derivation, covenant behaviour, harvest-now-decrypt-later survey. Mostly done, see above. |
| Vaults | Hash-lock script, optional covenant pin, wallet flow (derive the secret from the seed, move to vault, reveal at spend), end-to-end tests. |
| Detection | Canary outputs with destroyed keys and a public bounty, dormancy monitor, agreed hardware-progress milestones. |
| Response | Alert levels, checkpoint tooling using the header roots, recovery fork prepared and dormant, governance rule agreed in advance. |
| Recovery | Claims through the seed-knowledge proof, vault preimages as fallback. |
| Ecosystem | Exchange runbook, L2 bridge circuit breaker, pre-written communications. |
Alert levels
| Level | Trigger | Actions |
|---|---|---|
| 1 Watch | Published hardware milestones | Monitoring up, public guidance |
| 2 Alert | Credible evidence of a capable attacker | Vault campaign, exchanges and bridge notified, bridge claims paused |
| 3 Emergency | Confirmed forgery | Halt spends, choose checkpoint |
| 4 Recovery | Community ratified | Fork activates, claims open |
Track B, migration
- Replace every discrete-log primitive: Pedersen commitments, Schnorr signatures, offsets, key pairs, range proofs.
- Candidates are hash-based or lattice signatures, plus lattice commitments and range proofs. Range proofs are the hard part, since no Bulletproofs+ equivalent exists.
- Measure size, speed and bandwidth for each candidate before choosing.
- Add a hybrid post-quantum handshake for peer connections, which can ship independently of consensus.
- Hard fork with a deadline for old outputs, a testnet period and an external audit.
Order of work
- Weeks 0 to 4: finish the open checks and post a governance proposal.
- Months 1 to 3: vault wallet flow and end-to-end tests, canaries and monitoring, exchange contacts.
- Months 3 to 9: checkpoint tooling, dormant fork code, bridge breaker, claim-proof prototype, hybrid handshake work.
- Ongoing: rehearsals on a testnet and handoff to Track B.
Open items
| Item | Status |
|---|---|
| Vault through a full block body (script offset, balance, kernel) and on a live network | Unverified |
| Whether later mainnet heights change the covenant setting (only part of that block was read) | Unverified |
Whether stealth Nop-script outputs hide the script key until spend | Unverified |
| Which encrypted data are keyed by a Diffie-Hellman secret versus a private derivation | Partly traced |
| Hardware wallet key derivation and claim path | Unverified |
| Proof size and cost of the seed-knowledge proof | Unverified |
| L2 (Ootle) review and the L1 to L2 bridge behaviour under inflation | Not reviewed |
| Post-quantum hybrid handshake options for peer connections | Not surveyed |
| Hardware timeline assumption: early quantum machines are too slow to win a block-time race | Assumption |
Decisions needed from the community
- Who may declare an emergency, and by what voting rule?
- Is a public-amount pool acceptable, given its privacy cost, until a private post-quantum pool exists?
- Which amount-lie mitigation: early migration plus pro-rata scaling, or something else?
- Claim window length and exit rate limit.
- Priority rule under the rate limit: age, size or lottery.
- What happens to coins nobody claims?
- Who attests and ratifies a checkpoint, and is a rollback acceptable?
- Should covenants be enabled on mainnet now, as a low-risk prerequisite?
- Who funds and runs the canaries, monitoring and rehearsals?