Spending paths
One path that can always spend, and recovery paths that open only after a wait.
A Liana wallet gives each of its coins several ways to be spent. Each way is a spending path: a set of keys, the number of signatures it needs, and for all paths but one, a wait.
One coin, several ways to spend it
Every Liana wallet has one primary spending path and at least one recovery path. The descriptor records every path. Every coin of the wallet is locked under all of them at once. Any single path is enough to spend a coin.
Take a wallet with three paths:
| Path | Keys | Signatures | Wait |
|---|---|---|---|
| Primary path | Keys A and B, both yours | 2-of-2 | None |
| Recovery path #1 | Key C, a spare of yours | 1 | 26,298 blocks (about 6 months) |
| Recovery path #2 | Key D, your heir's | 1 | 52,596 blocks (about 1 year) |
Liana lists the paths of your wallet under Settings > Wallet, labeled
(primary path), (recovery path #1), and (recovery path #2). It numbers the
recovery paths from the shortest wait up.
The primary path can always spend
The primary path is keys and nothing else: no wait, no expiry date. It can spend a coin at any moment. Nothing in the script ever takes that ability away.
Every payment you build in Send goes through it. lianad leaves the inputs
of those transactions without any relative timelock, so only the primary path
can complete them. The change comes back as a new coin, whose wait starts from
zero. The Timelocks page explains that clock.
Using the primary path is therefore what keeps the recovery paths closed. For a coin you do not spend, refresh it before its wait ends.
A recovery path adds a wait to a set of keys
The timelock of a recovery path runs from 1 to 65,535 blocks (about 1 year and 3 months). Bitcoin counts the wait from the block that confirmed each coin, so the path opens coin by coin. If a coin confirms in block 900,000, key C can spend it from block 926,298.
An open recovery path needs none of your keys, so pick its holder and its wait together, as Choose a policy shows.
Recovery paths open one after another
No two recovery paths share the same wait. A path that opens adds to the paths already open. It never replaces them. For the coin confirmed in block 900,000:
- Primary path: At any moment, with keys A and B.
- Recovery path #1: From block 926,298, with key C.
- Recovery path #2: From block 952,596, with key D.
From block 952,596, all three paths can spend the coin. No path closes until the coin moves.
The countdown that Coins/UTXOs shows for each coin is for Recovery path #1 only. Recovery path #2 opens 26,298 blocks (about 6 months) later. To stage paths like these, start from Build your own in Choose a policy.
Either path can be a multisig
Each path is a single key or a threshold of several keys, set independently. The primary path can be a 2-of-2 while a recovery path is a single key, or a 2-of-3. A signing device can hold a key in several paths, but Liana refuses two keys from the same signing device in one path.
Expanding multisig, one of the installer templates, pairs a 2-of-2 primary path with a 2-of-3 recovery path that adds a third key.
That independence makes a strict quorum reasonable. The primary path can stay a 2-of-2, because a key that cannot spend before the wait covers a loss. The Wallet policies page compares this with a plain 2-of-3. Set the primary path for a normal payment first, then the recovery paths for the day a key is gone.
A recovery transaction targets one path
In Recovery, Liana lists each recovery path that can spend at least one coin now, with the signatures it needs and the coins it can recover. You tick one path. Liana then builds the transaction for it:
- The wait:
lianadwrites the path's timelock into thenSequencefield of every input. - The coins: Liana ticks every coin old enough for that path. You can untick a coin to leave it in the wallet.
- The keys: When you select Sign, Liana lets you sign only with the keys of that path.
lianad does the same through createrecovery. Its timelock parameter picks
the path. Without it, lianad uses the recovery path with the shortest wait. See
Call the JSON-RPC API.
Earlier paths can complete a transaction built for a later one
Bitcoin checks two things on each input. The coin must be at least as old as
the wait the input declares in nSequence (BIP 68). The timelock of the path
that signs must not exceed that declared wait (BIP 112).
In the example:
- Built for Recovery path #2: Every input declares 52,596. Key D can complete it. Key C can too, because 26,298 is below 52,596. Whoever signs, every coin in it must be at least 52,596 blocks old.
- Built for Recovery path #1: Every input declares 26,298. Key D cannot complete it, because its path needs 52,596.
In Liana, tick the path whose signatures you can provide. If you can sign for several paths, tick the earliest. It recovers every coin the later paths can, plus the younger ones. Recover in Liana is the procedure.