A Complete Beginners Guide to Installing a Lightning Node on Linux (2021 Edition)
Tags: Full Node, Linux, Lightning Network, Bitcoin, Cryptocurrency

Configuring The lnd.conf File

We’re going to create a lnd.conf file and copy everything below into it. Before we do that though, let’s cover what each setting is doing, and the changes we’ll need to make:

## LND Settings # Lets LND know to run on top of Bitcoin (as opposed to Litecoin)

bitcoin.active=true

bitcoin.mainnet =true # Lets LND know you are running Bitcoin Core (not btcd or Neutrino)

bitcoin.node=bitcoind

## Bitcoind Settings # Tells LND what User/Pass to use to RPC to the Bitcoin node

bitcoind.rpcuser=PICK-A-USERNAME

bitcoind.rpcpass=PICK-A-PASSWORD # Allows LND & Bitcoin Core to communicate via ZeroMQ

bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332

bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333 ## Zap Settings # Tells LND to listen on all of your computer's interfaces

# This could alternatively be set to your router's subnet IP

tlsextraip= 0.0.0.0 # Tells LND where to listen for RPC messages

# This could also be set to your router's subnet IP

rpclisten= 0.0.0.0 :10009

LND Settings:

These are fairly straightforward settings to explain. LND needs to know a few things before launching:

Whether it’s going to run on top of Bitcoin or Litecoin: bitcoin.active=true Whether to use the main network, or the test network:

bitcoin.mainnet=true What kind of Bitcoin client it’s going to connect to:

bitcoin.node=bitcoind

Bitcoind Settings:

LND will communicate with our Bitcoin Core node via RPC, and via ZeroMQ. Both the lnd.conf & bitcoin.conf will need to be configured for this, but we will cover editing the bitcoin.conf file after this.

The only configuration RPC needs is setting a username & password. This is unrelated to your operating system’s username & password. LND needs to know what that username & password is. Replace the text next to bitcoind.rpcuser= & bitcoind.rpcpass= with whatever you want, just make sure it’s reasonably secure.

To configure ZeroMQ, we just need to specify where to send and listen for those messages, and over what ports. No changes to the config text we’re going to copy are necessary for this.

Zap Settings:

If you’re going to install the Zap mobile wallet, you’ll need to configure LND so you can connect via LND’s gRPC interface. (This will not be the same for the Tor guide. Over Tor, Zap will use LND’s REST interface. Do not worry about this right now.)

tslextraip= allows you to set your router’s subnet IP address so LND listens for connections coming from your router. LND uses a TLS certificate to manage these connections. By default LND will create a TLS certificate that only allows connections from the same computer that LND is running on, so we need to specify where else LND should listen for connections before the TLS certificate is created.

Connections from Zap on your phone will be over the Internet, so your phone will reach your router first. Then your router will have to forward that connection to your computer running LND. Everyone’s router subnet varies, so using 0.0.0.0 lets LND listen on all possible subnets and helps keeps things simple for this tutorial. It works and you don’t need to change it, but you could.