This guide walks through the steps necessary to setup peerswap plugin with lnd.
Peerswap requires LND and if liquid should be used also a liquid installation.
Install golang from https://golang.org/doc/install
Clone the peerswap repository and build the peerswap plugin
git clone https://github.com/ElementsProject/peerswap.git && \
cd peerswap && \
make lnd-release
This will install peerswapd
and pscli
to your go path
In order to get peerswap running we need a configuration
mkdir -p ~/.peerswap
Add config file. Replace the paths to the tls certificate and macaroon file.
For every peer you want to allow swaps with add a line with allowlisted_peers=<REPLACE_WITH_PUBKEY_OF_PEER>
Bitcoin-swaps only config
cat <<EOF > ~/.peerswap/peerswap.conf
lnd.tlscertpath=/home/<username>/.lnd/tls.cert
lnd.macaroonpath=/home/<username>/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
EOF
Liquid-swaps Config. Replace the rpc parameters as needed
cat <<EOF > ~/.peerswap/peerswap.conf
lnd.tlscertpath=/home/<username>/.lnd/tls.cert
lnd.macaroonpath=/home/<username>/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
elementsd.rpcuser=<REPLACE_ME>
elementsd.rpcpass=<REPLACE_ME>
elementsd.rpchost=http://127.0.0.1
elementsd.rpcport=<REPLACE_ME>
elementsd.rpcwallet=peerswap
EOF
On first startup of the plugin a policy file will be generated (default path: ~/.peerswap/policy.conf
) in which trusted nodes will be specified.
This can be done manually by adding a line with allowlisted_peers=<REPLACE_WITH_PUBKEY_OF_PEER>
or with pscli addpeer <PUBKEY>
.
WARNING: One could set the accept_all_peers=true
policy to ignore the allowlist and allow all peers with direct channels to send swap requests.
start the peerswap daemon in background:
peerswapd
In order to check if your daemon is setup correctly run
pscli reloadpolicy