This guide walks through the steps necessary to setup the PeerSwap standalone daemon with LND for mainnet Bitcoin and Liquid swaps.
PeerSwap requires LND.
For L-BTC swaps, an elementsd installation is required. To setup elementsd for PeerSwap, check our guide.
Install golang from https://golang.org/doc/install
Clone the repository and build PeerSwap
git clone https://github.com/ElementsProject/peerswap.git && \
cd peerswap && \
make lnd-releaseThis will install peerswapd and pscli to your GOPATH
In order to get PeerSwap running we need a configuration
mkdir -p ~/.peerswapAdd 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>
BTC 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
EOFBTC and L-BTC 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 # the http:// is mandatory
elementsd.rpcport=<REPLACE_ME>
elementsd.rpcwallet=peerswap
elementsd.liquidswaps=true # set to false to manually disable L-BTC swaps
EOFL-BTC only config.
cat <<EOF > ~/.peerswap/peerswap.conf
bitcoinswaps=false # disables BTC swaps
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 # the http:// is mandatory
elementsd.rpcport=<REPLACE_ME>
elementsd.rpcwallet=peerswap
EOFLWK BTC and L-BTC 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
lwk.signername=signername
lwk.walletname=walletname
lwk.Network=liquid
lwk.liquidswaps=true
EOFOn 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 theaccept_all_peers=truepolicy to ignore the allowlist and allow all peers with direct channels to send swap requests.
Start the PeerSwap daemon in background:
peerswapdIn order to check if your daemon is setup correctly run
pscli reloadpolicy