Create and back up a wallet

Create a wallet, protect it with a passphrase, and make the backups that let you recover it.

On this page
  1. Create
  2. What the wallet holds
  3. Back up
  4. Restore

Create#

xlh wallet create --name main

The passphrase must have at least 12 characters. It is read in the terminal without echo, or from the first line of a file named in LATHEN_WALLET_PASSPHRASE_FILE. It is never a command-line argument and the wallet page never asks for it.

The keys are stored encrypted (a passphrase-derived key with scrypt, then AES-256-GCM). A wrong passphrase, a modified file or weak key-derivation settings fail with a fixed message and open nothing.

What the wallet holds#

ValuePurposeLeaves the wallet?
Spend key (ask)Authorises spendingNever
Nullifier key (nk)Detects when your notes are spent; cannot spendNever
Decryption key (ML-KEM-1024)Opens the envelopes addressed to youNever
State-file keyEncrypts the wallet's saved stateNever
Owner valueWhat a payer puts in a note for youIn your receiving card and payment requests
Encryption public keyWhat a payer encrypts toIn your receiving card

There is one key pair per wallet, so one owner value. It is not visible on chain, because each note hides it behind a fresh random salt.

Back up#

Everything lives in the data folder; xlh version prints where. Make a backup right after creating the wallet and again after creating an asset:

xlh wallet backup --name main --out <file>

The backup is one file encrypted under its own passphrase. It contains your keys and the records that cannot be rebuilt from the chain: issuance secrets and salts, asset labels, contacts, payment requests and launch records. It does not contain notes, witnesses or proofs in progress.

WhatIf you lose itIf someone else gets it
Wallet backup fileThe wallet's funds are goneThey also need the backup passphrase; with both they can spend
Wallet passphraseThe wallet cannot be opened
Genesis file (chain/genesis.json, public)A wallet backup is useless without itNothing; it is public

Store the passphrase and the backup in different places. Keep backups off the computer that runs the node. Do not keep the data folder in a synchronised folder such as OneDrive, iCloud or Dropbox.

Restore#

restore writes a new wallet store. The first synchronisation rescans the chain from block 1 and finds every note again, including notes the ledger created for pool trades. Two things are not restored:

  • An exchange that was open when the backup was made. Its inputs become spendable again when it expires.
  • Notes in flight. A transaction being proved when a wallet is stopped is lost, and the wallet shows its notes as reserved until they expire.
Lathen documentation.