Overview
What Lean Key is, what it guarantees, and what state it is in.
Lean Key is a non-custodial vault program for Solana. A vault holds SOL and SPL / Token-2022 tokens, and nothing leaves it unless the same transaction carries two independent signatures:
- Ed25519: the vault's owner signs the transaction, as with any Solana account. This is your usual wallet (Phantom, Solflare, Backpack, a Ledger) or a hot account inside the Lean Key extension.
- WOTS+: a one-time Winternitz hash signature over an exact intent: the action, the asset, the amount, the destination and the hash of the next one-time key. Only the holder of the vault's post-quantum seed can make it.
Each one-time key signs exactly one intent. After every successful withdrawal the vault rotates to the next key: key_index goes up by one and the stored key hash becomes the one the intent named. An old signature is then worthless.
The program is written in Lean 4 and compiled to sBPF v3 with lean-svm. Its properties are stated and proven in Lean; Trust boundaries says exactly which parts that covers and which it does not.
Why two keys
| Attacker has | Result |
|---|---|
| Your wallet's Ed25519 key only (a drainer, a leaked key, or a quantum computer that recovered it) | Cannot move anything and cannot lock the vault. Every instruction that moves funds also needs a valid WOTS+ signature for the vault's current one-time key. |
| Your 24-word post-quantum seed only | Cannot move anything. Every instruction needs the owner's Ed25519 signature. |
| A WOTS+ signature seen in flight | Can only get the same intent executed: the same amount to the same destination, and the key rotates as you intended. |
| Both keys | Everything. Two keys only help if they live in different places. |
The Ed25519 half is classical cryptography. The WOTS+ half relies only on SHA-256, so it does not depend on elliptic-curve assumptions. The full analysis is in Threat model.
What the program does
There are five instructions and no others: InitVault, WithdrawSol, WithdrawToken, CloseTokenAccount and CloseVault. There is no admin account, no configuration account and no instruction that changes a vault's owner. A deposit is an ordinary SOL transfer to the vault's address, or a token transfer to the vault's associated token account; no Lean Key instruction is involved.
| Instruction | Signatures | Effect |
|---|---|---|
InitVault | owner (Ed25519) | Creates the vault at its program-derived address, with key index 0 and the hash of the first one-time key. |
WithdrawSol | owner + WOTS+ | Moves the intent's amount of lamports to the intent's destination. The vault keeps its rent-exempt minimum. Rotates the key. |
WithdrawToken | owner + WOTS+ | TransferChecked from the vault's token account to the destination token account. SPL Token and Token-2022; Token-2022 mints with a transfer hook are refused. Rotates the key. |
CloseTokenAccount | owner + WOTS+ | Closes an empty token account of the vault, its rent to the destination. Rotates the key. |
CloseVault | owner + WOTS+ | Sends everything above the rent-exempt minimum to the destination and marks the vault closed. The account stays as a tombstone. Rotates the key. |
Details: Instructions, Program accounts, Intent format, Errors.
The pieces
| Piece | What it is |
|---|---|
| Program | Lean 4 source compiled by lean-svm. The release build twokey.so is 14,688 bytes, sha256 4e174b5a9bdd90ca5092b8db8bb4b0b158b722902a75d863ffc47ae684e69b1d (program/release/program.json). |
| Proofs | 51 theorems checked by Lean's kernel, 21 of them headline properties, none resting on axioms beyond propext, Classical.choice and Quot.sound (program/release/proofs.json). See /proofs. |
packages/core | TypeScript library: WOTS+, intent encoding, instruction builders, decoding, seed encryption, the safe send order. Tested byte for byte against vectors exported from the Lean specification. |
CLI leankey | A Bun command-line tool for keygen, opening, depositing, sending, closing, verifying and running a local validator. See CLI reference and /cli. |
| Extension | A Wallet Standard wallet for Chrome, Brave, Arc, Opera, Edge, Firefox and Safari (Xcode project) that keeps the post-quantum seed and signs intents. See Extension guide and /extension. |
Measured cost
A withdrawal verifies a hash-based signature on chain, so it is expensive in compute units and cheap in everything else. Measured on a local solana-test-validator 4.4.2 (scripts/localnet/e2e-report.json, 26 of 26 checks passed):
| Instruction | Compute units |
|---|---|
InitVault | 4,461 |
WithdrawSol | 526,950 to 607,530 (3 runs) |
WithdrawToken (SPL Token) | 488,065 to 528,355 (3 runs) |
WithdrawToken (Token-2022) | 506,072 to 570,504 (2 runs) |
CloseTokenAccount | 487,921 |
CloseVault | 567,239 |
The cost depends on the intent: the verifier computes between 510 and 6,375 hashes, depending on the intent's checksum (theorem verifySteps_bounds). More measurements, including the worst case, are in WOTS+ parameters.
Status
- Unaudited beta. No third party has reviewed the program, the compiler it is built with, or the clients.
- Devnet: for testing, the program is also deployed at
TwoKhewkScEnH75rbs9nC5ScrsFQT93DrHsSSZvpVHn.leankey verifyshows the deployed bytes are the release build, and that this deployment has an upgrade authority, so it is not immutable. See Trust boundaries. - Mainnet: deployed on 2026-12-03 at
KeyW6VkKqn3awBMcun9aLPKJuCP77BFM7KE66CyzCjE, the same release build, with the same upgrade authority. The clients carry a recommended limit of 10 SOL per vault for mainnet (DEFAULT_MAINNET_LIMIT_SOL); the CLI refuses a SOL deposit on mainnet that would take a vault past it unless you pass--yes. - Open Key Challenge: a devnet vault whose owner's Ed25519 secret key is published on purpose. Its post-quantum seed is not published. See /challenge.
Where to go next
- Try it in five minutes on a local validator: Quickstart.
- Understand intents and key rotation: Concepts.
- Before putting value in a vault: Recovery and safety and Trust boundaries.
- Check a deployment yourself: /verify.