7 releases

0.6.0-alpha.4 Dec 7, 2021
0.6.0-alpha.1 Dec 6, 2021
0.5.0 Nov 23, 2021
0.5.0-alpha.3 Aug 31, 2021
0.5.0-alpha.2 Aug 26, 2021

#1054 in Magic Beans

Download history 63/week @ 2021-10-08 110/week @ 2021-10-15 107/week @ 2021-10-22 412/week @ 2021-10-29 202/week @ 2021-11-05 381/week @ 2021-11-12 628/week @ 2021-11-19 924/week @ 2021-11-26 2145/week @ 2021-12-03 2761/week @ 2021-12-10 1309/week @ 2021-12-17 555/week @ 2021-12-24 354/week @ 2021-12-31 68/week @ 2022-01-07 62/week @ 2022-01-14 96/week @ 2022-01-21

686 downloads per month
Used in 17 crates (3 directly)

Apache-2.0

130KB
2.5K SLoC

Descriptor wallet library

Build Tests Lints codecov

crates.io Docs unsafe forbidden Apache2 licensed

Library for building descriptor-based bitcoin wallets. Everything a modern cold and hot bitcoin wallet needs, but which is not (yet) a part of rust-bitcoin library.

The library clearly separates parts requiring access to private keys from those which should operate never touching the them. It is advised that wallets should be designed in a way assuming zero private key access for all of their operations aside from transaction signing; this part must be separated into other repository/library and be strictly controlled. One may look after command-line btc-hot and btc-cold wallets in bin directory for an example of how this can be done.

Library provides

  • efficient manipulations with BIP-32 derivation paths, separating derivations requiring private key access from those, which will always operate without;
  • miniscript & classical bitcoin descriptors;
  • PSBT constructor using input descriptors, which allow to specify custom information about RBFs, previous public key P2C tweaks and custom hash types on a per-input basis;
  • PSBT signer, supporting RBFs, relative and absolute timelocks, all sighash types, complex scripts, including witness- and taproot-based;
  • script templates allowing embedding extended pubkeys into bitcoin script assembly;
  • lexicographic ordering of transaction & PSBT inputs & oututs;
  • script type system;
  • helper types for working with hash-lock contracts;
  • PSBT utility functions (retrieving previous output, computing fee);
  • transaction resolver API on top of Electrum Server API for convenience computation of already-mined transaction fees etc;
  • support for SLIP-32/132 extended pubkey types (ypub, zprv etc).

Command-line wallets

One may install command-line wallets with the following command (requires rust compiler and rustup tools to be already installed on a system):

$ rustup default stable
$ rustup update
$ git clone https://github.com/LNP-BP/descriptor-wallet
$ cd descriptor-wallet
$ cargo install --path . --all-features

This will add btc-hot and btc-cold commands to the system.

Dependencies

~5.5MB
~101K SLoC