Skip to content

Commit

Permalink
doc: add LWK setup guide
Browse files Browse the repository at this point in the history
The doc introduce configuration instructions
for a new wallet kit (LWK) to support L-BTC swaps,
providing users with additional options
and flexibility for their swap setups.
  • Loading branch information
YusukeShimizu committed May 1, 2024
1 parent 5f30634 commit c4958ba
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions docs/setup_cln.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions docs/setup_lnd.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ elementsd.rpcwallet=peerswap
EOF
```

LWK BTC and L-BTC swaps config. Replace the RPC parameters as needed:
```bash
cat <<EOF > ~/.peerswap/peerswap.conf
lnd.tlscertpath=/home/<username>/.lnd/tls.cert
lnd.macaroonpath=/home/<username>/.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.
Expand Down
68 changes: 68 additions & 0 deletions docs/setup_lwk.md
Original file line number Diff line number Diff line change
@@ -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 <signer_name>
DESCRIPTOR=$(lwk_cli signer singlesig-desc --signer <signer_name> --descriptor-blinding-key slip77 --kind wpkh | jq -r .descriptor)
lwk_cli wallet load --wallet <wallet_name> -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
```

0 comments on commit c4958ba

Please sign in to comment.