Antoine Poinsot 2b76180cdf
Merge #374: Cleanup the descriptors module
9394be645c698591da9c477dd77363010cb3298e [bugfix] descriptors: fix parsing of descriptor with 1-of-N multisig (Antoine Poinsot)
1a13b7a6f820e92ff436198bffc78b8ad785a758 descriptors: rename InheritanceDescriptor into SinglePathLianaDesc (Antoine Poinsot)
8d1c6de5dde85583a6fb3a03458774d113ccb7b9 descriptors: rename MultipathDescriptor into LianaDescriptor (Antoine Poinsot)
f6885e358bfe78a790226e6246dad4922cf82d02 descriptors: cleanup error types (Antoine Poinsot)
647d65fe045a71158041cfb4bf5b98e5200db2e8 descriptors: create Liana descriptors through the policy (Antoine Poinsot)
9b866300be53be8a4e49e7913be25ff8887eac63 descriptors: merge the semantic analysis in one place (Antoine Poinsot)
cd566b91af07a53f9651c034ef4da95a8a033c56 descriptors: rename LianaDescInfo into LianaPolicy (Antoine Poinsot)
757009536b489b333ddb6a2d6bf237196e930e4e descriptors: make sure there is at least one timelocked path when parsing (Antoine Poinsot)
eebfa4755944f14aaa23f8b1a293a1b6a0f0f30f descriptors: move descriptor policy analysis into its own submodule (Antoine Poinsot)
c0dd63dfb2b6831666fb260581dce36e6f7601fa descriptors: move the LianaDescKey to the keys submodules (Antoine Poinsot)
7772ae8d8a74dc0f52be0381a77e68e4d2e8478f descriptors: move derived keys into their own submodule (Antoine Poinsot)
9e78ac7e8dd8bfb7170f64aa314aea30921aca4b descriptors: make the module a folder. (Antoine Poinsot)

