GitHub – Blockstream/Lwk at Blog.blockstream.com

https://github.com/Blockstream/lwk

Liquid Wallet Kit

LWK logo

NOTE: LWK is in public beta and still undergoing significant development. Use it at your own risk.

What is Liquid Wallet Kit (LWK)?

LWK is a collection of Rust crates for Liquid Wallets. Its goal is to provide all the necessary building blocks for Liquid wallet development to enable a broad range of use cases on Liquid.

By not following a monolithic approach but instead providing a group of function-specific libraries, LWK allows us to offer a modular, flexible and ergonomic toolset for Liquid development. This design lets application developers pick only what they need and focus on the relevant aspects of their use cases.

We want LWK to be a reference tool driven both by Blockstream and Liquid participants that helps make Liquid integration frictionless, define ecosystem standards and leverage advanced Liquid capabilities such as covenants or swaps.

While LWK is Rust native, we provide bindings for Python, Kotlin and Swift using Mozilla UniFFI and we provide preliminary support for WASM. We will continue polishing these bindings and expanding the available options. Additionally, the Bull Bitcoin team has developed Dart/Flutter bindings.

Main Features

  • Watch-Only wallet support: using Liquid descriptors, better known as CT descriptors.
  • PSET based: transactions are shared and processed using the Partially Signed Elements Transaction format.
  • Electrum and Esplora backends: no need to run and sync a full Liquid node or rely on closed source servers.
  • Asset issuance, reissuance and burn support: manage the lifecycle of your Issued Assets with a lightweight client.
  • Generic multisig wallets: create a wallet controlled by any combination of hardware or software signers, with a user specified quorum.
  • Hardware signer support: receive, issue, reissue and burn L-BTC and Issued Assets with your hardware signer, using singlesig or multisig wallets (currently Jade only, with more coming soon).
  • Native bindings PoC support for Python, Kotlin and Swift, with many other language available soon using uniffi
  • WASM preliminary support with lwk_wasm crate, see it in the demo app or in the working liquid web wallet.
  • JSON-RPC Server support: all functions are exposed via JSON-RPC Server, making it easier to build your own frontend, GUI, or integration.

LWK Structure

LWK functionalities are split into different component crates that might be useful independently.

For instance, mobile app devs might be interested mainly in lwk_bindings, lwk_wollet and lwk_signer. While backend developers might want to directly use lwk_cli in their systems.

Internal crate dependencies are shown in this diagram: an arrow indicates "depends on" (when dotted the dependency is feature-activated, when blue is a dev-dependency):

Dep tree

(generated with cargo depgraph --workspace-only --dev-deps)

Getting started with LWK Development

Rust

Build

You can build all crates with:

Or you can build a single crate with:

cargo build -p lwk_wollet

Rust Examples

Python

Install from PyPI

Build Python wheel

First, create a virtual env, skip the step if you already created it.

cd lwk/lwk_bindings
virtualenv venv
source venv/bin/activate
pip install maturin maturin[patchelf] uniffi-bindgen

Then build the wheel

cd lwk/lwk_bindings
maturin develop

Try it (note there is still an issue in how we import the package when using the wheel):

import lwk
str(lwk.Network.mainnet())

Python Examples

Kotlin

Build

This will build the bindings library in debug mode and generate the kotlin file

Create android bindings library libs, 4 architectures in release mode

Kotlin Examples

Swift

Swift Examples

C#

C# Examples

C# bindings use dotnet SDK 6.0, they are very immature at the moment:

  • They use a uniffi bindings generator from a third party which didn't yet ship for uniffi 0.28
  • It's currently tested only in linux
  • The dynamic library is referenced in a non-standard way

WASM

We currently provide preliminary support but are committed to continue working on this to have a fully featured LWK working on WASM environments. See these instructions to try out LWK on WASM

See what LWK is capable of by using the command line tool (LWK_CLI)

All LWK functions are exposed via a local JSON-RPC server that communicates with a CLI tool so you can see LWK in action.

This JSON-RPC Server also makes it easier to build your own frontend, GUI, or integration.

If you want to see an overview of LWK and a demo with the CLI tool check out this video

Installing LWK_CLI from crates.io

or if you want to connect Jade over serial:

$ cargo install lwk_cli --features serial

Building LWK_CLI from source

First you need rust, our MSRV is 1.75.0 then you can build from source:

$ git clone [email protected]:Blockstream/lwk.git
$ cd lwk
$ cargo install --path ./lwk_cli/

