diff --git a/README.md b/README.md index 9d916ed6..6aeaedda 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ To run PeerSwap as a standalone daemon with LND, see the [LND setup guide](./doc To run Elements for L-BTC swaps, see the [Elements setup guide](./docs/setup_elementsd.md). +To run LWK for L-BTC swaps, see the [LWK setup guide](./docs/setup_lwk.md). + > **Note** > Most of the benefits of PeerSwap come from using L-BTC. Swaps using L-BTC are more private, faster, and avoid the mainchain blockchain during high fee environments that can make swaps uneconomical. diff --git a/docs/setup_cln.md b/docs/setup_cln.md index 1f4a5e9f..452b0511 100644 --- a/docs/setup_cln.md +++ b/docs/setup_cln.md @@ -62,6 +62,7 @@ cookiefilepath="/path/to/auth/.cookie" ## If set this will be used for authentic bitcoinswaps=true ## If set to false, BTC mainchain swaps are disabled # Liquid section +# Select either Liquid or LWK # Liquid rpc connection settings. [Liquid] rpcuser="user" @@ -71,6 +72,13 @@ rpcport=1234 rpcpasswordfile="/path/to/auth/.cookie" ## If set this will be used for authentication rpcwallet="swap-wallet" ## (default: peerswap) liquidswaps=true ## If set to false, L-BTC swaps are disabled + +# LWK section +# LWK rpc connection settings. +[LWK] +signername=signername +walletname=walletname +liquidswaps=true ## If set to false, L-BTC swaps are disabled ``` In order to check if your daemon is setup correctly run diff --git a/docs/setup_lnd.md b/docs/setup_lnd.md index 371f88ae..e0774556 100644 --- a/docs/setup_lnd.md +++ b/docs/setup_lnd.md @@ -76,6 +76,18 @@ elementsd.rpcwallet=peerswap EOF ``` +LWK BTC and L-BTC swaps config. Replace the RPC parameters as needed: +```bash +cat < ~/.peerswap/peerswap.conf +lnd.tlscertpath=/home//.lnd/tls.cert +lnd.macaroonpath=/home//.lnd/data/chain/bitcoin/mainnet/admin.macaroon +lwk.signername=signername +lwk.walletname=walletname +lwk.Network=liquid +lwk.liquidswaps=true +EOF +``` + ### Policy On first startup of the plugin a policy file will be generated (default path: `~/.peerswap/policy.conf`) in which trusted nodes will be specified. diff --git a/docs/setup_lwk.md b/docs/setup_lwk.md new file mode 100644 index 00000000..1c29edaa --- /dev/null +++ b/docs/setup_lwk.md @@ -0,0 +1,68 @@ +# Setup `lwk` + +**[Liquid Wallet Kit](https://github.com/Blockstream/lwk/tree/master)** is a collection of Rust crates for [Liquid](https://liquid.net) Wallets and is used for PeerSwap L-BTC swaps. +To set up `lwk` for PeerSwap, follow the steps here. +lwk is currently under development and changes are being made. +**peerswap has been tested only with [cli_0.3.0](https://github.com/Blockstream/lwk/tree/)**. + +## wallet +peerswap assumes a wallet with blinding-key set in singlesig to lwk. + +```sh +MNEMONIC=$(lwk_cli signer generate | jq -r .mnemonic) +lwk_cli signer load-software --mnemonic "$MNEMONIC" --signer +DESCRIPTOR=$(lwk_cli signer singlesig-desc --signer --descriptor-blinding-key slip77 --kind wpkh | jq -r .descriptor) +lwk_cli wallet load --wallet -d "$DESCRIPTOR" +``` + + +Below is an example of an appropriate descriptor. +Confidential Transactions with [SLIP-0077](https://github.com/satoshilabs/slips/blob/master/slip-0077.md), P2WPKH output with the specified xpub. +```sh +"ct(slip77(220b6575205a476aac5a8c09f497ab084c13c269a7345846e617698f9beda171),elwpkh([4cd32cc8/84h/1h/0h]tpubDDbFo41vfUWdQMSjEjYVBNgEamvzpJWWqLspuDvStJyaCXC1EKxGyvABFCbax3k5adihtmWakYokMMWV67rZMjLjSuMnHSxKmZS92gKwbNw/<0;1>/*))" +``` + +## server +peerswap uses lwk's json rpc, so you need to start lwk's server. +Follow [lwk's document](https://github.com/Blockstream/lwk) to start the server. + +```sh +lwk_cli server start +``` + +## electrum +peerswap uses [esplora-electrs](https://github.com/Blockstream/electrs) to communicate with the luqiud chain. +By default, peerswap connects to `blockstream.info:995` used by lwk, so no configuration is needed. + +If you want to use your own chain, follow the instructions in [esplora-electrs](https://github.com/Blockstream/electrs) to start Electrum JSON-RPC server. + +## config file +The following settings are available +* wallet name +* signer name +* lwk endpoint : lwk jsonrpc endpoint +* electrumEndpoint : electrum JSON-RPC serverのendpoint +* network : `liquid`、`liquid-testnet`.`"liquid-regtest` +* liquidSwaps : `true` if used + +Set up in INI (.ini) File Format for lnd and in toml format for cln + +### example +Example configuration in lnd +```sh +lwk.signername=signername +lwk.walletname=walletname +lwk.lwkendpoint=http://localhost:32110 +lwk.network=liquid +lwk.liquidswaps=true +``` + +Example configuration in cln +```sh +[LWK] +signername="signername" +walletname="walletname" +lwkendpoint="http://localhost:32110" +network="liquid" +liquidswaps=true +``` \ No newline at end of file