Pull request description:

  We've been piling a bunch of new features since this module was first architectured, and it has become messy. This led to duplicate code, a confusing interface (`InheritanceDescriptor`, `LianaDescInfo`, ..) and more importantly bugs.

  This is a complete re-organization of the module in view of introducing multi-paths descriptors soon. This PR contains two bugfixes but aside from that it should not change (correct) behaviour. It does however completely break the interface.

  The new interface makes a lot more sense:
  - A `LianaPolicy` representing a Liana spending policy, from which you can get the parameters for the various spending path, and you can create from those parameters.
  - A `LianaDescriptor` which can be created from a `LianaPolicy`, and from which you can infer a `LianaPolicy` to retrieve the parameters of each spending path.

  This bijection (although it will soon become a surjection as we'll introduce the Miniscript policy compiler to create a `LianaDescriptor` from a `LianaPolicy`) makes the life of a client of the API easier, but it also harmonizes the code: we've centralized the Miniscript Semantic Policy checks of a descriptor in a single place to make sure that we can parse only what, and all, descriptors we can create.

ACKs for top commit:
  edouardparis:
    ACK 9394be645c698591da9c477dd77363010cb3298e

Tree-SHA512: 784eee825644db43417ec040f85b9e20ab72bcc545eed68a2b9b5a5945f86bea6e2d7b091e438b7ba8d4e0a6963459f2b29af59995a407a3c509b5be0fd06e9b
2023-03-28 12:21:50 +02:00
2023-02-27 14:46:28 +01:00
2023-03-27 19:53:49 +02:00
2023-02-27 14:46:28 +01:00
2023-03-27 19:01:30 +02:00
2023-03-24 17:48:32 +01:00
2023-02-27 14:33:02 +01:00
2022-11-17 17:10:22 +01:00
2023-02-28 11:31:54 +01:00

Liana

The missing safety net for your bitcoins.

About

Liana is a simple Bitcoin wallet that features a timelocked recovery path for all your coins. That is, your coins are spendable as with a regular wallet but a secondary key becomes available after a configurable period of time should the primary one not be accessible anymore.

Liana can be used for inheritance, where the owner of the coins is holding the primary key and the heir the secondary one. It can also be leveraged for recovery where a single person is holding both but different tradeoffs can be made between the backup(s) of the directly accessible and timelocked keys.

Learn more about Liana from our announcement blog post and about how it was enhanced with Multisig from our second release post.

Liana is still under heavy development. Multisig support was implemented in the second release. Regular wallet features are also planned. In addition we intend to implement the possibility to have multiple timelocked paths (for instance for more powerful decaying multisigs). We also intend to switch to using Taproot as soon as possible, for enhanced privacy.

As such please consider Liana to be beta software.

Usage

TL;DR: if you just want to quickly try Liana on Bitcoin Signet, check out the guide!

As a Bitcoin wallet, Liana needs to be able to connect to the Bitcoin network. The software has been developed such as multiple ways to connect to the Bitcoin network may be available. However for now only the connection through bitcoind is implemented.

Therefore in order to use Liana you need to have the Bitcoin Core daemon (bitcoind) running on your machine for the desired network (mainnet, signet, testnet or regtest). The bitcoind installation may be pruned (note this may affect block chain rescans) up to the maximum (around 550MB of blocks).

The minimum supported version of Bitcoin Core is 24.0.1. If you don't have Bitcoin Core installed on your machine yet, you can download it there.

Installing the software

The recommended installation method for regular users is to download an executable software release. If you prefer to build the project from source, see doc/BUILD.md instead.

Head to the release page and download the right executable for your platform. If you are not sure what is the "right" executable for your platform, choose liana-0.3.exe if you are on Windows, liana-0.3.dmg if you are on MacOS and liana-0.3-x86_64-linux-gnu.tar.gz if you are on Linux.

For every file available on the release page, there is an accompanying .asc file with the same name. This is a GPG signature made with Antoine Poinsot's key: 590B7292695AFFA5B672CBB2E13FC145CD3F4304. This key is available elsewhere for cross-checking, such as on his Twitter profile or his personal website. It is recommended you verify your download against this key.

Note that we do not codesign ("notarize") the released binaries for now. Windows or MacOS may prevent you from installing the software. On MacOS, you would get a warning saying the developer of this application couldn't be verified. This is because we didn't register with Apple prior to releasing the application. Make sure you verified the GPG signature of the download, then add an exception for Liana by following the steps from this Apple support guide (section "If you want to open an app that hasnt been notarized or is from an unidentified developer").

Releases of Liana are reproducibly built. See contrib/reproducible for details and instructions if you want to check a release.

Setting up a wallet

If you are using the graphical user interface (GUI), you can just start the program. It will spawn an installer that will guide you through the process of setting up a new wallet.

If you are using the daemon, you will need to specify its configuration as a TOML file. There is a documented example of such a configuration file in the contrib/ folder. Then you can start the daemon like so:

lianad --conf /path/to/your/conf.toml

The script descriptor

In Bitcoin, the conditions for spending a certain amount of coins are expressed using Script. In order to be able to recover your coins, you need to back up both:

  • The Script template, in the form of a standard Output Script Descriptor
  • The private key(s) corresponding to the public key(s) used in the Script

By so doing, any software that understands the Output Script Descriptor standard will be able to retrieve your coins. By using your private key(s) you would then be able to sign a transaction spending them.

But without the descriptor you won't be able to recover from your backup. Note however it is simpler to have redundancy for your descriptor backup. A thief getting access to it would be able to learn your balance (and transaction history), but would not be able to steal your funds. Therefore you may afford a greater number of backups of your descriptor(s) and using less secure mediums than for storing your private key(s).

Using a wallet

You can use Liana just like a regular wallet. Just be aware that if you are using a relative timelock (the only type of timelocks supported for now), time starts ticking when you receive a payment. That is if you want the recovery path to never be available, each coin must be spent at least once every N blocks. (With N the configured value of the timelock.)

Liana can be used as a hot wallet. Note that mnemonics would be stored in clear on your drive. We strongly recommend using a hardware signing device for any non-trivial amount.

For now, only the Ledger and Specter DIY signing devices are supported, as Miniscript compatibility of the signer is a must. We expect more signing devices to implement Miniscript capability. For more information, please read the signing devices documentation.

If you are using a Ledger device, the minimum supported version of the Bitcoin application is 2.1.0. You may have to tweak with the Ledger Live options in order to install it for now, see the instructions here.

If you are using the GUI, it should be intuitive what menu to use depending on your intention. If it is not, bug reports are very welcome so feel free to report it! :)

