LearnUnder the hood

Descriptors

The descriptor records every key, path and timelock of your wallet in one line of text, which Liana can back up encrypted.

Your seed phrases let you sign. The descriptor lets Liana, or other software that reads descriptors, find what you can sign for.

A seed phrase alone does not restore a Liana wallet

A seed phrase is the starting point of a tree of keys. From its words, BIP 39 and BIP 32 derive a master key, then child keys below it, each at a derivation path such as m/48'/0'/0'/2'. Every key has 4,294,967,296 possible children, so the tree has no practical end. The words say nothing about which branches your wallet uses.

Your coins are not locked by a key either. Each coin sits behind a script. In a Liana wallet, that script combines every public key in the policy with the timelock. In a SegWit (P2WSH) wallet, the address encodes the SHA-256 hash of that script. To find its coins, wallet software rebuilds the script, hashes it, and looks for the result on-chain.

Take a Simple inheritance wallet. Your Primary key spends at any time. Your heir's Inheritance key spends once a coin has stayed unspent for 52,596 blocks (about 1 year). Your heir keeps their own seed phrase, from which they regenerate their key. The script also contains your Primary key, which nothing in their words produces. They cannot compute a single address of the wallet. The coins stay on-chain, visible to anyone, and out of their reach.

The heir's seed phrase regenerates only the Inheritance key, so the 33 bytes of the Primary key stay missing from the 68-byte P2WSH script, SHA-256 cannot run, no address can be computed, and the wallet's coins stay on-chain, visible to anyone and out of reach.

Even with both seed phrases, software would have to guess the script type, each path, which key sits where, and the timelock. One wrong guess gives different addresses and a wallet that looks empty.

Back up the descriptor with the seed phrases

Without the descriptor, the seed phrases alone cannot restore this wallet. Save it when you create the wallet, as Back up your wallet shows.

One line records the whole script

A descriptor writes all of that down. BIP 380 defines it as a small language for output scripts: a script function such as wsh(...), the keys it takes as arguments, and an optional checksum after #. Liana always writes one. Software that reads the language rebuilds every script and every address of the wallet from that one line. Bitcoin Core 29.0 or later reads the same format, as Recover without Liana shows.

This is how Liana writes the Simple inheritance wallet above, on mainnet, with the default timelock. Its two keys come from public BIP 39 test mnemonics, so never send bitcoin to it.

