Blogs & Articles: A Complete Beginners Guide to Installing a Lightning Node on Linux (2021 Edition) đ 3 years ago
- Category: Blogs & Articles | StopAndDecrypt on Medium
- Author(s): StopAndDecrypt
- Published: 22nd February 2021 00:00
Running LND With a Bitcoin Core Full Node
Preface
In 2018 I made a tutorial for getting a Bitcoin full node up and running on Linux, and I provided a complete step-by-step process, along with explainers for how to use & understand the bash shell, and what certain commands and their flags did. Itâs been 3 years since, itâs been fully updated here, and what youâre reading now is the new supplementary Lighting tutorial.
This tutorial is 1 of 3 being published in tandem. The primary tutorial brings the other two together to run over Tor and connect your phoneâs Bitcoin & Lightning wallets to it. The other two (which includes this one) function as standalone tutorials for both Bitcoin & Lightning respectively, and they completely break down the entire node installation process for beginners:
Primary:
Running Bitcoin & Lightning Nodes Over The Tor Network (2021 Edition)
Standalone:
- A Complete Beginners Guide to Installing a Bitcoin Full Node on Linux
- A Complete Beginners Guide to Installing a Lightning Node on Linux
Table Of Contents
- Introduction
- Part 0âââJust The Commands (For Quick Reference)
- Part 1âââInstalling âGoâ &Â LND
- Part 2âââConfiguring LND & Syncing The Graph
- Part 3âââFunding Your Wallet
- Part 4âââOpening Channels
- Part 5â Connecting The Zap Mobile Wallet
- Extra Guidance
How To Create A Transaction Index
How To Recompile/Update Bitcoin Core
How To Update LND
Introduction
If you followed my Bitcoin tutorial you can just skip straight to Part 1.
Thereâs a few requirements & assumptions this tutorial has if you are arriving here with a Bitcoin node already installed. You may use this tutorial to install Lightning (LND), butthis tutorial is meant to follow up the install process detailed in my Bitcoin tutorial. If you did not follow that process, please make note of the details below:
1: You need to have âbitcoindâ installed (Bitcoin Core):
Weâll be installing the LND implementation of the Lightning Network. LND is compatible with specific Bitcoin node backends, so you will need to have one of these installed for LND to work:
- btcd
- neutrino
- bitcoind
This tutorial requires you have bitcoind installed, also known as Bitcoin Core.
2: âbitcoindâ needs to be compiled with ZeroMQ:
If you didnât not arrive here from my Bitcoin tutorial, then itâs possible you did not have a required LND dependency when you installed Bitcoin.
Youâll need to recompile Bitcoin after you install the ZeroMQ library:
$ sudo apt-get install libzmq3-dev
Iâve provided instructions for how to do this here.
3: This guide is designed for Debian based Linux operating systems:
Iâm working with Kubuntu, which is very similar to Ubuntu, and a Debian based operating system. If youâre using a non-Debian version of Linux then you might have to work the guide a bit to suite your needs.
It also uses AMD64 architecture. There are a few steps that will need to be modified if you arenât using an AMD64 distribution. They will be made clear, but you may also need additional dependencies (that is on you).
4: Install directory can be changed:
The install directory (~/code/lnd) used in this tutorial is chosen with my Bitcoin tutorial in mind, and is meant to be friendly to Linux beginners. Feel free to change the install path at your own discretion. I do not recommend changing the default data directory (~/.lnd), it may cause issues.
5: You may want to resync Bitcoin with the configuration txindex=1:
LND performs better if your Bitcoin Core node has a âtransaction indexâ. Your bitcoin.conf file should include a line that says txindex=1. If it doesnât, thatâs fine, but you may want to consider syncing your node again with that setting on.
Iâve provided instructions for how to do this here.
Part 0âââFor Those Who Just Want The Commands
Youâll notice that this section is very short, but the tutorial is pretty long. Iâm putting these 8 commands in the beginning to demonstrate that this is all we are really doing (plus copy & pasting text into a configuration file). This tutorial is designed for beginners to Linux, so all facets of the following steps will be explained in detail, and then some.
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
Installing LND is pretty quick and simple, but LND specifically needs one more dependency installed other than the dependencies installed for Bitcoin (including the ZeroMQ one mentioned above).
Go is the programming language that LND is written in, so weâll need to install it first. Originally LND needed to be installed within the Go directory, but that is no longer necessary, along with some other steps we can fortunately skip, allowing the bulk of this tutorial to focus on using our Lightning node.
Downloading & Installing Go:
First weâre going to get the Go package from the Google URL in the command below, then weâre going to verify the SHA256 checksum against what it is supposed to be.
$ 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 }'
The output from the sha256sum command should be this:
3918e6cc85e7eaaa6f859f1bdbaac772e7a825b0eb423c63d3ae68b21f84b844
Next weâre going to install Go by extracting (âunzippingâ) the .tar.gz package we downloaded.
tar , sometimes called tarball, is a file archiving tool, and is very similar to the more familiar zip file format.
$ sudo tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz
The -C flag will instruct the tar command to place the files into the directory specified (/usr/local). The files in this archive will be within a folder named /go when extracted, so the final install path when complete will be /usr/local/go.
The -xzf flags are commonly used when extracting & installing software.
Just like there is zip (archive) and unzip (extract), the -x flag instructs tar to extract the files.
The -z flag tells the tar command that weâre working with a .tar.gz file, which is a compressed archive.
The -f flag outputs the files & directories just as described in the archive.
https://medium.com/media/7aeaf344fed7b81a6dcef9dc862dcde9/href
Prepping & Installing LND:
When we install LND, LND will need to reference the Go binaries we just installed, so the first thing weâre going to do is redefine the shellâs PATH variable.
When executing commands & scripts, they need to exist somewhere, and the where needs to be defined. The PATH variable tells the shell where to look for commands & scripts. When LND is installing, it will ask the shell something like âcan you defrost the steak I bought earlier today?â We know the steak is probably in the freezer. The shell has no idea where we installed that Go binary.
If you were to type echo $PATH the output would show you what directories are currently defined:
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Each directory is separated by a : , like so: directory1:directory2 .
So that same output can also be interpreted like this:
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
We need to add two other directories to this list.
To do this weâre going to enter the following command:
$ echo "export PATH=$PATH:~/go/bin:/usr/local/go/bin" >> ~/.bashrc
export will redefine PATH by making it equal to what it already is (that long list), plus the~/go/bin and /usr/local/go/bin directories.
echo, the way itâs being used here, will take the output of the export command inside the quotes, and then send it into (via >>) the file ~/.bashrc on a new line.
~/.bashrc is one of a few files that the shell will reference when you launch the shell. If there is ever a time in the future where you need to redefine you PATH variable, youâll want to open that file and edit the line we just added.
Go ahead and close the shell, and then open a new one so it can load the redefined PATH variable we just set.
If you were to type echo $PATH again after running that command and opening a new shell, the output would now show this:
$ 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
https://medium.com/media/1ffccf8fb2e8fadc442592d26d33e448/href
Now with the PATH variable defined, letâs move to where we want to clone the LND repository, and then clone it:
$ cd ~/code
$ git clone https://github.com/lightningnetwork/lnd
https://medium.com/media/187bcc29d46f9b6f7dea71a6630634c3/href
Finally, move into the /lnd directory created from cloning the repository, and then install LND:
$ cd ~/code/lnd
$ git checkout tags/v0.12.0-beta
$ make install
https://medium.com/media/31bea1d9ec8672e2293d9964548171b9/href
Part 2âââConfiguring LND & Syncing The Graph
In this section weâre going to create a lnd.conf file and configure LND to work the way we want it to. Then weâre going to revisit the bitcoin.conf file and modify it so LND will work with Bitcoin Core. Finally, weâre going to launch Bitcoin & Lightning, create a Lightning wallet, and allow the Lightning Graph to sync.
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.
rpclisten= tells LND where to listen for gRPC connections. After including the subnet (or in our case all subnets) above into the TLS certificate, which allows the connections from the router, we now need to specify that gRPC should listen for connections from the router, and over what port. (Weâll cover port forwarding later on.)
When we launch LND itâs going to create a hidden /.lnd folder where the nodeâs data and configurations will be placed, similar to the /.bitcoin directory.
Weâre going to create that directory in advance, along with the lnd.conf file:
$ mkdir -p ~/.lnd && touch ~/.lnd/lnd.conf
And then weâre going to paste the config text above into that file:
https://medium.com/media/35f490d2bad896270a9e95faa2af1ede/href
Configuring The bitcoin.conf File
If you followed the Bitcoin Beginners Guide, you only need to add this under the current settings in the bitcoin.conf file located in ~/.bitcoin:
# 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
Make sure to replace the bold sections above with the RPC username and password you put in the lnd.conf file.
These additions to the config file should be self explanatory if you read the previous section. Weâre just making sure both config files have the same settings.
https://medium.com/media/ded0646711c8ea7ace609a6193265ed8/href
If you did not follow that guide, your bitcoin.conf file will be located elsewhere, and you may want to consider adding txindex=1 and resyncing the blockchain, as LND will perform better.
Launching Bitcoin &Â LND
Launch Bitcoin if itâs not already running and make sure itâs fully synced. If you started the Bitcoin GUI using bitcoin-qt, go ahead and close out the application, and then relaunch Bitcoin using bitcoind. We donât need or want the GUI any longer:
$ bitcoind
Now that Bitcoin is running, wait about a minute (watch the log output) and then open a second terminal and launch LND via the following command:
$ lnd
https://medium.com/media/8c2a3b1de76fa8106e9edfbe16f47649/href
Creating The Lightning Wallet
When launching LND for the first time, youâll be prompted in the terminal to create a wallet before LND can proceed (highlighted at the end of the video above):
[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.
We need to open a new terminal to enter the command for creating a new wallet (video below). So go ahead and open a new terminal, then enter:
$ lncli create
When creating the wallet weâll be prompted for a few different things:
1: Create a password for the wallet file:
Input wallet password:
Confirm password:
2: Do you have a seed phrase you want to import? (We will choose ânâ for no.):
Do you have an existing cipher seed mnemonic you want to use? (Enter y/n): n
3: Encrypt the wallet seed with a passphrase (also known as a 25th word):
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):
Whatever you decide to do, write all of this down and keep it safe.
https://medium.com/media/b857c613164676c0615965ea1ab12030/href
After the wallet is created weâll see more output from the terminal running LND. It will begin finding other Lighting Network peers and gathering node & channel information. You now have a Lightning node!
Part 3âââFunding Your Wallet
With our Lightning node up and running, and the wallet created, the first thing weâre going to do is generate an address so we can send some Bitcoin to it. LND doesnât have a GUI, so this will all be through the terminal. Later on the Zap wallet will function as our GUI.
Address Generation &Â Funding
To generate an address enter the following into a terminal:
$ lncli newaddress np2wkh
(If you want to generate a native Segwit address, use p2wkh instead.)
All you need to do now is send Bitcoin to that address. For the purposes of this tutorial Iâm going to send 0.0015Â BTC.
If youâre using a mobile phone to send the Bitcoin, you may find it easier to scan a QR code. If you wish to, at the cost of some privacy, paste your newly generated address into the search box on https://blockstream.info/, and it will generate a QR code for you:
Once the Bitcoin is sent, weâll need to wait for it to be confirmed into a block. This could take 30 seconds, or a day, depending on the fee that you paid, and the current network conditions.
In the meantime, we can check the confirmation status using this command:
$ lncli walletbalance
Keep checking until the âconfirmed balanceâ changes from 0, to the amount of Bitcoin that you sent. LND will display this in sats (satoshis).
When it finally confirms, you can use the following command to check for how many confirmations your transaction has, among other information:
$ lncli listunspent
Part 4âââOpening Channels
After a couple of confirmations, weâre ready to begin opening a channel. Before we do so, we need to decide what node weâre going to open a channel with first, then establish a connection with it, and finally open the channel.
Picking A Node And Connecting To It
Every node has a ânode IDâ (a public key), including ours. When we connect with that node, a secure communication line with that node will be established, which will then allow us to securely create a channel with that node. For the purposes of this tutorial Iâm going to connect to ACINQâs Lightning node. You can choose any node you would like, although for your first channel youâll want to pick a node with decent liquidity. ACINQâs public key, IP address, and port number can be found on LN browser sites like 1ml.com:
In the terminal, enter the following (all one string),
$ lncli connect 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f@34.239.230.56:9735
The command format above is [PublicKey] @ [IPAddress]Â : [Port] without any spaces or brackets. After entering the command, as seen in the picture below, the LND logs will show you that the connection was established (if successful).
Opening AÂ Channel
Once the connection is established, to open the channel weâll need to use the command lncli openchannel, but it will require us to specify what node, and the amount. This will be done using the flags --node_key= & --local_amt=.
The following command it what IÂ used:
$ lncli openchannel --node_key=03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f --local_amt=10000
When opening a channel, the amount that we enter will specify how large the channel will be, and it will not include the fees required to open that channel. Therefor we cannot use all of the satoshis we just sent to the LN node. The video below will demonstrate the error we receive if we try to:
https://medium.com/media/2597f1d869123407bd92ea57bc7f3892/href
Instead, use a smaller amount than the total when opening the channel:
After opening the channel and receiving the transaction ID, we can use LND to check the status via this command:
$ lncli pendingchannels
The LN requires a channelâs transaction to have 3 confirmations before it can be used. When the channel is finally confirmed 3 times it is considered opened, and the output from lncli pendingchannels will look like this instead:
Now that the channel is finally opened, we can begin making payments. You have a functional non-routing LN node. Payments can be made using LND directly, but now weâre going to connect LND to the Zap wallet and use Zapâs interface instead.
Part 5âââConnecting The Zap Mobile Wallet
This section will guide you through connecting the Zap mobile wallet for iOS with our LND node. You may also use the desktop version of Zap if youâd like. First we will need to install LND Connect, which is a small piece of software that will generate a QR code we will use to connect our Zap wallet to LND. After we scan the QR code Zap will be connected over the local network, so if you you are using Zap over WiFi at home youâll be able to interact with LND at this point. After that we can optionally set up port forwarding on our router, which will enable us to connect Zap to our LND node over the Internet.
Installing LNDÂ Connect
To install LND Connect, just run the following commands and make sure you replace âsatoshiâ with your username:
$ go get -d github.com/LN-Zap/lndconnect
$ cd /home/satoshi/go/src/github.com/LN-Zap/lndconnect
$ make
https://medium.com/media/c1d7577fe40476b04bb1c34c447f6f47/href
Connecting Zap
Zap can be found on the iOS store. Just download it, launch it, and put it to the side for now. Alternatively you can download the desktop version and follow the same steps with a little bit of intuition.
With LND running, in a terminal enter the following:
$ cd ~
$ lndconnect --image
This will create a QR code image in your home directory with the name lndconnect-qr.png. From your file browser open the image, and then scan it using Zap:
Once itâs scanned Zap will attempt to connect to your node, and if successful you should see a screen showing your nodeâs current balance:
At this point you may consider the tutorial complete. If Zap cannot connect, you either need to review the LND configuration settings we made earlier.
Using Zap To Control & View Our LNDÂ Node
Once Zap connects youâll be displayed with a Send/Receive screen that shows our nodeâs total balance, which includes the send capacity of all our channels and whatever remaining Bitcoin we have in our wallet that isnât currently in a channel.
From the Send/Receive screen, swipe right and then select the Channels menu:
This will display your current channels, their individual capacity, and how they are balanced. Since all we did so far was open a channel, our channel should only have capacity to send payments, like so:
Once you start making payments, youâll then be able to receive payments as well, and this will be represented like so:
You can also open channels by clicking the + sign at the top right, and close channels by click on the one you want to close and then clicking âClose Channelâ:
Port Forwarding
This section is going to require a little bit of intuition. The main reason for this is everyone has a different brand of router, and I wonât be able to guide you through your routerâs settings.
If you donât know what port forwarding is watch this video. Essentially, when our Zap wallet from our phone tries to connect to LND using our IP address, it will reach our router, not our computer. We need to tell our router to send the data to our computer running LND.
When you do get to the routerâs port settings, hereâs the information youâll need:
- External Port:Â 10009
- Internal Port:Â 10009
- Internal Host/IP: <Your-Computers-Local-IP>
- Protocol: TCP
To access our router, we simply need to type in the routerâs address into our web browser. Since weâre on Linux, we can find that address by opening a terminal and typing route -n, and then looking for the âGatewayâ column:
The output from this command can be a bit messy, depending on your setup. Youâll want to look for an address that isnât 0.0.0.0 in the Gateway column, and then paste that into your web browser. My routerâs address is 192.168.1.1, which is a pretty common one used by many routers. Another common address is 192.168.0.1. Alternatively you can Google your routerâs brand to try and find out what the address is.
Once you are able to access your routerâs login page, youâll also need to Google the default username & password for that router. Many of them have both the user & password set to âadminâ &Â âadminâ.
After logging in, your router should show you all the devices connected to it. Since my laptopâs device name is nakamoto, I can easily identify it in the router settings, and see the IP address associated with your device. Thatâs the local IPÂ address.
Navigate to the port forwarding section of your routers interface and input the required information. Iâm not going to be able to guide you any further than this. Youâll need to find instructions for you router if itâs unclear.
Enabling The UFW (Uncomplicated Firewall)
Port forwarding tells your router to allow connections over the Internet to get routed to a specified port on your computer, in our case: port 10009.
Depending on your Linux setup, you may need to tell the computer to allow connections on that port from your router. You may also just want to enable a simple firewall for security, and then open port 10009 for Zap.
To enable the UFW and then allow the UFW to listen on 10009 from the router, enter the following (replace 192.168.1.1 with your routerâs address we obtained from the port forwarding section above):
$ 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
With the UFW enabled, in the future if you decide to run any other clients, services, or applications that interact over your LAN, you may need to manually perform the ufw allow step for other ports. Just keep that in mind.
Testing Small Payments
Once you have a channel, making payments on the LN is very easy. Wherever you go to pay, a LN âinvoiceâ will be provided to you, and you just scan or copy it to your wallet by clicking on the âSendâ button. This section will simply provide you with a list of places you can make some test payments.
Lightning Websites
The following websites are interesting/unique ways you can interact with Lightning. These are not endorsements of these concepts at scale, or the kind of value they actually provide to the network. Theyâre just interesting ways you can test payments:
https://satoshis.place/ letâs you draw on a public wall and pay via Lightning.
https://pollofeed.com/ has a live stream of chickens that you can feed.
https://yalls.org/ lets you read posts for a small payment.
Donations
Alternatively you can make a small donation to the Human Rights Foundation over Lightning:
Donate Bitcoin - Human Rights Foundation
Extra Guidance
In the future you may want to upgrade your Lightning node, or you may need to resync Bitcoin Core for this tutorial because you didnât have the transaction index (txindex=1) that LND uses for performance, or you may need to recompile Bitcoin Core because you didnât have thelibzmq3-dev dependencyrequired for LND.The steps below will help you for these scenarios.
How To Create A Transaction Index
If you donât have a transaction index, youâll need your node to create one before running LND. If you didnât have txindex=1 in your bitcoin.conf file then you donât have a transaction index. Thereâs two scenarios for creating one:
- Your node is pruned, with no txindex.
- Your node is not pruned, with no txindex.
The first thing you want to do for both scenarios is follow the bitcoin.conf steps in this tutorial and make sure you have txindex=1 set in the config file. When that is complete, follow the proper steps below:
If your node is pruned: Start bitcoind with a reindex and let it resync the whole blockchain:
$ bitcoind -reindex
If your node is not pruned: Just start bitcoind normally and let it create the txindex, now that the bitcoin.conf file has the instructions for your node:
$ bitcoind
How To Recompile/Update Bitcoin Core
Recompiling Bitcoin Core and updating Bitcore Core are essentially the same procedure. Weâre going to delete or rename the Bitcoin install directory, and then just reinstall Bitcoin all over again with the newer version.
We do not need to:
- re-sync or re-validate the blockchain
- create the bitcoin.conf file again
- re-install any packages or dependencies (unless youâre specifically recompiling because you did not have libzmq3-dev installed, then you would want to install that package first, then recompile Bitcoin Core)
If you followed this tutorial, the install directory is ~/code/bitcoin The non-hidden folder.
If you did not follow this tutorial, the install directory may be ~/bitcoin.
In contrast, the data directory is the hidden folder with the period before the word bitcoin: ~/.bitcoin . Do not delete this folder. Leaving this alone will prevent you from having to re-sync or re-validate the blockchain. Your bitcoin.conf file is there, along with your list of peers, among other things.
If youâre running and old Bitcoin client and want to follow this tutorial, I recommend renaming the install directory to something like âbitcoin-oldâ, and then just follow the steps from the beginning.
You can double check your client version running this command:
$ bitcoind --version
How To Update LND
To update LND, open a terminal and enter the following commands.
- Replace satoshi with your username.
- If you followed this tutorial, Go should be installed in your home directory. If not, replace /home/satoshi/go with wherever you have Go installed.
$ cd /home/satoshi/go/src/github.com/lightningnetwork/lnd
$ git pull
$ make clean && make && make install