GuidesRecovery

Recover without Liana

Status: advanced

Sweep a Liana wallet with Bitcoin Core, and sign it with a Coldcard, a Krux or your key's seed phrase.

If you cannot use Liana when the time comes to recover the wallet, or if Liana no longer exists, you can still recover it with Bitcoin Core.

You will need

  • The descriptor: The whole line, from wsh( or tr( to the eight characters after #. If you do not have it, see Find the descriptor.
  • Bitcoin Core 29.0 or later: Synchronized, with every block since the wallet received its first coin. With versions 25.0 to 28.x, split the descriptor in two, as the accordion in Import the descriptor shows. A pruned Bitcoin Core, such as the one Liana installs, keeps only the latest blocks, so use one that is not pruned.
  • A key of the path you spend: A Coldcard or a Krux with the descriptor loaded, as the Coldcard and Krux pages describe, and an SD card that both the device and the computer can read. As a last resort, the seed phrase of the key works too, as Sign with the seed phrase in Bitcoin Core shows.
  • A destination address: An address of a wallet you control, checked on that wallet's signing device.

Your key is not on a Coldcard or a Krux?

Sign in Liana instead, with Recover in Liana. A Ledger or a BitBox02 signs for a Liana wallet only once the wallet is registered on it. Bitcoin Core reaches them through HWI, which cannot pass that registration on. If you hold that key as a seed phrase, restore it on a Coldcard or a Krux, as Restore the seed phrase on a Coldcard or a Krux shows. As a last resort, sign with it in Bitcoin Core, as Sign with the seed phrase in Bitcoin Core shows.

The commands run on mainnet, in a Linux or macOS terminal. To rehearse on signet, add -signet after bitcoin-cli.

Import the wallet

Create a watch-only wallet

bitcoin-cli createwallet liana_recovery true

true disables private keys, so the wallet only watches. Bitcoin Core replies "name": "liana_recovery".

Import the descriptor

Replace DESCRIPTOR with your descriptor, checksum included. Replace 1672531200 with the timestamp of a date before the wallet's first coin:

DateTimestamp
1 January 20231672531200
1 January 20241704067200
1 January 20251735689600
1 January 20261767225600

If you do not know the date, use 1640995200, 1 January 2022, which comes before the first release of Liana.

bitcoin-cli -rpcclienttimeout=0 -rpcwallet=liana_recovery importdescriptors "[{\"desc\": \"DESCRIPTOR\", \"timestamp\": 1672531200, \"active\": true, \"range\": [0, 10000]}]"

Bitcoin Core rescans the blocks from that date before it replies, which can take hours. -rpcclienttimeout=0 keeps bitcoin-cli waiting until then.

Reply
[
  {
    "success": true
  }
]

While the rescan runs, follow it from another terminal:

bitcoin-cli -rpcwallet=liana_recovery getwalletinfo

The scanning field of the reply shows the progress, from 0 to 1, and reads false once the rescan is over. This command then shows the balance of the wallet:

bitcoin-cli -rpcwallet=liana_recovery getbalance

Build the transaction

Check the address before you build

The transaction sends every coin you include to this one address. A mistyped address, or one that malware swapped on your computer, loses all of them. Check that it matches the address on the receiving wallet's signing device.

Sweeping every coin in one transaction?

One transaction that spends several coins shows that they belong to the same owner. To link fewer of them, sweep them in several transactions, each with a few coins in inputs. The Recovery path tab shows that option. The primary path takes it too, without sequence. See Privacy.

In each command, replace ADDRESS with the destination address and 20 with the feerate you want, in sats/vbyte.

List the coins

bitcoin-cli -rpcwallet=liana_recovery listunspent

Bitcoin Core lists each confirmed coin with "solvable": true. If the list is empty, see the accordion under these tabs.

Build the sweep

bitcoin-cli -rpcwallet=liana_recovery sendall "[\"ADDRESS\"]" null "unset" 20

sendall spends every coin of the wallet to the address, minus the fee.

Reply
{
  "psbt": "cHNidP8BA…",
  "complete": false
}

"complete": false is expected, because the wallet holds no key.

Restore the seed phrase on a Coldcard or a Krux

Follow this section if you hold your key only as a seed phrase and have a Coldcard or a Krux to restore it on. If a Coldcard or a Krux already holds your key, go to Sign on the signing device. With no such device, Sign with the seed phrase in Bitcoin Core is the last resort.

The device needs the firmware that the Coldcard or Krux page names.

Write the descriptor to the SD card

Paste the descriptor into a plain text file, alone on one line, with its checksum. Give the file a short name that ends in .txt, for example descriptor.txt, and save it to the top level of the SD card.

The device loads the descriptor from this file. Wizardsardine does not recommend keeping it as a backup, for privacy. Whoever reads it sees your balance, your history and your timelocks, as The descriptor is private, not secret explains.

Restore the seed phrase

  • A Coldcard with no seed phrase: Select Import Existing, then 12 Words, 18 Words or 24 Words, and enter the words.

    A Coldcard Q menu with 12 Words selected, above 18 Words, 24 Words and other ways to import a key.
    Import Existing opens on 12 Words, 18 Words and 24 Words. In this example, the Coldcard is a Q.
  • A Coldcard that holds another seed phrase: Go to Advanced/Tools > Temporary Seed. If the Coldcard shows a warning, read it to its end and press the key it asks for. Select Import Words, then the number of words, and enter them. The main menu then shows the fingerprint of your key at the top, in brackets.

    A Coldcard Q main menu with [73C5DA0A] selected at the top, above Ready To Sign, and TMP.SEED 73C5DA0A in the status bar.
    With a temporary seed phrase, the fingerprint of your key heads the main menu. In this example, it is 73C5DA0A.

If your key has a passphrase, select Passphrase on the main menu, enter it and apply it. The Coldcard shows the fingerprint of the key with this passphrase, in brackets and in capital letters. Check that it matches the fingerprint before your key in the descriptor, such as c477fd13 in [c477fd13/48'/0'/0'/2'], then approve.

Load the descriptor on the device

Insert the SD card into the device, then load descriptor.txt:

Go to Settings > Multisig/Miniscript > Import. On a Q, press 1 to read the card. Select the file, check the policy, and approve. The Mk4, Mk5 and Q pages show each screen.

A Coldcard Q screen reading Create new miniscript wallet?, Wallet Name: descriptor, Segwit P2WSH and the policy with older(52596).
The Coldcard names the wallet after the file and shows the policy. In this example, the timelock is 52,596 blocks.

If the Coldcard shows Failed to import miniscript., then a line that starts with My key and ends with missing in descriptor., it does not hold your key. Go back to the previous step, and check the words and the passphrase.

Sign before you turn the Coldcard off. The Coldcard forgets a temporary seed phrase and a passphrase when it turns off.

Sign on the signing device

Save the PSBT to the SD card

Paste the value of psbt, without the quotes, into a plain text file named recovery.psbt. Save the file to the top level of the SD card.

Sign on the device

Insert the card into the Coldcard or the Krux, and sign the file as Sign air-gapped describes. Check the address and the amount on the device's screen before you approve. The device writes a signed copy next to the file, with -signed or -part in its name.

The Coldcard names the copy -part even when it holds every signature the path needs. If the Coldcard also writes a .txn file, leave that file aside.

If the path needs more signatures, sign that copy on the next device. A Coldcard does not list a file with -signed in its name, so rename a Krux copy before you give it to a Coldcard.

Copy the signed PSBT

Put the card back into the computer. Open the signed copy in a text editor and copy its text, without the line break at its end.

Then continue with Broadcast the transaction.

Sign with the seed phrase in Bitcoin Core

Sign with the seed phrase of a key only as a last resort, when you have no signing device to restore it on. If you cannot run Liana, Bitcoin Core builds, signs and broadcasts the transaction. If Liana runs, enter a seed phrase of 12 words with no passphrase in Liana instead, as Handle a missing piece describes. For any other seed phrase, Liana builds and broadcasts the transaction, and Bitcoin Core only signs.

Bitcoin Core signs with the root key of your key's seed phrase, whatever its length. It reads no words, so a BIP39 tool turns them into that key first.

Do not restore the seed phrase as a single-key wallet in other software. That wallet does not know the script of the Liana wallet, where your coins sit, so it cannot sign. Sparrow, for one, shows No open wallets can sign.

These steps put your key on this computer

The text editor, the history of your terminal and the Bitcoin Core wallet file all hold your private key. Malware on this computer can then spend every coin that this key can spend. If you can, restore the seed phrase on a Coldcard or a Krux and sign with the device instead.

Open a BIP39 tool offline

Disconnect the computer from the network, then open a BIP39 tool that works without a connection.

Enter the seed phrase

Enter the words in the tool. If your key has a passphrase, enter it too. Select the Bitcoin network, or testnet on signet.

Copy the root key

Copy the BIP32 root key and paste it into a text editor, without saving the file. The key starts with xprv, or with tprv on signet. Close the tool, then reconnect the computer to the network.

Write the signing descriptor

  1. Paste the wallet's descriptor into the text editor, without the # and the eight characters after it.
  2. Find your key by the fingerprint in brackets at its start, such as [c477fd13/48'/0'/0'/2']. Replace the brackets and the xpub after them with the root key, followed by the path from the brackets. Keep what follows the xpub, such as /<0;1>/*.
  3. If the fingerprint appears in more than one path, replace only its occurrence in the path you spend. In a wsh( descriptor, Bitcoin Core refuses two root keys written this way, with contains duplicate public keys.
  4. Replace every ' left in the descriptor with h.
Your key in the descriptor
pkh([c477fd13/48'/0'/0'/2']xpub6E…/<0;1>/*)
Your key in the signing descriptor
pkh(xprv9s21ZrQH…/48h/0h/0h/2h/<0;1>/*)

The other keys keep their xpub. With Bitcoin Core 25.0 to 28.x, split the signing descriptor now, as steps 1 and 2 of the accordion in Import the descriptor show. Give each copy its own checksum in the step Add the checksum.

Create the signing wallet

bitcoin-cli createwallet liana_signer false true

false keeps private keys enabled, and true creates the wallet blank, with no key of its own. Bitcoin Core replies "name": "liana_signer".

Add the checksum

Replace SIGNING_DESCRIPTOR with the descriptor you wrote:

bitcoin-cli getdescriptorinfo "SIGNING_DESCRIPTOR"
Reply, trimmed
{
  "checksum": "kq5dcyxj",
  "hasprivatekeys": true
}

Append # and the value of checksum to the descriptor. Ignore the checksum at the end of descriptor, which belongs to the form without your private key. "hasprivatekeys": true shows that Bitcoin Core read the root key.

Import the signing descriptor

Replace SIGNING_DESCRIPTOR with the descriptor and its new checksum:

bitcoin-cli -rpcwallet=liana_signer importdescriptors "[{\"desc\": \"SIGNING_DESCRIPTOR\", \"timestamp\": \"now\", \"range\": [0, 10000]}]"

"now" skips the rescan, because this wallet only signs and needs no past blocks.

Reply
[
  {
    "success": true,
    "warnings": [
      "Not all private keys provided. Some wallet functionality may return unexpected errors",
      "Not all private keys provided. Some wallet functionality may return unexpected errors"
    ]
  }
]

Bitcoin Core warns because the descriptor holds no private key for the other keys of the wallet. With two split copies, put two {…} entries in the list, one per copy, each with the same "timestamp" and "range".

Sign the PSBT

Use this tab if you built the transaction in Bitcoin Core, in Build the transaction.

Replace PSBT with the value of psbt from that section:

bitcoin-cli -rpcwallet=liana_signer walletprocesspsbt "PSBT"
Reply, trimmed
{
  "psbt": "cHNidP8BA…",
  "complete": true,
  "hex": "020000000001…"
}

"complete": true means the transaction carries every signature the path needs. Continue with Broadcast the transaction, with this value of psbt as SIGNED_PSBT.

Broadcast the transaction

Finalize the PSBT

Replace SIGNED_PSBT with the content you copied:

bitcoin-cli finalizepsbt "SIGNED_PSBT"
Reply
{
  "hex": "02000000000102ce70d6e08ca0b5e0…",
  "complete": true
}

"complete": true means the transaction carries every signature it needs.

Test the transaction

Replace HEX with the value of hex:

bitcoin-cli testmempoolaccept "[\"HEX\"]"
Reply, trimmed
[
  {
    "allowed": true,
    "vsize": 211,
    "fees": {
      "base": 0.00004220,
      "effective-feerate": 0.00020000
    }
  }
]

"allowed": true means Bitcoin Core would accept the transaction now. effective-feerate is in BTC per 1,000 vbytes, so 0.00020000 means 20 sats/vbyte. If it is lower than you want, build and sign the transaction again with a higher feerate.

Broadcast

bitcoin-cli sendrawtransaction "HEX"

Bitcoin Core replies with the transaction ID and sends the transaction to the network.

Next steps