If you are using the daemon, you can use the liana-cli binary to send commands to it. It will need the path to the same configuration as the daemon. You can find a full documentation of the JSONRPC API exposed by lianad at doc/API.md. For instance:

$ liana-cli --conf ./signet_config.toml getinfo
{
  "result": {
    "block_height": 131880,
    "descriptors": {
      "main": {
        "change_desc": "wsh(or_d(pk([0bb79a6c/48'/1'/0'/2']tpubDEfKGhwubP97F3gqfvrSHmqEqLTaeBJvyY5byWuzFTuShnj7WWrG4bZMWxAiva2qoGc9DZWERczuvBqbRAB7vEiyEHqjLLctZ7Tif27EGu3/1/*),and_v(v:pkh([0bb79a6c/48'/1'/1'/2']tpubDFYpQER7bt8M2ByvNBmhThcVp5p4QrEV72dHVczXukDbjFPPMFVPy5hYqHKp3TtLaESbYpM2FCH1oECai6GKiMuv5bkomPy9zhtBGgBRkQs/1/*),older(2))))#x0xv2zce",
        "multi_desc": "wsh(or_d(pk([0bb79a6c/48'/1'/0'/2']tpubDEfKGhwubP97F3gqfvrSHmqEqLTaeBJvyY5byWuzFTuShnj7WWrG4bZMWxAiva2qoGc9DZWERczuvBqbRAB7vEiyEHqjLLctZ7Tif27EGu3/<0;1>/*),and_v(v:pkh([0bb79a6c/48'/1'/1'/2']tpubDFYpQER7bt8M2ByvNBmhThcVp5p4QrEV72dHVczXukDbjFPPMFVPy5hYqHKp3TtLaESbYpM2FCH1oECai6GKiMuv5bkomPy9zhtBGgBRkQs/<0;1>/*),older(2))))#jqhwaq75",
        "receive_desc": "wsh(or_d(pk([0bb79a6c/48'/1'/0'/2']tpubDEfKGhwubP97F3gqfvrSHmqEqLTaeBJvyY5byWuzFTuShnj7WWrG4bZMWxAiva2qoGc9DZWERczuvBqbRAB7vEiyEHqjLLctZ7Tif27EGu3/0/*),and_v(v:pkh([0bb79a6c/48'/1'/1'/2']tpubDFYpQER7bt8M2ByvNBmhThcVp5p4QrEV72dHVczXukDbjFPPMFVPy5hYqHKp3TtLaESbYpM2FCH1oECai6GKiMuv5bkomPy9zhtBGgBRkQs/0/*),older(2))))#eesy8k0q"
      }
    },
    "network": "signet",
    "rescan_progress": null,
    "sync": 1.0,
    "version": "0.3.0"
  }
}

Note also that you might connect the GUI to a running lianad. If the GUI detects a daemon is already running, it will plug to it and communicate through the JSONRPC API.

Using the recovery path

You may sweep the coins whose timelocked recovery path is available. You will need to sign the transaction using the recovery key, hence make sure to connect the appropriate signing device.

In the GUI, this option is available in the "Settings" menu at the "Recovery" section. Click on the "Recover funds" button, enter the destination for the sweep and the feerate you want to use for the sweep transaction. Then sign it with the recovery key and broadcast it.

For the daemon, see the createrecovery command. It will create a sweep PSBT to the requested address with the specified feerate, filled with all available coins.

About the software project

Liana is an open source project. It is hosted at Github.

Contributions are very welcome. For guidelines, see CONTRIBUTING.md.

Liana is separated in two main components: the daemon and the Graphical User Interface.

Liana daemon

The daemon contains the core logic of the wallet. It is both a library (a Rust crate) that exposes a command interface and a standalone UNIX daemon that exposes a JSONRPC API through a Unix Domain Socket.

The code for the daemon can be found in the src/ folder at the root of this repository.

Liana GUI

The GUI contains both an installer that guides a user through setting up a Liana wallet, as well as a graphical interface to the daemon using the iced library.

The code for the GUI can be found in the gui/src/ folder.

License

Released under the BSD 3-Clause Licence. See the LICENCE file.

Description
A fork of https://github.com/wizardsardine/liana with removed loopback restrictions to allow connecting to a custom remote bitcoin core node
Readme
Languages
Rust 90.4%
Python 8.5%
Shell 0.5%
Scheme 0.3%
Nix 0.3%