Quickstart
Open a vault, deposit, and withdraw with two signatures, on a local validator or on mainnet.
This page takes you from nothing to a withdrawal signed by both keys. The first path runs entirely on your machine with the CLI and a local validator. The second uses the browser extension on mainnet.
Every output block below is what the CLI really printed on a local validator (recorded for the site in apps/web/data/release/cli-examples.json). Addresses will differ on your machine; compute units depend on the intent and will differ slightly too.
Path 1: CLI on a local validator
What you need
- The
leankeyCLI. Prebuilt single-file binaries for macOS arm64, macOS x64 and Linux x64 are on /cli with their sizes and sha256. From a source checkout you can runbun apps/cli/src/main.tsinstead. solana-test-validatorfrom Agave 4.x or newer, on yourPATHor in the directory named byLEANKEY_SOLANA_BIN. lean-svm emits sBPF v3, which older validators refuse to load;leankey localnetchecks the version and tells you if yours is too old.
1. Start a validator with the program loaded
leankey localnet --detach --reset
localnet ready http://127.0.0.1:8899 (solana-test-validator)
program TwoKWxqD6kL6ow9bAEZ3Kir9hUFKbocX4LZR4j5R3W6 (release build, upgradeable, authority G1ojQpFdRoKKojBijmUd3ioVgJSEcR4JvNxAqEbp4ao8)
wallet 5wykdpPiTveo3J9dGL8FXjUG7er5x6bQeURHUy21Ysfo 100 SOL ~/.leankey/localnet/wallet.json
leankey keygen --out pq.seed
leankey open --owner ~/.leankey/localnet/wallet.json --pq pq.seed --network localnet
leankey deposit <VAULT> 2 --from ~/.leankey/localnet/wallet.json --network localnet
leankey send <VAULT> <TO> 0.5 --owner ~/.leankey/localnet/wallet.json --pq pq.seed --network localnet
leankey verify TwoKWxqD6kL6ow9bAEZ3Kir9hUFKbocX4LZR4j5R3W6 --network localnet
running in the background (pid 69691); stop it with: leankey localnet --stop
The validator loads the release build that is embedded in the CLI, creates a wallet in ~/.leankey/localnet/wallet.json and airdrops 100 SOL to it. That wallet is the Ed25519 owner in this walkthrough.
The CLI's default network is mainnet. For the rest of this path either add --network localnet to every command or set it once:
export LEANKEY_NETWORK=localnet
2. Make a post-quantum seed
leankey keygen --out ~/.leankey/localnet/pq.seed
wrote ~/.leankey/localnet/pq.seed (scrypt N=32768, AES-256-GCM, mode 600)
Your post-quantum seed (write these 24 words on paper; they are the only backup)
(the 24 words are printed here; write them on paper)
Anyone with these words and your wallet key can withdraw. Nobody with only one of them can.
You are asked for a password twice (8 characters or more). The file holds the seed encrypted; the 24 words are printed once and are not stored anywhere. Scripts can set LEANKEY_PASSWORD instead of typing it. See Key derivation and backup.
3. Open a vault
leankey open --owner ~/.leankey/localnet/wallet.json --pq ~/.leankey/localnet/pq.seed
opened CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M (slot 2, vault #0, key #0, 4,461 CU)
The vault's address is derived from the owner and the vault number (["vault", owner, vault_id]), and it starts at one-time key #0, whose hash comes from your seed.
4. Deposit
leankey deposit CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M 2.5 --from ~/.leankey/localnet/wallet.json
deposited 2.5 SOL (slot 5, vault balance 2.50152424 SOL)
A deposit is a plain transfer. Anyone can send to a vault; the extra 0.00152424 SOL is the vault account's rent-exempt minimum on this validator, which always stays in the vault.
5. Withdraw with both keys
leankey send CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M 6z3aeTKfDhs7x5seKn5vDM2FS28SrVDsFf7cGV9DbcGs 1.0 \
--owner ~/.leankey/localnet/wallet.json --pq ~/.leankey/localnet/pq.seed
sent 1 SOL to 6z3aeTKfDhs7x5seKn5vDM2FS28SrVDsFf7cGV9DbcGs (slot 7, key #0 → #1, 526,950 CU)
Before key #0 is used, the CLI simulates the withdrawal with a placeholder signature and requires the program to stop exactly at the signature check. Only then does it sign, record the intent in its journal (pq.seed.journal.json), simulate again with the real signature, and send. See Concepts.
6. Look at the vault
leankey status CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M --pq ~/.leankey/localnet/pq.seed
vault CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M (localnet)
owner 5wykdpPiTveo3J9dGL8FXjUG7er5x6bQeURHUy21Ysfo
id #0
key #1 pk_hash f8ba3d0a07dade55…
state open
balance 1.50152424 SOL (1.5 SOL withdrawable; 0.00152424 SOL rent-exempt minimum)
history
7 sent 1 SOL → 6z3a… key #0→#1, 526,950 CU
5 deposit 2.5 SOL, 150 CU
2 opened, 4,461 CU
7. See the wallet key alone fail
Use a different seed with the right wallet. The check before signing passes (it only proves every other check succeeds), the real signature is then refused by the program:
leankey keygen --out ~/.leankey/localnet/other.seed
leankey send CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M 6z3aeTKfDhs7x5seKn5vDM2FS28SrVDsFf7cGV9DbcGs 0.1 \
--owner ~/.leankey/localnet/wallet.json --pq ~/.leankey/localnet/other.seed
error: Signed, but the simulation failed: BadSignature (6005): The hash signature does not match the vault's current one-time key. Retry the same intent once the cause is fixed.
8. Check the program and the proofs
leankey verify CtXrzrgqyLFDnNMXmsvroYk5i4Y3hEU5ZJ6jGfqUXC4M
leankey verify TwoKWxqD6kL6ow9bAEZ3Kir9hUFKbocX4LZR4j5R3W6
leankey proofs
verify on a vault checks its address derivation and state; on the program it compares the deployed bytes with the release build's sha256 and prints the upgrade authority. proofs lists the theorems and their axioms. Real output for each is in the CLI reference.
9. Stop the validator
leankey localnet --stop
Path 2: the extension on mainnet
- Install the extension for your browser from /extension. Chrome, Brave, Arc and Opera use the Chrome build; Edge and Firefox (140 or newer) have their own; Safari ships as an Xcode project you sign and run yourself.
- Click the toolbar icon, then Set up Lean Key. Choose Create a new seed, write the 24 words on paper, and pass the three-word check.
- Choose who holds the Ed25519 key:
- My wallet (recommended): Phantom, Solflare, Backpack or a Ledger stays the owner. The extension keeps only the post-quantum seed.
- A hot account in this extension: both keys live in the extension. Simpler, still needs the WOTS+ signature, but one compromised browser profile exposes both keys.
- Set a password. The extension locks itself after 15 minutes by default.
- The extension starts on mainnet (devnet is one click away in Settings). Open a vault:
- with your own wallet as owner, open /app, connect your wallet, and create the vault there. Your wallet signs
InitVault; the extension only supplies the hash of key #0. - with a hot account, fund it with SOL and press Open a vault in the popup.
- with your own wallet as owner, open /app, connect your wallet, and create the vault there. Your wallet signs
- Deposit by sending SOL or tokens to the vault's address from any wallet.
- Withdraw. The extension shows the decoded intent (action, asset, amount, destination, vault, key #k to #k+1) before it signs. Your wallet then signs the transaction (external owner), or the extension signs both (hot account).
The Extension guide covers every screen, the journal and pending intents.
Path 3: the CLI on mainnet
The CLI's default network is mainnet, so the commands from Path 1 work without --network, given a funded keypair file:
leankey keygen --out pq.seed
leankey open --owner wallet.json --pq pq.seed
leankey deposit VAULT 0.5 --from wallet.json
leankey send VAULT DESTINATION 0.1 --owner wallet.json --pq pq.seed
If your owner is a hardware or browser wallet, pass its public key instead of a keypair file to open: the CLI prints the unsigned InitVault transaction for that wallet to sign. Withdrawals from the CLI need the owner as a keypair file; with an external wallet, withdraw from /app.