elementsd is the daemon used to sync and verify the Liquid Network and is used for PeerSwap L-BTC swaps. To set up elementsd for PeerSwap, follow the steps here.
Important
Musl-based Linux distributions such as Alpine Linux require manually building elementsd with additional compile-time flags to account for musl's different stack size.
To compile elementsd from source, follow the documentation for Linux.
If you would rather just download the binary instead, skip to the next section.
Download the elementsd binary release here.
Important
Liquid mainnet L-BTC swaps require Elements 23.3.1 or newer. Elements 23.3.3 is the recommended stable release. The ELIP 203 Liquid mainnet hard fork is active, and older elementsd versions cannot follow the post-fork chain. You can find current binaries on the Elements releases page.
Extract the archive
tar xvf elements-*.tar.gz
Copy the binaries to your PATH
cp elements*/elementsd elements*/elements-cli /usr/local/bin
Confirm the installed version:
elements-cli --version
For Liquid mainnet, confirm that your node follows the post-fork chain tip:
elements-cli -chain=liquidv1 getblockchaininfo
Check that blocks is close to headers and that verificationprogress shows the node is synced. If blocks stops advancing on Liquid mainnet, upgrade elementsd before using L-BTC swaps.
Note ELIP 201 is not the Liquid hard fork that requires the
elementsdupgrade. The consensus-affecting hard fork is ELIP 203.
The default data directory for elementsd is located in the home directory:
~/.elements
The config file is not created automatically. If one is created it should be placed inside the data directory as such:
~/.elements/elements.conf
If running elementsd as the same user as PeerSwap, then configuration is not needed.
Otherwise, you need to set the rpcport, rpcuser, rpcpassword, and other config options depending on how you're deploying, in both elements.conf and peerswap.conf.
More details:
Note
It's recommended to addtrim_headers=1to the config file to reduce RAM usage by roughly 50%. However, this will also mean your node cannot help other nodes sync Liquid Network headers. This mode is not appropriate for "infrastructure" nodes which need to provide support for IBD or block/transaction propagation.
PeerSwap will automatically create a wallet if running as the same user as elementsd.
This elementsd wallet, used for L-BTC transfers and swaps, is located here for mainnet:
~/.elements/liquidv1/wallets/peerswap/wallet.dat
For Liquid testnet, it is located here:
~/.elements/liquidtestnet/wallets/peerswap/wallet.dat
The elementsd wallet is normally automatically controlled by the PeerSwap plugin or standalone daemon (LND) when doing swaps. No user input is required.
However, if you need to manually use the elementsd wallet, such as to swap with Boltz, you can use the elements-cli utility:
Make sure the peerswap wallet is loaded first:
elements-cli loadwallet peerswap
To create a new Liquid receiving address:
elements-cli -rpcwallet=peerswap getnewaddress
To send L-BTC to a Liquid address:
elements-cli -rpcwallet=peerswap sendtoaddress [address] [amount in decimal form, e.g. 0.1 for 0.10000000 L-BTC]