How to build your Lightning node?

Kevin Nigg
Ledgerlabs-li
Published in
6 min readMay 28, 2020

--

Blockchain technology promises security, immutability and censorship resistance based on a system of distributed nodes. To meet the requirements of decentralization and to prevent attacks on the network, public blockchains such as Bitcoin or Ethereum require a large number of network nodes. In the following article I show you step by step how you can use a Raspberry Pi to set up a Bitcoin full node and a Lightning node. With this setup you can contribute to the security, immutability and censorship resistance of the Bitcoin blockchain.

Deutsche Version verfügbar unter ledgerlabs.li

If you want to set up a Bitcoin or Lightning Node at home, you have different options. Meanwhile, there are several providers which offers plug-and-play solutions for your own blockchain full node at home. For our Bitcoin node I decided to assemble and set up the node myself. Based on the recommendations of Rotzoll, the process can be divided into six simple steps.

1. Order and assemble hardware

Based on the recommendations of Christian Rotzoll I have ordered the following components for our Lightning Node:

In addition to the mentioned components a RJ-45 patch cable is required. But since I still had one at home, I used that one for our RaspiBlitz. If you leave these cost out, the total costs for the hardware is roughly 230 Swiss Francs.

Figure 1: Hardware partially assembled

The assembly of the hardware components is straightforward. Because after just a few minutes the Raspberry Pi including the fan was placed in the self-assembled housing — see figure 1. Based on this, the touchscreen can be attached and the hard disk can be connected via USB 3.0. Last but not least, the power cable and the RJ-45 patch cable have to be attached before the software can be setup.

2. Setup RaspiBlitz

Before the RaspiBlitz setup can be started, the software from Christian Rotzoll must be downloaded and installed on the purchased SD card. To download the software, I decided to use the browser download and then checked it using the SHA-256 checksum to ensure the integrity. After the successful SHA-256 checksum check the image was uploaded to the SD card using balenaEtcher — a free and open-source utility used for writing image files. Afterwards the prepared SD card was inserted into the Raspberry Pi and the Raspberry Pi was started by plugging in the power supply.

3. Start the RaspiBlitz setup

To start the RaspiBlitz setup, a connection to the Raspberry Pi can be established via SSH using the command line/terminal. To do this, enter the command ssh admin@[RaspiBlitzIP] in the command line and use as password raspiblitz. Within a few seconds the connection is established and you are in the menu shown in figure 2. Since we want to create a Bitcoin node, the option “BITCOIN” must be selected using the arrow keys and then confirmed with Enter.

Figure 2: RaspiBlitz setup

In the next step the RaspiBlitz needs a name — we called ours Ledgerlabs. This alias can be used to find the node on the Lightning Network Explorer — however, you can read more about this in my next blog post. After the naming you have to choose four different passwords, which should be much stronger than the chosen alias! The passwords “Master User Password” and “Bitcoin RPC Password” belong to the Bitcoin Full Node. The other two passwords “LND Wallet Password” and “LND Seed Password” are associated with the Lightning Node. These four passwords must be written down and kept in a safe place.

4. Download the blockchain

Further on, it is required to download the Bitcoin blockchain to the hard disk connected to your Raspberry Pi. Without the previous records of the Bitcoin Blockchain the full node can not operate. As a first step, the RaspiBlitz setup formats the hard disk and asks to download the blockchain. You have to choose between three options (Sync, Copy and Torrent). I decided to use the third option ‘Torrent’, because it should be a bit faster as the first option ‘Sync’. The second option ‘Copy’ could have been used, if a copy of the blockchain on another hard disk was available. The download via ‘Torrent’ ( shown in figure 3) took about two days and therefore lasted much longer than initially expected. In retrospect, I would probably have chosen the option ‘Sync’.

Figure 3: Torrent status

5. Setup Lightning

Once the blockchain has been successfully downloaded, you can begin to setup the Lightning node as shown in figure 4. Since this is the first time that the setup has been started, the option ‘NEW’ has to be chosen and confirmed. You will then be asked to unlock the Lightning wallet by using the ‘LND Wallet Password’ that was previously defined. To recover your password later, the system asks to write down the 25 word recovery seed. After confirming the ‘LND Wallet Password’ again RaspiBlitz performs the final configuration and conducts a reboot.

Figure 4: Lightning setup

6. Synchronise the blockchain

With the restart of RaspiBlitz, the node is almost operational. As shown in figure 5, the alias ‘Lederlabs’ and further information such as the operating temperature is indicated on the screen. This startup is followed by an automatic synchronisation of the blockchain. In my case this process took another two days to be completed. Thus, downloading the blockchain via ‘Sync’ would save time compared to the previously chosen ‘Torrent’ variant.

Figure 5: Blockchain synchronisation

As soon as the Bitcoin blockchain synchronisation and the Lightning scanning is completed, the terminal (see figure 6) shows the window where the Sync status indicates “OK 100.00 %”. Hence, the node (Bitcoin and Lightning) is now fully operational.

Figure 6: RaspiBlitz setup succeeded

The next blog post will report about challenges that can occur while setting up RaspiBlitz and about how to use RaspiBlitz via web interface.

Sources

Rotzoll, Christian. RaspiBlitz. Retrieved January 12, 2020 from
https://github.com/rootzoll/raspiblitz

Balena. balenaEtcher. Retrieved January 13, 2020 from https://www.balena.io/etcher/

Saubyk. How To Ride The Lightning! Retrieved January 19, 2020 from
https://medium.com/@suheb__/how-to-ride-the-lightning-447af999dcd2

Disclaimer

The author of this article has no connection or relationship with any company, project or event, unless expressly stated otherwise. None of the information provided can be considered financial advice. Investments in cryptocurrencies are risky. Ledgerlabs.li is a website for independent information about blockchain technology. Neither Ledgerlabs Kranz nor the authors are responsible, directly or indirectly, for any damage or loss incurred in connection with the use of or reliance on any content you read on the website.

--

--

Kevin Nigg
Ledgerlabs-li

Test management, agile software development and cryptocurrency investments.