Simple inheritance, P2WSH
wsh(or_d(pk([73c5da0a/48'/0'/0'/2']xpub6DkFAXWQ2dHxq2vatrt9qyA3bXYU4ToWQwCHbf5XB2mSTexcHZCeKS1VZYcPoBd5X8yVcbXFHJR9R8UCVpt82VX1VhR28mCyxUFL4r6KFrf/<0;1>/*),and_v(v:pkh([b8688df1/48'/0'/0'/2']xpub6FQya7zGhR92kacYsNnjreouvnHJMpXYsUXnW6NJJAJRCKsa26TzDy4LdnGhEurr3d6y1J8PJ7EEMKQp74XTqYvmGJNogYXSKDszYHtF8mX/<0;1>/*),older(52596))))#v86zu0e3

Read it from the outside in. The script function wsh(...) makes it a P2WSH wallet, whose mainnet addresses start with bc1q. Inside sits the policy, or_d(pk(A),and_v(v:pkh(B),older(52596))). The Primary key (A) spends at any time. The Inheritance key (B) spends after 52,596 blocks. Each key is an origin in brackets, an xpub, and the derivation steps /<0;1>/*. The checksum after # closes the line. The Miniscript page explains the policy in full.

The example Simple inheritance descriptor written as one line, wsh(or_d(pk(A),and_v(v:pkh(B),older(52596))))#v86zu0e3, with nested brackets above it and its two keys magnified below.

A Taproot (P2TR) wallet with the same policy starts with tr( instead. The Script types page compares the two.

The origin names the seed phrase and the path

The fingerprint 73c5da0a is the first 4 bytes of the hash of the master public key that the seed phrase produces. It identifies a seed phrase without revealing it. The path 48'/0'/0'/2' follows BIP 48, the hierarchy for multisig wallets:

  • 48': The purpose, BIP 48.
  • 0': Bitcoin mainnet. Every test network uses 1' instead.
  • 0': The account. The installer uses account 0 unless you pick another.
  • 2': The P2WSH script type. Liana keeps 2' for Taproot wallets too.

The ' marks a hardened step, one that only the private key can derive. Liana uses this path when it fetches a key from a signing device or generates a hot key. Every PSBT it builds carries each key's fingerprint and full path, so a signing device recognizes its own key and derives the private key that signs.

The xpub derives every address without a private key

An xpub is a public key plus a chain code. With it, anyone can derive the public keys of its non-hardened children, but no private key. This is how Liana, a watch-only coordinator, computes every address of your wallet while the private keys stay on your signing devices.

The multipath step opens a receive chain and a change chain

BIP 389 reads the multipath step <0;1> as two descriptors in one. The first uses 0 and gives receive addresses. The second uses 1 and gives change addresses. The * stands for every index from 0 upward. The receive address at index 5 uses, for each key, the child at /0/5 below its xpub. The change address at the same index uses /1/5.

The Primary key and the Inheritance key each fork their xpub at m/48'/0'/0'/2' with /<0;1>/* into a receive chain /0 and a change chain /1, and at index 5 the receive address takes /0/5 of both keys while the change address takes /1/5.

If a key appears in two spending paths, as the Primary keys of Expanding multisig do, Liana writes <0;1> in the first path and <2;3> in the second. Each path then uses different child keys of the same xpub.

The checksum catches a typo

The 8 characters after the #, v86zu0e3, are a BIP 380 checksum of everything before them. BIP 380 guarantees that it detects any one mistyped character in a descriptor up to 49,154 characters long. If you replace older(52596) with older(52597), the checksum no longer matches. Liana then refuses the descriptor instead of watching addresses that are not yours.

To read your own descriptor, open Settings > Wallet in Liana. The fingerprints tell you which seed phrase each key comes from. Each older() gives a timelock in blocks.

The descriptor is private, not secret

A descriptor holds no private key, so nobody can move a coin with it. It is still enough to derive every address of the wallet, past and future. Whoever reads it sees your balance, your whole history, your timelocks, and how many keys guard the coins. It is like a bank statement: harmless to your bitcoin, revealing about you.

That leaves you two bad options for a plain-text copy. If you spread copies across cloud storage, email and USB drives, each copy is a place it can leak from. If you keep a single copy, one fire or failed drive can cost you the wallet. The Privacy page covers what else your wallet reveals. Set up inheritance says who should hold a copy.

A plain-text descriptor moves no coin but reveals the balance, history, timelocks and number of keys, so more plain-text copies raise the leak risk while fewer raise the risk of losing the wallet, and encrypting it into liana.bip138 keeps every copy unreadable.

The encrypted descriptor backup

Requires Liana 13.0+ Liana removes that choice by encrypting the descriptor. The installer's Back up descriptor button saves it to a file with the suggested name liana.bip138, in the format of BIP 138, still a Draft. The descriptor inside is unreadable, so you can keep as many copies as you want, in private places. Store the descriptor lists the places that suit them.

The file opens with any one of the wallet's own xpubs, so there is no new password to back up. You already hold those xpubs, because each signing device exports its own on request and each seed phrase regenerates one. Someone who holds none of the wallet's keys cannot open the file.

One xpub is enough to decrypt

Here is what Liana does with the keys of the descriptor:

  1. It takes the public key at the root of each xpub, drops duplicates, and sorts them.
  2. It hashes all of them together with a tagged SHA-256 hash. The result is the secret that encrypts the descriptor, with ChaCha20-Poly1305. Liana never writes this secret down.
  3. For each xpub, it hashes that one key, combines the hash with the secret by XOR, and stores the result in the file.
  4. It adds random decoys to round the count up to 5, 10, 20, and so on, then sorts all the values. A decoy looks like any masked value.
  5. To decrypt, Liana hashes the key of the xpub you provide and combines it with each stored value. One of the results is the secret that opens the file.

For the Simple inheritance wallet, the file holds five values: two masked secrets and three decoys. Your Primary key unmasks one and the heir's Inheritance key the other. Both give the same secret. Before it writes the file, Liana checks that every key of the wallet opens it.

How Liana encrypts the descriptor into liana.bip138: a secret S, a tagged hash of the sorted public keys, is stored once per key as a masked value among random decoys, and the Primary key alone or the Inheritance key alone recovers S and decrypts the descriptor.

What the file still shows

With the default settings, four facts about you or the wallet stay readable in the file. The rest of the readable part, a version number, the cipher and a random nonce, says nothing about either:

  • The format: The readable header of the file starts with the six characters BIP138. Whoever opens the file knows it is an encrypted backup of a Bitcoin wallet. The suggested name, liana.bip138, also says that you use Liana. You can rename the file, because Liana recognizes it by its content.
  • The derivation paths: 48'/0'/0'/2' sits in the clear, so Liana knows which path to ask a signing device for its xpub, or which key to derive from a seed phrase. Requires Liana 16.0+ Untick Include derivation paths when you save the file to leave out common paths such as this one. Recovering from that file can then take several minutes on some signing devices.
  • A rough number of keys: The file holds five values for one to five keys, and ten for six to ten. The exact number stays hidden.
  • The length of the descriptor: The encrypted part is 20 or 22 bytes longer than the descriptor, depending on its length.

The script, the timelocks, the fingerprints and the xpubs stay encrypted.

The 560 bytes of the example liana.bip138 file drawn to scale, one square per byte: 202 readable bytes, then 358 encrypted bytes.

Anyone with one of your xpubs can read the file

That includes your heir, a cosigner, and any service you gave an xpub to. Share an xpub with the same care as the descriptor. Spending does not expose it, because every key Liana puts on-chain is a child of an xpub, never the xpub's own key.

To decrypt a liana.bip138 file with a signing device or an xpub, follow Find the descriptor. A backup from Liana 15.0 or earlier uses another format.

Keep only the encrypted backup

Since Liana 13.0 added the encrypted descriptor backup, Wizardsardine recommends backing up the descriptor in that form only:

  • Keep the liana.bip138 file in as many private places as you like, chosen knowing what the file reveals.
  • Do not publish it on purpose, least of all where it can be tied to your identity.
  • Add a paper copy if you like, never as the only one.

Liana still shows the plain-text descriptor, with a copy button, in the installer and in Settings > Wallet. Settings > Import/export also writes it to a file. Descriptor only - plain-text writes it alone. Export wallet writes it with your labels. Use these for the task that needs them, such as loading the descriptor on a Coldcard or a Krux from a card. Wizardsardine does not recommend keeping them as backups, for privacy. Whoever reads one sees your balance, your history and your timelocks.

The recommendation rests on four facts:

  • Losing the descriptor can cost you the wallet: Your seed phrases alone cannot restore it, as the first section shows. Losing it is the main risk, so redundancy comes first. More copies protect you better than one well-hidden copy.
  • A plain-text copy leaks the wallet: It cannot move a coin. Whoever reads it still sees your balance, your history, your timelocks, and how many keys guard the coins, as The descriptor is private, not secret explains. Each plain-text copy is one more place it can leak from.
  • The encrypted file ends that trade-off: Without one of the wallet's xpubs, nobody can read its script, its timelocks or its keys, as What the file still shows details. Its copies can sit in places that are not built to guard secrets, such as your cloud storage. BIP 138 was written for backups "on untrusted media or cloud services".
  • Paper wears out: Paper burns, soaks and fades. Keep it next to the digital copies, never instead of them. Liana has no QR code or text export of the file. For a QR code, make one from the file's base64 text with another tool. Liana 16.0 imports a base64 text copy of the file, such as the text you scan back from that QR code.

A copy tells its reader that you own a Bitcoin wallet

Whoever opens the file without one of the wallet's xpubs learns only what What the file still shows lists. The BIP138 header says that the file is an encrypted Bitcoin wallet backup. With the default settings, a path such as 48'/0'/0'/2' adds that the keys follow the BIP 48 hierarchy for multisig wallets, on mainnet. The 0' in second position is the coin type of mainnet. Without one of the wallet's xpubs, nobody can read your balance, your addresses, your coins or your timelocks from the file.

So choose each place knowing who can open it and learn that you own a Bitcoin wallet:

  • Your cloud storage or your email: The provider, unless it cannot read what you store, and anyone who gets into the account. If the same account also holds one of the wallet's xpubs, such as the liana.pub file your heir sent you, they can decrypt the file.
  • A USB drive or another computer: Anyone who finds the drive or uses the computer.
  • A relative you trust: That relative, and anyone who goes through their things. A relative who also holds a key of the wallet, such as your heir, can decrypt the file and read the whole descriptor.

Store the descriptor gives examples of each kind.

The encryption protects your privacy, not your coins. Nobody can move a coin with the descriptor, encrypted or not. Your keys and your timelocks guard the coins.

Publishing the file ties a Bitcoin wallet to you

Wizardsardine does not recommend publishing the file on purpose, especially on a public system where it can be tied to your identity, such as a social network. The encryption keeps the details of the wallet hidden. The readable header still tells everyone who sees the post that its author owns a Bitcoin wallet.

Publishing covers any place that anyone can read:

  • A post on a social network or on Nostr.
  • A public website, forum, or paste site.
  • A public code repository or gist.
  • A cloud file shared with anyone who has the link.
  • A public group or channel of a messaging app.
  • A Bitcoin transaction.

A published copy also stays published. Anyone can copy a post before you delete it, and a Bitcoin transaction stays in the blockchain for good. Anyone who holds one of the wallet's xpubs, now or years from now, can open that copy. BIP 138 warns that an xpub sent to a server, then reused as a key of a multisig, lets that server decrypt every backup of that multisig.

A leaked copy is not an emergency

A copy can end up in the wrong hands: a shared folder, a lost USB drive, a hacked email account, a file posted by mistake. The encryption is there for that case. Without one of the wallet's xpubs, whoever holds the copy reads only what What the file still shows lists. The descriptor cannot move a coin, so your coins are not at risk. A leak alone does not mean you have to move them to a new wallet.

If a copy leaks:

  • Keep your other copies: They still protect you against losing the descriptor, and nothing in them needs to change.
  • Delete the leaked copy where you can: Take down the post, the shared link or the file. Someone may already have a copy, so do not count on the deletion.
  • Think of who, or which place, also holds one of the wallet's xpubs: Your heir, a cosigner, or a service you gave an xpub to can decrypt the copy. If one of them can reach it, count it as a leak of the plain-text descriptor. They can see your balance, your history and your timelocks. Your coins stay as safe as your keys.

Next steps