Or

$ cargo install --path ./lwk_cli/ --features serial

To enable connection with Jade over serial.

Using LWK_CLI

Help will show available commands:

Start the rpc server (default in Liquid Testnet) and put it in background

Every command requires the server running so open a new shell to run the client.

Create new BIP39 mnemonic for a software signer

$ lwk_cli signer generate

Load a software signer named sw from a given BIP39 mnemonic

$ lwk_cli signer load-software --signer sw --persist false --mnemonic "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"

Create a p2wpkh wallet named ss (install jq or extract the descriptor manually)

$ DESC=$(lwk_cli signer singlesig-desc -signer sw --descriptor-blinding-key slip77 --kind wpkh | jq -r .descriptor)
$ lwk_cli wallet load --wallet ss -d $DESC

Get the wallet balance

$ lwk_cli wallet balance -w ss

If you have a Jade, you can plug it in and use it to create a wallet and sign its transactions.

Probe connected Jades and prompt user to unlock it to get identifiers needed to load Jade on LWK

Load Jade using returned ID

$ lwk_cli signer load-jade --signer <SET_A_NAME_FOR_THIS_JADE> --id <ID>

Get xpub from loaded Jade

$ lwk_cli signer xpub --signer <NAME_OF_THIS_JADE> --kind <bip84, bip49 or bip87>

When you're done, stop the rpc server.

Tests

Run unit tests:

End-to-end tests need some local servers:

./context/download_bins.sh # needed once unless server binaries changes
. .envrc  # not needed if you use direnv and you executed `direnv allow`

And also the following docker images:

docker pull xenoky/local-jade-emulator:1.0.27
docker pull tulipan81/blind_pin_server:v0.0.7

Note: Failed test executions can leave docker containers running. To stop all running containers run:

docker stop $(docker ps -a -q)

To run end-to-end tests:

To see log outputs use RUST_LOG for example

RUST_LOG=info cargo test -- test_name
RUST_LOG=jade=debug cargo test -- test_name  # filter only on specific module

Test with a physical Jade

Tests using Jade over serial (via USB cable) need an additional dependency:

apt install -y libudev-dev

These serial tests cannot be executed in parallel, so we need the --test-threads 1 flag.

cargo test -p lwk_jade --features serial -- serial --include-ignored --test-threads 1
cargo test -p lwk_wollet --features serial -- serial --include-ignored --test-threads 1

Docs

To generate documentation you can use

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --no-deps --open

Nix

We provide a flake for a dev environment and for running the lwk_cli. If you use direnv and allow the .envrc the dev environment is automatically loaded as soon as you enter the directory, otherwise you can run:

To run lwk_cli on nix-enabled system:

nix run github:blockstream/lwk

History

BEWallet was originally an Elements/Liquid wallet library written in Rust to develop prototypes and experiments.

BEWallet was based on Blockstream's GDK. Essentially some GDK Rust pieces were moved to this project.

This was used as the starting point for the Liquid Wallet Kit project. Parts that were not necessary have been dropped, many things have been polished, and new features have been added.

The codebase has been entirely re-written, and now it has almost no similarity with the original code.

