DocsHow it works

How it works

A Winternitz key may sign only once. QVAULT therefore never reuses a key. Instead it gives you a chain of vaults, each with its own one-time key, all derived from one phrase. Every withdrawal spends the current vault exactly once and moves whatever you did not withdraw into the next one.

From phrase to vault#

QVAULT phrase (24 words, generated and kept in the browser)
   │  BIP39, empty passphrase
   ▼
64-byte seed
   │  HMAC-SHA512 per (index n, chain i)            n = 0, 1, 2, ...
   ▼
WOTS secret key n  (26 chain starts × 24 bytes)
   │  hash each chain 255 times
   ▼
WOTS public key n  (26 × 24 = 624 bytes)
   │  SHA-256 with a domain tag
   ▼
vault hash h_n (32 bytes)  ──▶  vault address = PDA ["vault", h_n]

The same phrase and index always give the same vault. The phrase is the only backup: there is no server-side copy, and no one can recover it for you. The exact derivation is on the Cryptography page.

The vault chain#

 vault #0            vault #1            vault #2
 ┌──────────┐ spend  ┌──────────┐ spend  ┌──────────┐
 │  Rolled  │──────▶ │  Rolled  │──────▶ │   Open   │ ◀── deposits go here
 │tombstone │        │tombstone │        │  (live)  │
 └──────────┘        └──────────┘        └──────────┘
      │                   │
      ▼                   ▼
  recipient A         recipient B
  • The live vault is the first index that is Open or was never opened. Deposits go there, and the next spend comes from it.
  • A spent vault becomes a tombstone: a 68-byte account that stays on-chain with status Rolled or Closed and the address its funds went to. The program never lets it sign or open again, so a signature can't be replayed.
  • Finding your vaults needs no server. The app derives index 0, 1, 2, … from your phrase and reads those addresses in batches until it reaches the live vault.

Deposit#

Deposits need no signature from the vault. Anyone can deposit into an Open vault:

  • First deposit: one transaction opens the vault (OpenVault, the fee payer pays its rent) and deposits SOL, one SPL token, or both.
  • Later deposits: DepositSol or DepositToken into the live vault. A plain SOL transfer to the vault address, or a token transfer to the vault's associated token account (ATA), also works. That makes the vault usable as a receive address.

Tokens are held in the vault's canonical ATA for each mint. Only classic SPL Token is supported.

Withdraw and roll#

A withdrawal is one transaction with one Spend instruction. The vault's WOTS key signs a message that fixes everything about the outcome: the action, the amount, the recipient, at most one token mint, and the hash of the next vault. The program rebuilds that message from the instruction and its accounts, then verifies the signature against the vault's stored hash.

Action To the recipient Rolls to the next vault
WithdrawSol amount lamports all other lamports, plus all tokens of the bound mint (if any)
WithdrawToken amount tokens of the bound mint the rest of that token, plus all lamports
Close all lamports and all tokens of the bound mint nothing; the chain ends

What happens to the accounts:

  • The vault keeps exactly its rent-exempt minimum and becomes a tombstone that records its destination.
  • The vault's ATA for the bound mint is emptied and closed. Its rent goes to the next vault, or to the recipient on Close.
  • The next vault is created if it does not exist. The connected wallet, as fee payer, pays its rent and the rent of any new token account. The fee payer never gains authority over the funds.
  • The next vault becomes the live vault and has a fresh one-time key.

Close#

Close sends everything to the recipient and binds no next vault. The next index is simply a fresh, unopened vault, so the same phrase can open a new chain later from there.

Sweeps#

One spend moves SOL plus at most one token. Two things can still arrive at a spent vault:

  • Late lamports: SOL sent to the address after the spend.
  • Other tokens: token accounts of mints that the spend did not bind.

Anyone can sweep both with SweepSol and SweepToken, and no signature from the vault is needed. A sweep can only send funds to the destination recorded at spend time: the next vault after a roll, or the recipient after Close. Spent vaults therefore never trap funds, and nobody can redirect them.

Worked example#

Rent figures are the devnet values measured on 6 Dec 2026: a vault account (68 bytes) costs 504,700 lamports and a token account costs 754,475 lamports. Token M is a classic SPL token.

1. Open vault #0, deposit 1 SOL and 600 M. The fee payer pays the vault rent (504,700) and the vault's ATA rent (754,475).

lamports M
vault #0 1,000,504,700 600

2. WithdrawSol 0.2 SOL to Alice, with M bound so that it rolls along. The fee payer pays the rent for vault #1 (504,700) and its ATA (754,475).

lamports M status
Alice +200,000,000
vault #0 504,700 0 (ATA closed) Rolled → vault #1
vault #1 504,700 + 800,000,000 + 754,475 (recycled ATA rent) 600 Open (live)

3. Someone sends 0.05 SOL to vault #0's address. Anyone may call SweepSol on vault #0, which can only move the 50,000,000 lamports to vault #1.

4. Close vault #1 to Bob, with M bound. The fee payer pays the rent for Bob's new ATA (754,475).

lamports M status
Bob +851,508,950 (850,754,475 from the vault, 754,475 from its closed ATA) 600
vault #1 504,700 0 (ATA closed) Closed → Bob
vault #2 unopened, ready for a new chain

In total, Bob receives 1 SOL − 0.2 SOL + 0.05 SOL plus two recycled token-account rents. Each tombstone keeps its 504,700 lamports for good.

Costs#

Who pays Approximate devnet figure
Network fee fee payer 5,000 lamports per signature
New vault (open, or the next vault on a roll) fee payer 504,700 lamports, locked in the tombstone after its spend
New token account (vault, next vault, recipient) fee payer 754,475 lamports; a vault's own ATA rent is recycled when it is closed
Compute about 450k–640k compute units per spend, about 21k for open plus deposit

Exact compute and size figures are in the Program reference.