A Complete Beginners Guide to Installing a Lightning Node on Linux (2021 Edition)

Running LND With a Bitcoin Core Full Node

Preface

Primary:

Standalone:

Table Of Contents

Introduction

1: You need to have ‘bitcoind’ installed (Bitcoin Core):

2: ‘bitcoind’ needs to be compiled with ZeroMQ:

3: This guide is designed for Debian based Linux operating systems:

4: Install directory can be changed:

5: You may want to resync Bitcoin with the configuration txindex=1:

Part 0 — For Those Who Just Want The Commands

Download & Install Go:

$ wget https://dl.google.com/go/go1.15.6.linux-amd64.tar.gz$ sudo tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz

Prep for LND Install:

$ echo "export PATH=$PATH:~/go/bin:/usr/local/go/bin" >> ~/.bashrc

Clone the LND Repository:

$ cd ~/code$ git clone https://github.com/lightningnetwork/lnd

Install LND:

$ cd ~/code/lnd$ git checkout tags/v0.12.0-beta$ make install

Part 1 — Installing ‘Go’ & LND

Downloading & Installing Go:

$ wget https://dl.google.com/go/go1.15.6.linux-amd64.tar.gz$ sha256sum go1.15.6.linux-amd64.tar.gz | awk -F " " '{ print $1 }'
3918e6cc85e7eaaa6f859f1bdbaac772e7a825b0eb423c63d3ae68b21f84b844
$ sudo tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz

Prepping & Installing LND:

$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
1: /usr/local/sbin
2: /usr/local/bin
3: /usr/sbin
4: /usr/bin
5: /sbin
6: /bin
7: /usr/games
8: /usr/local/games
9: /snap/bin
$ echo "export PATH=$PATH:~/go/bin:/usr/local/go/bin" >> ~/.bashrc
$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:~/go/bin:/usr/local/go/bin
$ cd ~/code$ git clone https://github.com/lightningnetwork/lnd
$ cd ~/code/lnd$ git checkout tags/v0.12.0-beta$ make install
Video cuts off after 60 seconds, but the install time was less than 2 minutes. This video was recorded before LND v0.12.0-beta was released.

Part 2 — Configuring LND & Syncing The Graph

Configuring The lnd.conf File

## 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:

Bitcoind Settings:

Zap Settings:

$ mkdir -p ~/.lnd && touch ~/.lnd/lnd.conf

Configuring The bitcoin.conf File

# Allows LND to connect to the Bitcoin node via an RPC user & pass
rpcuser=USE-THE-SAME-RPC-USER-CHOSEN-BEFORE
rpcpassword=USE-THE-SAME-RPC-PASS-CHOSEN-BEFORE
# Allows LND & Bitcoin Core to communicate via ZeroMQ
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

Launching Bitcoin & LND

$ bitcoind
$ lnd
We’ll use the 3rd terminal window in the next step.

Creating The Lightning Wallet

[INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to 
unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.
$ lncli create
Input wallet password:  
Confirm password:
Do you have an existing cipher seed mnemonic you want to use? (Enter y/n): n
Your cipher seed can optionally be encrypted. 
Input your passphrase if you wish to encrypt it (or press enter to proceed without a cipher seed passphrase):

Part 3 — Funding Your Wallet

Address Generation & Funding

$ lncli newaddress np2wkh
$ lncli walletbalance
$ lncli listunspent

Part 4 — Opening Channels

Picking A Node And Connecting To It

$ lncli connect 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f@34.239.230.56:9735

Opening A Channel

$ lncli openchannel --node_key=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f --local_amt=10000
$ lncli pendingchannels

Part 5 — Connecting The Zap Mobile Wallet

Installing LND Connect

$ go get -d github.com/LN-Zap/lndconnect$ cd /home/satoshi/go/src/github.com/LN-Zap/lndconnect$ make

Connecting Zap

$ cd ~$ lndconnect --image

Using Zap To Control & View Our LND Node

Port Forwarding

Enabling The UFW (Uncomplicated Firewall)

$ sudo ufw allow from 192.168.1.1/24 to any port 10009 comment 'This allows Zap to grpc to LND from the router'$ sudo ufw enable$ sudo ufw status

Testing Small Payments

Lightning Websites

Donations

Extra Guidance

How To Create A Transaction Index

$ bitcoind -reindex
$ bitcoind

How To Recompile/Update Bitcoin Core

$ bitcoind --version

How To Update LND

$ cd /home/satoshi/go/src/github.com/lightningnetwork/lnd$ git pull$ make clean && make && make install

Information Aggregator