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
cargo install lwk_cli
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.91.0 then you can build from source:
git clone git@github.com: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:
lwk_cli --help
The top-level command groups and their subcommands are:
| Group | Subcommands |
|---|---|
server | start, scan, stop |
signer | generate, jade-id, load-software, load-jade, load-external, details, unload, list, sign, singlesig-desc, xpub, derive-bip85, register-multisig |
wallet | load, unload, list, address, balance, send, drain, issue, reissue, burn, multisig-desc, broadcast, details, combine, pset-details, utxos, txs, tx, tx-details, set-tx-memo, set-addr-memo, dump-unblinded |
liquidex | make, take, to-proposal |
asset | contract, details, list, insert, remove, from-registry, publish |
amp2 | descriptor, register, cosign |
schema | request, response |
Run lwk_cli <group> --help for arguments and descriptions for a group.
Start the rpc server (default in Liquid Testnet) and put it in background
lwk_cli server start
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
lwk_cli signer jade-id
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.
lwk_cli server stop