DevelopersRun

Run lianad

Start the Liana daemon without a window on Bitcoin Core or an Electrum server, check that it answers, and open its wallet in Liana.

You will need

  • Linux or macOS: The Linux and macOS release archives contain lianad and liana-cli. You can also build them from source. On Windows, lianad serves no JSON-RPC API and liana-cli does not exist. The lianad that liana-gui runs inside itself serves none either, so start lianad on its own, as this page shows.
  • The descriptor: The wallet's descriptor on one line, checksum included, for the configuration file. Copy it from Settings > Wallet in Liana, or from the daemon.toml that Liana wrote for the wallet. Wizardsardine does not recommend keeping this plain-text descriptor as a backup, for privacy. Whoever reads it sees your balance, your history and your timelocks, as The descriptor is private, not secret explains.
  • A backend: Bitcoin Core 24.0.1 or later (26.0 or later for a Taproot descriptor, 28.0 or later on testnet4), or an Electrum server. Run Bitcoin Core on the same machine and under the same user as lianad, as Connect Bitcoin Core explains. A pruned Bitcoin Core works, with limits on rescans.

Start lianad on your descriptor

Write the configuration file

Save the file for your backend as lianad.toml. Write absolute paths, because lianad does not expand ~.

lianad.toml
data_directory = "/home/user/.lianad"
main_descriptor = "<your descriptor>"

[bitcoin_config]
network = "bitcoin"

[bitcoind_config]
addr = "127.0.0.1:8332"
cookie_path = "/home/user/.bitcoin/.cookie"

Set addr to the IP address and RPC port of Bitcoin Core, port 8332 on mainnet. Write an IP address, because lianad rejects a hostname such as localhost. Set cookie_path to the .cookie file in Bitcoin Core's data directory.

Set network to the network of your wallet: bitcoin for mainnet, or testnet, testnet4, signet or regtest. The descriptor's keys (xpub on mainnet, tpub elsewhere) and the backend must be on that network, or lianad refuses to start.

Set data_directory. Without it, lianad uses the folder Liana keeps for its own mainnet wallets, ~/.liana/bitcoin on Linux or ~/Library/Application Support/Liana/bitcoin on macOS. For every other key, see Configure lianad.

Start lianad

lianad --conf /home/user/lianad.toml

lianad stays in the foreground and logs to standard output. It is ready when it logs JSONRPC server started. Run it under your service manager to keep it up.

Always pass --conf. Without it, lianad reads ~/.liana/liana.toml on Linux or ~/Library/Application Support/Liana/liana.toml on macOS.

Check that lianad answers

Run getinfo with the same file, as the user who started lianad, since lianad restricts its socket to that user:

liana-cli --conf /home/user/lianad.toml getinfo
Output, trimmed
{
  "result": {
    "block_height": 967000,
    "network": "bitcoin",
    "rescan_progress": null,
    "sync": 1.0,
    "version": "16.0"
  }
}

Check two fields, and see getinfo for the others:

  • network: The network of your file.
  • sync: Reaches 1.0 once Bitcoin Core has validated the whole chain, and stays lower while it syncs. With an Electrum server, it is always 1.0.

If liana-cli prints Could not connect to, follow Fix a connection failure.

Rescan an existing wallet on Bitcoin Core

With Bitcoin Core, lianad only sees transactions from about the block Bitcoin Core had reached when lianad first started. Coins the wallet received earlier do not show until you rescan from a date before its first transaction:

liana-cli --conf /home/user/lianad.toml startrescan 1704067200

The parameter is a UNIX timestamp, here 1 January 2024 at 00:00 UTC. Follow the progress in the rescan_progress field of getinfo.

Stop lianad

liana-cli --conf /home/user/lianad.toml stop

Attach Liana to a running lianad

When Liana opens a wallet, it first looks for lianad_rpc in the wallet's folder. If a lianad answers there, Liana uses it instead of starting its own. Run lianad on the daemon.toml that Liana wrote for that wallet. Liana then does not start the Bitcoin Core it manages for you, so use this only for a wallet on your own Bitcoin Core or on an Electrum server.

Liana and liana-cli both connect to lianad through the same lianad_rpc socket, in the wallet's folder next to daemon.toml. Only lianad talks to your own Bitcoin Core or an Electrum server. Inside Liana, its own lianad and Bitcoin Core are drawn dashed, not started.
Liana and liana-cli reach the same lianad through one socket in the wallet's folder. Only lianad talks to the backend.

Find the wallet's daemon.toml

find ~/.liana -name daemon.toml

If find prints several files, take the one whose folder starts with your descriptor's checksum, the eight characters after # (see Find the files of a wallet). A wallet created before Liana 11.0 keeps its daemon.toml directly in the network folder, such as ~/.liana/bitcoin/.

Quit Liana

Liana looks for the socket only when it opens a wallet.

Start lianad on that file

Pass the path that find printed:

lianad --conf ~/.liana/bitcoin/data/<checksum>-<timestamp>/daemon.toml

Open the wallet in Liana

Start Liana and open the wallet. If you keep Liana's files outside the default folder, start it with this command, where <path> is that folder:

liana-gui --datadir <path>

Liana treats a lianad it did not start differently:

  • It does not let you edit the backend. Edit daemon.toml, then restart lianad.
  • Quitting Liana leaves lianad running.

Next steps