{
"by": "janandonly",
"descendants": 0,
"id": 40245056,
"score": 1,
"time": 1714720664,
"title": "GitHub – Blockstream/Lwk at Blog.blockstream.com",
"type": "story",
"url": "https://github.com/Blockstream/lwk"
}
{
"author": "Blockstream",
"date": null,
"description": "Liquid Wallet Kit. Contribute to Blockstream/lwk development by creating an account on GitHub.",
"image": "https://repository-images.githubusercontent.com/745173603/78afe740-5391-4547-87bd-b2bb6ec73f19",
"logo": "https://logo.clearbit.com/github.com",
"publisher": "GitHub",
"title": "GitHub - Blockstream/lwk: Liquid Wallet Kit",
"url": "https://github.com/Blockstream/lwk"
}
{
"url": "https://github.com/Blockstream/lwk",
"title": "GitHub - Blockstream/lwk: Liquid Wallet Kit",
"description": "Liquid Wallet Kit NOTE: LWK is in public beta and still undergoing significant development. Use it at your own risk. What is Liquid Wallet Kit (LWK)? LWK is a collection of Rust crates for Liquid...",
"links": [
"https://github.com/Blockstream/lwk"
],
"image": "https://repository-images.githubusercontent.com/745173603/78afe740-5391-4547-87bd-b2bb6ec73f19",
"content": "<div><article><p></p><h2>Liquid Wallet Kit</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#liquid-wallet-kit\"></a><p></p>\n<p><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/docs/logos/web/LWK_logo_white_on_dark_rgb.png\"><img src=\"https://github.com/Blockstream/lwk/raw/master/docs/logos/web/LWK_logo_white_on_dark_rgb.png\" alt=\"LWK logo\" /></a></p>\n<p><strong>NOTE: LWK is in public beta and still undergoing significant development. Use it at your own risk.</strong></p>\n<p></p><h2>What is Liquid Wallet Kit (LWK)?</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#what-is-liquid-wallet-kit-lwk\"></a><p></p>\n<p><strong>LWK</strong> is a collection of Rust crates for <a target=\"_blank\" href=\"https://liquid.net/\">Liquid</a> Wallets.\nIts goal is to provide all the necessary building blocks for Liquid wallet development to enable a broad range of use cases on Liquid.</p>\n<p>By not following a monolithic approach but instead providing a group of function-specific libraries, LWK allows us to offer a modular, flexible and ergonomic toolset for Liquid development. This design lets application developers pick only what they need and focus on the relevant aspects of their use cases.</p>\n<p>We want LWK to be a reference tool driven both by Blockstream and Liquid participants that helps make Liquid integration frictionless, define ecosystem standards and leverage advanced Liquid capabilities such as covenants or swaps.</p>\n<p>While LWK is Rust native, we provide <a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings\">bindings</a> for Python, Kotlin and Swift using <a target=\"_blank\" href=\"https://mozilla.github.io/uniffi-rs/\">Mozilla UniFFI</a> and we provide preliminary support for <a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wasm\">WASM</a>. We will continue polishing these bindings and expanding the available options.\nAdditionally, the Bull Bitcoin team has developed <a target=\"_blank\" href=\"https://github.com/SatoshiPortal/lwk-dart\">Dart/Flutter</a> bindings.</p>\n<p></p><h2>Main Features</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#main-features\"></a><p></p>\n<ul>\n<li><strong>Watch-Only</strong> wallet support: using Liquid descriptors, better known as\n<a target=\"_blank\" href=\"https://github.com/ElementsProject/ELIPs/blob/main/elip-0150.mediawiki\">CT descriptors</a>.</li>\n<li><strong>PSET</strong> based: transactions are shared and processed using the\n<a target=\"_blank\" href=\"https://github.com/ElementsProject/elements/blob/1fcf0cf2323b7feaff5d1fc4c506fff5ec09132e/doc/pset.mediawiki\">Partially Signed Elements Transaction</a> format.</li>\n<li><strong>Electrum</strong> and <strong>Esplora</strong> <a target=\"_blank\" href=\"https://github.com/Blockstream/electrs\">backends</a>:\nno need to run and sync a full Liquid node or rely on closed source servers.</li>\n<li><strong>Asset issuance</strong>, <strong>reissuance</strong> and <strong>burn</strong> support: manage the lifecycle\nof your Issued Assets with a lightweight client.</li>\n<li><strong>Generic multisig</strong> wallets: create a wallet controlled by\nany combination of hardware or software signers, with a user\nspecified quorum.</li>\n<li><strong>Hardware signer</strong> support: receive, issue, reissue and burn L-BTC and\nIssued Assets with your hardware signer, using singlesig or multisig\nwallets (currently <a target=\"_blank\" href=\"https://blockstream.com/jade/\"><strong>Jade</strong></a> only, with more coming soon).</li>\n<li><strong>Native bindings</strong> <a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings#readme\">PoC support</a> for Python, Kotlin and Swift, with many other language available soon using <a target=\"_blank\" href=\"https://mozilla.github.io/uniffi-rs/\">uniffi</a></li>\n<li><strong>WASM</strong> preliminary support with <a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wasm\"><code>lwk_wasm</code></a> crate, see it in the <a target=\"_blank\" href=\"https://blockstream.github.io/lwk/\">demo app</a> or in the working <a target=\"_blank\" href=\"https://liquidwebwallet.org/\">liquid web wallet</a>.</li>\n<li><strong>JSON-RPC Server</strong> support: all functions are exposed via JSON-RPC Server, making it easier to build your own frontend, GUI, or integration.</li>\n</ul>\n<p></p><h2>LWK Structure</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#lwk-structure\"></a><p></p>\n<p>LWK functionalities are split into different component crates that might be useful independently.</p>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_cli\"><code>lwk_cli</code></a>: a CLI tool to use LWK wallets.</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wollet\"><code>lwk_wollet</code></a>: library for watch-only wallets;\nspecify a CT descriptor, generate new addresses, get balance,\ncreate PSETs and other actions.</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_signer\"><code>lwk_signer</code></a>: interact with Liquid signers\nto get your PSETs signed.</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_jade\"><code>lwk_jade</code></a>: unlock Jade, get xpubs,\nregister multisig wallets, sign PSETs and more.</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings\"><code>lwk_bindings</code></a>: use LWK from other languages.</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wasm\"><code>lwk_wasm</code></a>: use LWK from WebAssembly.</li>\n<li>and more:\ncommon or ancillary components (<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_common\"><code>lwk_common</code></a>,\n<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_rpc_model\"><code>lwk_rpc_model</code></a>, <a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_tiny_rpc\"><code>lwk_tiny_rpc</code></a>,\n<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_app\"><code>lwk_app</code></a>),\nfuture improvements (<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_hwi\"><code>lwk_hwi</code></a>),\ntesting infrastructure (<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_test_util\"><code>lwk_test_util</code></a>,\n<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_containers\"><code>lwk_containers</code></a>)</li>\n</ul>\n<p>For instance, mobile app devs might be interested mainly in\n<code>lwk_bindings</code>, <code>lwk_wollet</code> and <code>lwk_signer</code>.\nWhile backend developers might want to directly use <code>lwk_cli</code>\nin their systems.</p>\n<p>Internal crate dependencies are shown in this diagram: an arrow indicates \"depends on\" (when dotted the dependency is feature-activated, when blue is a dev-dependency):</p>\n<p><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/docs/dep-tree.svg\"><img src=\"https://github.com/Blockstream/lwk/raw/master/docs/dep-tree.svg\" alt=\"Dep tree\" /></a></p>\n<p>(generated with <code>cargo depgraph --workspace-only --dev-deps</code>)</p>\n<p></p><h2>Getting started with LWK Development</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#getting-started-with-lwk-development\"></a><p></p>\n<p></p><h3>Rust</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#rust\"></a><p></p>\n<p></p><h4>Build</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#build\"></a><p></p>\n<p>You can build all crates with:</p>\n<p>Or you can build a single crate with:</p>\n<div><pre>cargo build -p lwk_wollet</pre></div>\n<p></p><h4>Rust Examples</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#rust-examples\"></a><p></p>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wollet/examples/list_transactions.rs\">Create a testnet watch-only wallet from a CT wallet descriptor and get list of transactions</a></li>\n<li>Documentation for all Rust crates is available at <a target=\"_blank\" href=\"https://docs.rs/releases/search?query=lwk\">docs.rs</a></li>\n</ul>\n<p></p><h3>Python</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#python\"></a><p></p>\n<p></p><h4>Install from PyPI</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#install-from-pypi\"></a><p></p>\n<p></p><h4>Build Python wheel</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#build-python-wheel\"></a><p></p>\n<p>First, create a virtual env, skip the step if you already created it.</p>\n<div><pre><span>cd</span> lwk/lwk_bindings\nvirtualenv venv\n<span>source</span> venv/bin/activate\npip install maturin maturin[patchelf] uniffi-bindgen</pre></div>\n<p>Then build the wheel</p>\n<div><pre><span>cd</span> lwk/lwk_bindings\nmaturin develop</pre></div>\n<p>Try it (note there is still an issue in how we import the package when using the wheel):</p>\n<div><pre><span>import</span> <span>lwk</span>\n<span>str</span>(<span>lwk</span>.<span>Network</span>.<span>mainnet</span>())</pre></div>\n<p></p><h4>Python Examples</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#python-examples\"></a><p></p>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/list_transactions.py\">List transactions</a> of a wpkh/slip77 wallet</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/send_transaction.py\">Send transaction</a> of a wpkh/slip77 wallet in a regtest environment</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/send_asset.py\">Send asset</a> of a wpkh/slip77 wallet in a regtest environment</li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/issue_asset.py\">Issue a Liquid asset</a></li>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/custom_persister.py\">Custom persister</a>, the caller code provide how the wallet updates are persisted</li>\n</ul>\n<p></p><h3>Kotlin</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#kotlin\"></a><p></p>\n<p></p><h4>Build</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#build-1\"></a><p></p>\n<p>This will build the bindings library in debug mode and generate the kotlin file</p>\n<p>Create android bindings library libs, 4 architectures in release mode</p>\n<p></p><h4>Kotlin Examples</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#kotlin-examples\"></a><p></p>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/list_transactions.kts\">List transactions</a> of a wpkh/slip77 wallet</li>\n</ul>\n<p></p><h3>Swift</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#swift\"></a><p></p>\n<p></p><h4>Swift Examples</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#swift-examples\"></a><p></p>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/list_transactions.swift\">List transactions</a> of a wpkh/slip77 wallet</li>\n</ul>\n<p></p><h3>C#</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#c\"></a><p></p>\n<p></p><h4>C# Examples</h4><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#c-examples\"></a><p></p>\n<p>C# bindings use dotnet SDK 6.0, they are very immature at the moment:</p>\n<ul>\n<li>They use a uniffi bindings generator from a <a target=\"_blank\" href=\"https://github.com/NordSecurity/uniffi-bindgen-cs\">third party</a> which didn't yet ship for uniffi 0.28</li>\n<li>It's currently tested only in linux</li>\n<li>The dynamic library is referenced in a non-standard way</li>\n</ul>\n<ul>\n<li><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_bindings/tests/bindings/list_transactions.cs\">List transactions</a> of a wpkh/slip77 wallet</li>\n</ul>\n<p></p><h3>WASM</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#wasm\"></a><p></p>\n<p>We currently provide preliminary support but are committed to continue working on this to have a fully featured LWK working on WASM environments.\n<a target=\"_blank\" href=\"https://github.com/Blockstream/lwk/blob/master/lwk_wasm\">See these instructions to try out LWK on WASM</a></p>\n<p></p><h2>See what LWK is capable of by using the command line tool (LWK_CLI)</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#see-what-lwk-is-capable-of-by-using-the-command-line-tool-lwk_cli\"></a><p></p>\n<p>All LWK functions are exposed via a local JSON-RPC server that communicates with a CLI tool so you can see LWK in action.</p>\n<p>This JSON-RPC Server also makes it easier to build your own frontend, GUI, or integration.</p>\n<p>If you want to see an overview of LWK and a demo with the CLI tool check out this <a target=\"_blank\" href=\"https://community.liquid.net/c/videos/demo-liquid-wallet-kit-lwk\">video</a></p>\n<p></p><h3>Installing LWK_CLI from crates.io</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#installing-lwk_cli-from-cratesio\"></a><p></p>\n<p>or if you want to connect Jade over serial:</p>\n<div><pre>$ cargo install lwk_cli --features serial</pre></div>\n<p></p><h3>Building LWK_CLI from source</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#building-lwk_cli-from-source\"></a><p></p>\n<p>First you need <a target=\"_blank\" href=\"https://www.rust-lang.org/tools/install\">rust</a>, our MSRV is 1.75.0\nthen you can build from source:</p>\n<div><pre>$ git clone [email protected]:Blockstream/lwk.git\n$ <span>cd</span> lwk\n$ cargo install --path ./lwk_cli/</pre></div>\n<p>Or</p>\n<div><pre><code>$ cargo install --path ./lwk_cli/ --features serial\n</code></pre></div>\n<p>To enable connection with Jade over serial.</p>\n<p></p><h2>Using LWK_CLI</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#using-lwk_cli\"></a><p></p>\n<p>Help will show available commands:</p>\n<p>Start the rpc server (default in Liquid Testnet)\nand put it in background</p>\n<p>Every command requires the server running so open a new shell to run the client.</p>\n<p>Create new BIP39 mnemonic for a software signer</p>\n<div><pre>$ lwk_cli signer generate</pre></div>\n<p>Load a software <em>signer</em> named <code>sw</code> from a given BIP39 mnemonic</p>\n<div><pre>$ lwk_cli signer load-software --signer sw --persist <span>false</span> --mnemonic <span><span>\"</span>abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about<span>\"</span></span></pre></div>\n<p>Create a p2wpkh <em>wallet</em> named <code>ss</code> (install <a target=\"_blank\" href=\"https://github.com/jqlang/jq\"><code>jq</code></a> or extract the descriptor manually)</p>\n<div><pre>$ DESC=<span><span>$(</span>lwk_cli signer singlesig-desc -signer sw --descriptor-blinding-key slip77 --kind wpkh <span>|</span> jq -r .descriptor<span>)</span></span>\n$ lwk_cli wallet load --wallet ss -d <span>$DESC</span></pre></div>\n<p>Get the wallet balance</p>\n<div><pre>$ lwk_cli wallet balance -w ss</pre></div>\n<p>If you have a Jade, you can plug it in and use it to create a\nwallet and sign its transactions.</p>\n<p>Probe connected Jades and prompt user to unlock it to get identifiers needed to load Jade on LWK</p>\n<p>Load Jade using returned ID</p>\n<div><pre>$ lwk_cli signer load-jade --signer <span>&lt;</span>SET_A_NAME_FOR_THIS_JADE<span>&gt;</span> --id <span>&lt;</span>ID<span>&gt;</span></pre></div>\n<p>Get xpub from loaded Jade</p>\n<div><pre>$ lwk_cli signer xpub --signer <span>&lt;</span>NAME_OF_THIS_JADE<span>&gt;</span> --kind <span>&lt;</span>bip84, bip49 or bip<span>87&gt;</span></pre></div>\n<p>When you're done, stop the rpc server.</p>\n<p></p><h2>Tests</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#tests\"></a><p></p>\n<p>Run unit tests:</p>\n<p>End-to-end tests need some local servers:</p>\n<div><pre><code>./context/download_bins.sh # needed once unless server binaries changes\n. .envrc # not needed if you use direnv and you executed `direnv allow`\n</code></pre></div>\n<p>And also the following docker images:</p>\n<div><pre><code>docker pull xenoky/local-jade-emulator:1.0.27\ndocker pull tulipan81/blind_pin_server:v0.0.7\n</code></pre></div>\n<p>Note: Failed test executions can leave docker containers running. To stop all running containers run:</p>\n<div><pre><code>docker stop $(docker ps -a -q)\n</code></pre></div>\n<p>To run end-to-end tests:</p>\n<p>To see log outputs use <code>RUST_LOG</code> for example</p>\n<div><pre><code>RUST_LOG=info cargo test -- test_name\nRUST_LOG=jade=debug cargo test -- test_name # filter only on specific module\n</code></pre></div>\n<p></p><h3>Test with a physical Jade</h3><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#test-with-a-physical-jade\"></a><p></p>\n<p>Tests using Jade over serial (via USB cable) need an additional dependency:</p>\n<div><pre><code>apt install -y libudev-dev\n</code></pre></div>\n<p>These serial tests cannot be executed in parallel, so we need the <code>--test-threads 1</code> flag.</p>\n<div><pre><code>cargo test -p lwk_jade --features serial -- serial --include-ignored --test-threads 1\ncargo test -p lwk_wollet --features serial -- serial --include-ignored --test-threads 1\n</code></pre></div>\n<p></p><h2>Docs</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#docs\"></a><p></p>\n<p>To generate documentation you can use</p>\n<div><pre><code>RUSTDOCFLAGS=\"--cfg docsrs\" cargo +nightly doc --all-features --no-deps --open\n</code></pre></div>\n<p></p><h2>Nix</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#nix\"></a><p></p>\n<p>We provide a flake for a dev environment and for running the <code>lwk_cli</code>.\nIf you use direnv and allow the <code>.envrc</code> the dev environment is automatically loaded\nas soon as you enter the directory, otherwise you can run:</p>\n<p>To run <code>lwk_cli</code> on nix-enabled system:</p>\n<div><pre><code>nix run github:blockstream/lwk\n</code></pre></div>\n<p></p><h2>History</h2><a target=\"_blank\" href=\"https://github.com/Blockstream/lwk#history\"></a><p></p>\n<p>BEWallet was <a target=\"_blank\" href=\"https://github.com/LeoComandini/BEWallet/\">originally</a>\nan Elements/Liquid wallet library written in Rust to develop\nprototypes and experiments.</p>\n<p>BEWallet was based on <a target=\"_blank\" href=\"https://github.com/Blockstream/gdk\">Blockstream's GDK</a>.\nEssentially some GDK Rust pieces were moved to this project.</p>\n<p>This was used as the starting point for the Liquid Wallet Kit project.\nParts that were not necessary have been dropped,\nmany things have been polished, and new features have been added.</p>\n<p>The codebase has been entirely re-written, and now it has\nalmost no similarity with the original code.</p>\n</article></div>",
"author": "",
"favicon": "https://github.githubassets.com/favicons/favicon.svg",
"source": "github.com",
"published": "",
"ttr": 284,
"type": "object"
}