🛠️Get Started
Learn how to install LND on your machine, configure it and keep it up to date.
The Lightning Network Daemon is a full implementation of a Lightning Network node. The Lightning Network and its specification are rapidly evolving, and so is LND. Use this guide to install LND from the binaries, source or docker and keep it up to date with new releases.
Prerequisites
Operating system: LND runs on Windows or Mac OS X, but Unix operating systems are recommended, while Debian/Ubuntu is used for the examples below. A 64-bit architecture is required due to files growing larger than 2GB.
Machine: LND requires at minimum 2GB RAM and a 1 GHz quad core with at least 5GB of storage. LND makes frequent reads and writes, meaning you should not use a SD card, but instead a SSD of good quality.
Bitcoin: LND does not require a Bitcoin backend as you may run your node in Neutrino mode. For performance reasons it is recommended to run either Bitcoin Core or btcd on the same machine or on a machine on the same network. You may prune your Bitcoin node, though doing so aggressively may impact performance. To make use of LND’s taproot functionalities you must run at least bitcoind v0.21 or btcd v0.23.1.
Part 1: Installation
Install from the binaries (recommended)
Install via third-party platforms
Binaries
If you are a regular user and intend to use LND in production, we recommend using the binaries.
Download: You can find up-to-date releases of binaries for various operating systems and architectures here.
Verification: Each release is signed by multiple developers. You may find their keys in the LND repository here. Import these keys and verify the signatures.
gpg –import key.asc
gpg --verify manifest-beta.sig manifest-beta.txt
Lastly, you will compare the hash of the .tar.gz file with the hash listed in the manifest.
sha256sum lnd.tar.gz
Unpack: Unpack the compressed tarball to retrieve the binaries.
tar -xvf lnd.tar.gz
Installation: To install the binaries, simply place the files in your path where your operating system can find it, or add the directory containing the binary to your path.
Type $PATH
to see your current path directories.
$PATH
mv lnd /usr/local/bin
Congratulations, you have successfully installed LND using the binary release. Jump to Configuring LND. Additionally, you may use this sample file to configure LND to run with systemd.
From source
Install go:
Installing LND from source is recommended when using it in development or on testnet. To install LND from source, you will need Go version 1.18 or higher.
You can find the latest version of Golang on its official website. Make sure to verify the checksum before you install Go.
sudo tar -C /usr/local -xzf go[version].linux-[platform].tar.gz
To permanently include this new directory in your path, add the following lines to your .bashrc
file and open a new terminal window to activate it.
export PATH=$PATH:/usr/local/go/bin
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
Install LND:
We can install lnd with the following commands. Starting with lnd 0.15 all important subsystems are built by default and no longer have to be manually specified.
git clone https://github.com/lightningnetwork/lnd
cd lnd
git checkout <most recent version>
make install
LND is now installed from source.
Included subsystems: autopilotrpc, signrpc, walletrpc, chainrpc, invoicesrpc, neutrinorpc, routerrpc, watchtowerrpc, monitoring, peersrpc, kvdb_postrgres, kvdb_etcd
Congratulations, you have successfully installed LND using the binary release. Jump to Configuring LND. Additionally, you may use this sample file to configure LND to run with systemd.
Using docker
For those familiar with Docker, or those interested in easily running a variety of software alongside each other, the Docker installation is a convenient and quick way to get started with lightning.
To install LND via Docker you will need docker, make and bash on your system. You can install lnd with the following commands:
git clone https://github.com/lightningnetwork/lnd
cd lnd
git checkout <latest-release>
make docker-release tag=<latest-release>
You are now able to find the images in the directory /lnd
for your use. Congratulations, you have successfully installed LND using the docker. Jump to Configuring LND.
Installing LND using third-party scripts
You can install LND inside a variety of third-party software, such as BTCPay Server, RaspbiBlitz, myNode or Umbrel. This might become your installation of choice if you want to use Lightning payments primarily to receive payments in commerce, or if you want to easily run LND along with a variety of other software that leverage your Bitcoin user experience as an individual user.
Part 2: Configuration
Configuring Bitcoin
You may prune your Bitcoin backend. As LND will then need to fetch some blocks elsewhere, aggressive pruning can lead to performance loss.
Neutrino: If you are running LND with Neutrino as a backend, you may skip this section. You may also be interested in how to configure your Bitcoin node to serve blocks to light clients in the broader network.
Bitcoind:
Most importantly, your Bitcoin Core node needs to have RPC enabled, either through rpcauth
or with a username and password. The following entries refer to your bitcoin.conf
file. Here you find instructions on how to create an up to date sample configuration file for Bitcoin Core.
rpcauth=[user]:[password hash]
OR
rpcuser=[any username]
rpcpassword=[any unique password of your choosing]
To get the latest block data, you should enable ZMQ. The experimental “rpcpolling” option can make ZMQ obsolete, making it possible to set up multiple LND nodes per Bitcoind backend, or multiple Bitcoind backends for one or multiple LND using a load balancer.
If your Bitcoin Core and LND nodes are not running on the same machine, you will need to be aware of the relevant IP addresses.
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
When running a full, unpruned Bitcoin node you may set the following flag for small performance improvements:
txindex=1
Btcd: Your btcd backend needs RPC enabled.
rpcuser=[any username]
rpcpass=[any unique password of your choosing]
Configuring LND
You can find your lnd.conf file in ~/.lnd
in Linux, ~/Library/Application Support/Lnd
in Mac OS X and $LOCALAPPDATA/Lnd
in Windows. You can find a sample lnd.conf
here.
You will need to specify in this configuration file which backend you prefer to use and how your node should connect to it.
General configuration:
bitcoin.mainnet=true
Neutrino:
bitcoin.node=neutrino
feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
Bitcoind:
bitcoin.node=bitcoind
bitcoind.rpcuser=[any username]
bitcoind.rpcpass=[any unique password of your choosing]
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
If you have chosen to omit ZMQ in your bitcoind configuration file, you will have to set the following in lnd instead:
bitcoind.rpcpolling
Btcd:
bitcoin.node=btcd
btcd.rpcuser=[any username]
btcd.rpcpass=[any unique password of your choosing]
btcd.rpccert=
Recommended configuration
To make use of Autofees and LND Accounts, the RPC Middleware interceptor needs to be enabled. This can be done by adding the following to the configuration file:
rpcmiddleware.enable=true
Popular configuration
The following settings are popular settings for LND:
db.bolt.auto-compact=true
alias=<choose a name for your node>
Additionally, you may have a look at the
guides “Optimal configuration for a routing node” and “Tor setup.”
Run LND
Now that we have LND installed and configured with its Bitcoin backend we may start it for the first time.
We may start lnd by simply using the command lnd
. Depending on our installation, we might have to specify the location or add it to our path.
lnd
While LND, the Lightning Network Daemon will run in the background, we will use lncli (LND Command Line Interface) to interact with it. lncli will pass our commands to lnd and return useful information back to us.
lncli
Part 3: Upgrade LND
It is recommended to upgrade to the latest release whenever it becomes available. If you miss a release, it is generally recommended to upgrade directly to the latest version.
Upgrade using the binaries (recommended)
Using the binaries
If you are running the LND binary, you may download, verify and unpack LND in the same way as during the installation. You can download the latest releases for various operating systems here.
You can then gracefully shut down LND with the command lncli stop
. This may take a minute.
Now move the binaries to the directory of your existing LND, overwriting the previous binary.
You can now start LND again, unlock the wallet and verify you are using the correct version with lncli version
.
From source
You can gracefully shut down LND with the command lncli stop
. This may take a minute.
Then navigate to your local copy of the LND github repository and pull from it before installing the latest version of LND.
git pull
git checkout <latest release>
make clean && make && make install
You can now start LND again, unlock the wallet and verify you are using the correct version with lncli version
.
Using docker
If you are running LND in a docker container, you can upgrade this container as follows. Don’t forget to gracefully shut down LND with the command lncli stop
before the upgrade. This may take a minute.
First navigate to the local copy of the lnd github repository. Then execute the following commands:
git pull
git checkout <latest release>
make docker-release tag=<latest release>
You can now start lnd again, unlock the wallet and verify you are using the correct version with lncli version
.
Last updated