A-Z of building your own Bitcoin Lightning Network Node that never Sleeps!

Chimezie Chuta
26 min readMay 14, 2020

--

This project targets people who are interested in learning more about bitcoin and how it can help in creating a more decentralized and equitable world. Being financially sovereign has become a necessity and bitcoin offers the primary tool to attain that. The main point of this project, just like the RaspiBlitz project’s vision, is to educate and train capable node operators across Africa, who then can help their small communities maintain “friends and family node” in other to secure a healthy financial future for them.

According to The World Bank, 1 in 3 persons in Africa still lack access to electricity. This lack of regular electricity has denied most Bitcoin enthusiasts in the continent opportunity to participate in the global bitcoin multi-billion dollar industry as miners or routing node operators. By integrating affordable solar power kit into the equation, we expect that many more people across the world can participate and make a better decentralized financial future accessible to the majority.

A bit of History

The debate around Bitcoin scaling problems and arguments for the increase of the block size above 1MB began far back with appeals from developers like Gavin Andresen, Jeff Garzik, and Mike Hearn in 2011. They anticipated a time when the rate of transactions of the protocol would exceed the available space in blocks and sought to increase the block size limit — a change that might seem straightforward. The block size (1MB) was initially put in place to limit the possibility of someone cheaply spamming the network with non-essential content. At that time, sending a large number of transactions was cheap, and it would have been possible to crowd out other transactions for a small investment.

Remember Segwit2x, BU and others.

At some point, some Chinese miners even signed a statement declaring that they want 8MB blocks! Signatories included the large mining companies F2pool, BTCChina, Antpool, Huobi, and BW.

If you have the time, read all about it here https://hackernoon.com/the-great-bitcoin-scaling-debate-a-timeline-6108081dbada

In 2014, Elizabeth Stark, CEO and Co-Founder Lightning Labs observed that while Bitcoin technology had the potential to be game-changing, no one had built the application layer yet. She promptly tweeted about it:

At the end of the debate, several forks of Bitcoin emerged. On August 1, 2017, multiple development teams forked from the legacy bitcoin chain to remove the 1-megabyte block size restriction, creating Bitcoin Cash (BCH).

On August 24, 2017, the Bitcoin Core development team forked from the legacy bitcoin chain to implement a feature called SegWit, creating Bitcoin Core (BTC). Bitcoin SV also forked at block 556766, 15 November 2018. Other forks like Bitcoin XT, Bitcoin Classic, Bitcoin Gold, Bitcoin Unlimited had occurred at different times in the history of Bitcoin.

Some are still debating on which of the forks is the REAL Bitcoin in compliance with the original vision of Satoshi Nakamoto!

Blocksize Debate — How they stood!

A Short Introduction to Lightning

Basis of Lightning Technology -BOLT

All of the different Lightning Network implementations are founded upon BOLT. The Basis of Lightning Technology aka BOLT documents, describes in detail recommendations concerning the layer-2 protocol for off-chain bitcoin transfer by mutual cooperation, relying on on-chain transactions for enforcement if necessary. It is basically a protocol for making fast payments with Bitcoin using a network of channels. Its aim is to solve the scalability, speed, and cost issues associated with Bitcoin without adopting block size increase.

Bitcoin max_block_size=1MB.

The Lightning Network is a layer 2 protocol built on top of Bitcoin. It uses cutting-edge smart contracting to achieve faster-than-VISA transaction throughput while retaining the peer-to-peer nature of the Bitcoin protocol while leveraging the security of the underlying blockchain as an arbitration layer. It implements specific types of contracts called Hashed Timelock Contracts (HTLCs) which safely directs transactions through peer to peer bidirectional payment channels using an onion-routed protocol.

Payment channels are trustless, since any attempt to defraud the current agreed-upon balance in the channel results in the complete forfeiture of funds by the liable party.

Not only does the Lightning Network enable faster, cheaper Bitcoin payments, but it also opens up a world of microtransaction use-cases that were not possible within the traditional financial system.

How the Lightning Network reduces Bitcoin transaction times and fees.

Funds are held in smart contract “payment channels,” and transactions are exchanged outside of the blockchain between transacting users. Since this process is instant, it saves users from having to wait for block confirmations before they can render goods or services. In other words, it makes bitcoin spendable cash or money.

It is the final state of the payment channel balance that can be broadcast to the Bitcoin network at any time, securely settling the funds on the blockchain.

Lightning makes secure global microtransactions a reality. New digital business models are now becoming possible because of these innovations. From the sale of digital goods to on-demand access to online services.

Ultimately, the Lightning Network enables scalable blockchains through a high-volume of instant transactions not requiring custodial delegation enabling financial sovereignty.

How it Works

Lightning works by establishing channels: two participants create a Lightning payment channel that contains some amount of bitcoin (e.g., 0.1 bitcoin) that they’ve locked up on the Bitcoin network. It is spendable only with both their signatures.

Initially, they each hold a bitcoin transaction that sends all the bitcoin (e.g. 0.1 bitcoin) back to one party. They can later sign a new bitcoin transaction that splits these funds differently, e.g. 0.09 bitcoin to one party, 0.01 bitcoin to the other, and invalidate the previous bitcoin transaction so it won’t be spent.

Hash Time-Locked Contracts (HTLCs)

Hash Time-Locked Contracts (HTLCs) allow transactions to be sent between parties who do not have a direct channel by routing it through multiple hops, so anyone connected to the Lightning Network is part of a single, interconnected global financial system.

Lightning Network Implementations

Currently, there are 3 major implementations of the Lightning Network specification. More are still in development.

  • Lightning Network Daemon (lnd) — Lightning Labs — Lightning Loop
  • c-lightning (Lightningd) — Elements Projects backed by Blockstream — Lightning Charge
  • Eclair — Scala programming language, running on JVM.

Our focus here will be on Lightning Network Daemon (lnd) by Lightning Labs. Elizabeth Stark, is the CEO and Co-Founder of Lightning Labs, while Laolu Osuntokun (roasbeef) is the CTO. He is also a Co-Founder at Lightning Labs. There are several other brilliant people working in their team.

LApps

LApps are decentralized lightning Applications developed on top of the Lightning Network Protocol.

Here are some of them;

Wallets

  • Lightning App by Lightning Labs: a cross-platform wallet powered by lnd. See the announcement for desktop and mobile for more information. Checkout the code and find the releases for desktop, Android and iOS.
  • Zap Wallet by Jack Mallers: a mobile and desktop app focused on ease of use and general user experience. Check out the Zap website or read the code on GitHub.
  • HTLC.me: Hosted wallet great for quickly trying out Lightning payments on the Bitcoin testnet.
  • ZeusLN: A mobile Bitcoin app for Lightning Network Daemon (lnd) node operators. Runs on Android and iOS.
  • Breez: Breez is a Lightning Network mobile client and a hub. It provides a platform for simple, instantaneous bitcoin payments. Supports Android and iOS.

Integrations

  • Bitrefill: Recharge prepaid phone cards with Bitcoin and Litecoin
  • Y’alls: Read and write articles, with Lightning Network micropayments.
  • LNCast: Lightning Network Podcasts
  • Bard: Simple paywall for watching a music visualizer
  • HodlHodl.com: Peer-to-peer cryptocurrency exchange with Lightning integration
  • Zigzag.io: Cryptocurrency trading using Lightning (custodial)
  • lntxbot Lightning integration to Telegram with tipping, send and receive and satellite API usage (custodial)
  • paywall.link Put any website behind a paywall and pay with Lightning

Lightning network explorers

Protocol Services

Tipping

  • LightningTip: Library to accept tips via the Lightning Network
  • Slack tipbot: Custodial Slack tipbot
  • LightningPay-PHP: PHP plugin for eCommerce website to add Pay by Lightning to accept order payments via the Lightning Network.
  • Tippin.me LN tips integrated to Twitter (custodial)
  • Lightning Gifts Create fee-less Bitcoin gift vouchers to share with friends, family, and your haters. Powered by the Lightning Network ⚡

Gaming

Eclair Lapps

Eclair is a Scala implementation of the Lightning Network built by ACINQ

c-Lightning Lapps

c-lightning is a specification-compliant LN implementation in C, under the Elements Project

Lightning Network Software Components

There are distinct software components of the lnd;

  • btcd / btcutil:lnd currently uses btcd to interface with the underlying bitcoin blockchain
  • lnd / lncli: LND serves as the main software component driving the Lightning Network. It manages a database, connects to peers, opens / closes channels, generates payment invoices, sends, forwards, and revokes payments, responds to potential breaches, and more.
  • Lncli: opens up a command-line interface for driving lnd.
  • Neutrino: is an experimental Bitcoin light client designed to support Lightning mobile clients.

Lightning Network project ecosystem comprises projects such as Joule, Raspiblitz, BTCPay Server, Ride the Lightning, Nodl, Polar, SpaceBox and many more have emerged to grow the developer community.

Bitcoin Lightning Network Node

A lightning network node is a machine running a version of the Bitcoin client. A Bitcoin client is an implementation of Bitcoin white paper. A node server or storage device stores the entire Blockchain and runs the Bitcoin client software that peruses all transaction data on the Blockchain to check if they conform to Bitcoin protocol rules.

Miners vs Node operators

Both miners and node operators act in concert to strengthen the Bitcoin network and are the main pillars on which the entire Bitcoin protocol rests. Together, they create a system immune to external manipulation, tampering, or censorship and fulfill the promise of Bitcoin.

The key difference between miners and node operators is that miners create the blocks in the blockchain which the nodes keep.

Whereas miners spend about 10 minutes working on a problem, nodes keep that result forever after in the database and verify it with others.

Miners are the actual creators of new Bitcoins.

Full-nodes have zero hash rate, while miners continuously compete for bigger hash rates.

Running a node is just listening for other nodes to pass you data, checking that it is valid, and passing it in further to others. For instance, a peer could tell you that “block 12345573 has parent x, is at height y, has transactions a,b, and c, its nonce is 73626 and its hash is a6h54fwj”.

As a node operator, your job is to constantly check that those details are valid and that the hashes line up and to also pass that data onto anyone else that might not know it yet.

But when someone is mining, they’re listening for new transactions, so some random peer will tell them “x wants to send y btc to z, here’s his signature”. And as a miner, your job is to collect a few of these, add in the other data above (parent block), and randomly append millions of possible nonces until the resulting hash follows the rules of the bitcoin network. Once you have that hash, you transmit that block back to regular node operators to further distribute around the network.

Why should you even run a Bitcoin Node?

The main reason why running a node is encouraged for all is that the more Bitcoin nodes there is out there, translates into a faster, more stable, secure, and more decentralized bitcoin network. Lightning Network nodes help to save on-chain fees, provide operator privacy, make them self-sovereign and foster network security. If you truly love Bitcoin, running a node is one way you can show that love!

Other Reasons…

1. When you run a node, it is your consensus rules that you are enforcing and protecting. So your node, your rules!

2. Running any kind of Bitcoin wallet that does not require you to run a full node means that you have to place a certain degree of trust in the service provider, something that shouldn’t be necessary with Bitcoin.

3. In the possible event of a hard fork where both blockchains remain active with economic activity on each side like the one happened on Ethereum/Ethereum-Classic, or Bitcoincash/ Bitcoin, running a full node is the only way you can validate the rules of the new or old blockchain, according to your preference. If you are not running a full node, your opinion will not be considered and you will simply follow the blockchain that is given to you.

4. Privacy!

We can’t overemphasize this one. Simplified Payment Verification aka SPV nodes that rely on bloom filters, leak considerable information about the addresses of Bitcoin users. Running your own node keeps you and your transactions very private. In today's world, privacy is a big deal.

By the way, Simplified Payment Verification aka SPV, is a Bitcoin implementation that does not verify everything, but instead relies on either connecting to a trusted node, or puts its faith in high difficulty as a proxy for proof of validity. It’s a third-party service for most wallets people use today.

5. It is not really hard to run a full bitcoin node. If I can do it, anyone can! But you have to be courageous.

6. It is not very expensive… yes, $400 is not something that is inaccessible to an average bitcoiner!

7. For people in African and other emerging economies, running a makes them stakeholders in the Bitcoin multi-billion dollar ecosystem as contributors not just consumers. This is why we formed BlockSpace Technologies Africa Inc.

8. You can make $300 in one year, hosting your own node!

Please don’t bother running a node because of reason no. 8. You won’t get rich doing it. Most unlikely…but effectively routing node transaction payments per day may or may not be particularly profitable. Over time and as the network grows, this may change somehow. Today’s node operators should not be expecting to make a lot of money doing so.

Enough said on this. But I found this interesting report by BitMex on the economics of Lightning Network routing fees. The primary focus of the report was to analyze the Lightning network from a financial and investment perspective, notably with respect to fees and the incentives for Lightning network providers. Read it here.

Ultimately, liquidity providers in the current Lightning network are not likely to be motivated by investment returns. Current node operators are mostly hobbyists, with the overwhelming majority making losses when considering the onchain fees required to open and rebalance Lightning channels. Although this hobbyist based liquidity probably can sustain the network for a while, in order to meet the ambitious scale many have for the Lightning network, investors will need to be attracted by the potential investment returns.

Preparing your hardware needed for running a node.

We are going to be building our Lightning Node with the RaspiBlitz software suite developed by the Christian Rotzoll. Its a fork of the original/official Raspberry Pi OS -Rasbian. It has been configured to run seamlessly on Raspberry pi 3 & 4. We will use Pi 4 for all of our demonstrations.

To run a Lightning node, the full Bitcoin blockchain must be stored locally, which is ~320 GB and growing. You can buy a cheap hard disk enclosure and reuse an old 500 GB hard disk. I recommend getting a modern 2.5” SSD that can be powered through the USB connection to the Pi directly, which also speeds up initial sync time significantly.

Other Bitcoin Node OS Providers (Hardware/ Software) include;

  • Casa Node
  • Nodl
  • myNode
  • LuxNode
  • BitBoxBase
  • Lightning In A Box

You can read it again before continuing.

For this project, you will need a laptop, a working internet router, and SSH tool like Putty. Pi and your laptop must be on the same network.

Basic Parts:

  • RaspberryPi 4 2–4GB
  • 1TB Hard Drive (SSD or HDD) -SSD is preferred if you can afford it!
  • Micro SD-Card 16GB
  • LCD-Display
  • Raspberry Pi Power Supply — 5V 3 Amp
  • RaspberryPi Heatsink, Case and Fan. 5V Shim Fan or 12 volts. (12v will be powered outside the Raspberry Pi via a 12V Battery)

Solar Power kit (Off-Grid)

  • 80Watt Solar Panel
  • 30 Watt Solar Charge Controler
  • 2nos. 12 V 12 AH 20hr Deep-Circle UPS Battery
  • Cables

Alternate power (Grid- generator or public Power source)

  • 1500Watt Inverter Charger

First things first.

If you can find the raspberry Shim Fan, now is the time to assemble and connect it to the GPIO pins of the Pi: detailed instructions are on this link.

I could not find a Shim Fan in my local supply shop so I improvised. Most of us have old computer CPUs at home. I hacked out three CPU fans from one of my old HP desktop CPU abandoned somewhere and that’s what am using right now. It’s working like charm! I got 36.2° C after mounting it! Without a fan, your Pi could run up to 68°C-72°C, and that's a big problem. Cooling provides better performance of most hardware with processors.

Next is to assemble the LCD Screen, External HDD/ SSD on the Raspberry Pi.

Installing the Software

Your SD-card needs to contain the RaspiBlitz software.

Download it here: https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz

Torrent: https://github.com/rootzoll/raspiblitz/raw/v1.4/home.admin/assets/raspiblitz-v1.4-2020-02-20.img.gz.torrent

Write the SD-Card image to your SD Card

You need to write the downloaded sd card image (the img.gz-file) to your sd card (16GB minimum) — I used a very easy tool Balena Etcher. Download it here: https://www.balena.io/etcher/.. it’s available for Win, Mac & Linux.

Ones the OS image has been copied to the SD card, insert it into the Raspberry Pi 4, and connect your power cable. Connect the raspberry with a LAN cable to the internet router and power up the pi. It's also possible to use wifi connection. Make sure your laptop and Raspberry Pi are on the same network!

If you Prefer Wifi connection, here’s how.

Follow this guide to pre-configure the wireless settings:

  • Create a file wpa_supplicant.conf in the boot partition of the microSD card with the following content. Note that the network name (ssid) and password need to be in double-quotes (like psk="password")

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=[COUNTRY_CODE]

network={

ssid="[WIFI_SSID]"

psk="[WIFI_PASSWORD]"

}

  • Replace [COUNTRY_CODE] with the ISO2 code of your country (eg. NG) for Nigeria.
  • Replace [WIFI_SSID] and [WIFI_PASSWORD] with the credentials for your own WiFi.

Breakdown of lnd and bitcoin node installation in the Raspiblitz OS.

The first step to running a Lightning Network Node is the installation of lnd using either the btcd or bitcoind backends. For node operators who want the fastest initial sync time, bitcoind is recommended. For those who would like to contribute to light clients running the Neutrino protocol, btcd is the best option. Raspiblitz will install bitcoind for you by default.

Other software services included by default include;

  • TOR (Run as Hidden Service) details
  • ElectRS (Electrum Server in Rust) details
  • BTCPayServer (Cryptocurrency Payment Processor) details
  • BTC-RPC-Explorer (Bitcoin Blockchain Explorer) details
  • LNBits (Lightning wallet/accounts System) details
  • LNDmanage (Advanced Channel Management CLI) details
  • Loop (Submarine Swaps Service) details

Wallet-Apps compatible with your RaspiBlitz:

  • Zap (Android, iOS & Desktop) details
  • Zeus (Android & iOS-TestFlight) details
  • Shango (Android & iOS-TestFlight) details
  • Fully Noded (iOS) details

Setting up everything

When everything boots up correctly, you should see the local IP address of your RaspiBlitz on the LCD panel. Something like this;

If you are not using an LCD, use your router management tool to identify the IP address assigned to your Raspberry Pi. There are other IP Scanning tools that can help you too, such as NMAP, Angry IP Scanner, Zenmap, Port Authority, MASSCAN, and skipfish. Almost all are opensource projects.

Now open up a terminal (Linux/OSX/Win10) and connect through SSH with the command displayed by the RaspiBlitz:

ssh admin@[YOURIP] → use password: raspiblitz

For windows users, Putty does the job quite well.

Note: $ ping raspberrypi.local did not work for me on my Ubuntu 18.04.

Now follow the dialogue in your terminal. This will take some time (prepare some coffee, boil yam, fry eggs, and toast some bread) — but in the end, you should have a running Lightning node on your RaspberryPi that you can start to learn and hack on.

Automatically after login via SSH as admin to the RaspiBlitz, it will run a hardware test.

If you see a warning there, please read carefully, because a lot of things that go wrong later (errors and even loss of funds) relate to problems with the hardware. If you get an OK here … you are good to go :)

In the beginning, you can choose how to setup your RaspiBlitz, by running on Bitcoin or Litecoin with Lightning. This is also the point where you can import a Migration file from an older RaspiBlitz. The default is here to choose Bitcoin.

Next is to give your RaspiBlitz a name. This name is given to the RaspiBlitz as a public alias of the lightning node for everybody to see when you eventually go live!

Write down your passwords

You will need several passwords (4) and I find it easiest to write them all down in the beginning, instead of bumping into them throughout the guide. They should be unique and very secure, at least 12 characters in length. Do not use uncommon special characters, spaces, or quotes (‘ or “).

[ A ] Master user password
[ B ] Bitcoin RPC password
[ C ] LND wallet password
[ D ] LND seed password (optional)

Then the user is asked to enter the Password A:

This is the new password that has to be used for every SSH login after this screen with the user admin. It’s also set for the other existing user: root, bitcoin & pi.

The bitcoin and lightning services will later run in the background (as daemon) and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.

Then the user is asked to enter the Password B — this is internally used for the bitcoin RPC interface. But also as the login for additional Apps like the RTL-WebGUI or the Blockexplorer:

The other passwords C & D will be needed later on. They will be used during the lightning wallet setup.

Running behind TOR

What is TOR by the way?

The Tor project is a non-profit organization that conducts research and development into online privacy and anonymity. It is designed to stop people — including government agencies and corporations — learning your location or tracking your browsing habits.

Based on that research, Tor offers technology that bounces internet users’ and websites’ traffic through “relays” run by thousands of volunteers around the world, making it extremely hard for anyone to identify the source of the information or the location of the user.

It’s software package — the Tor browser bundle — can be downloaded and used to take advantage of that technology, with a separate version available for Android smartphones.

The original technology behind Tor was developed by the US Navy and had received about 60% of its funding from the US State Department and Department of Defense, although its other backers have included digital rights lobbyists such as the Electronic Frontier Foundation, journalism and community body Knight Foundation and the Swedish International Development Cooperation Agency.

Let’s move on.

Setting Up and configuring your raspiblitz

On setup, you can now decide if you want to run your RaspiBlitz behind TOR or make your IP public to the lightning network.

Remember, your IP can reveal your location (at least to a certain radius) to everyone and your internet service provider has a record of your personal identity tied to your IP. When you choose to run behind the TOR network, this personal data is much better protected. But running behind TOR reduces speed and might make it more difficult to connect to you from other nodes or pairing other devices and apps to it.

You can switch TOR off or on, but keep in mind that once you are running your node with your public IP, it leaves records on the internet, connecting your lightning node id to your public IP.

After this the setup process, you will need some time and the user will see a lot of console outputs — just wait until it is finished:

Getting the Blockchain

If you have an HDD/SSD with a prepared blockchain (e.g. a ready2go-set from BlockSpace) you have the option to trust that data and skip to the next section. But if you started with an empty HDD — you will see the following screens:

Your HDD/SSD will get formatted with the Linux standard file system EXT4.

After formatting you need to get a copy of the blockchain, the RaspiBlitz offers the following options:

The options — and when to choose which — will be explained here shortly:

1. SYNC — Selfvalidate all Blocks

With the new RaspberryPi 4 (with SSD & min 2GB RAM) this is the best way to go. It will take around 2–4 weeks to sync & validate directly with the bitcoin network and then you will have done it completely the original way ...don't trust, verify.

For the old RaspberryPi 3 this is not recommended. A RaspberryPi 3 has a very low power CPU and syncing+validating the blockchain directly with the peer2peer network can take multiple weeks — that’s why the other options above are recommended.

2. COPY — Copy from Laptop or another RaspiBlitz over Local Network

If you have another computer available (laptop, desktop or another RaspiBlitz) that already runs a working blockchain you can use this option to copy it over to the RaspiBlitz. This will be done over the local network by SCP (SSH file transfer). Choose this option and follow the given instructions.

This is also the best option if you don’t like to run your RaspberryPi 3 with a prepared blockchain by a third party. Then install bitcoin-core (0.18.1 or higher) on a more powerful computer, sync+validate the blockchain there by yourself and copy it over after that through the local network.

The current Bitcoin Blockchain Size is about 320GiG now.

https://bitcoin.org/en/download

Setup Lightning

Lightning is installed and waiting for your setup if you see this screen.

You now decide if you want to setup a fresh new wallet or if you want to recover an old wallet from a RaspiBlitz you had before.

Setup a NEW Wallet

This is the default if you are setting up a RaspiBlitz for the first time.

RaspiBlitz will ask you to set your wallet unlock password — use your chosen PASSWORD C here and confirm it by inputting it a second time.

LND will now generate a fresh cipher seed (word list) for you.

WRITE YOUR PERSONAL WORDS DOWN before you continue — without it you limit your chances to recover funds in case of failing hardware, etc. If you just want to try/experiment with the RaspiBlitz at least take a photo with your smartphone just in case. If you plan to keep your RaspiBlitz running, please store this word list offline or in a password safe.

Recovering an OLD Wallet

Choose this option if you had an old RaspiBlitz you want to recover. You have three options to do that:

Final LND Setup

The installation setup will now make sure your wallet is initialized correctly and may ask you to unlock it with the password you just set… PASSWORD C.

The LND wallet will need to get unlocked on every new start/reboot of the RaspiBlitz.

The RaspiBlitz will now do a final setup configuration like installing tools, moving the SWAP file to the HDD or activating the firewall. You will see some text moving across the screen until you see a screen like this one:

The basic setup is done — hooray … but it can still take some more time before everything is ready and you can play around with your new RaspiBlitz.

Press OK to make a reboot.

Your terminal session will get disconnected and the raspberry pi restarts.

First Start: Syncing & Scanning

After the reboot is done, it typically will take a while for all services to start up. Just wait until you see on the LCD/display that LND wallet needs to get unlocked. At that point, SSH in again with the same command like in the beginning (check LCD/display) but this time (and at every other subsequent login) use your PASSWORD A.

After the SSh terminal login, LND will ask you (like on every start/reboot) to unlock the wallet again — use PASSWORD C:

Now on the first start, you will have a longer waiting time (between 10 minutes and 2–3 days, depending on your initial setup) … but that’s OK, just leave the RaspiBlitz running until it’s done.

You can even close your terminal now and shut down your laptop and ssh back in later on. You will see on the Blitz LCD/display that it is ready, when the blue background screen is gone and you see a status screen.

Understanding why it is taking so long involves two things:

  1. Blockchain Sync

The blockchain on your HDD is not absolutely up-to-date. Depending on how you got it transferred to your RaspiBlitz it will be some hours, days or even weeks behind. Now the RaspiBlitz will need to catch-up the rest by directly syncing with the peer-2-peer network until it reaches almost 100%. But even if you see in the beginning a 99.8% this can take time — gaining 1% can be up to 4 hours (depending on network speed). So be patient here.

  1. Lightning Network Scanning

Automatically if the Blockchain Sync is progressing LND will start to scan the blockchain and collect information. The Lightning scanning alone normally just take around 1 hour until the waiting time is over. It can take much longer if you recovered from an old wallet seed.

Once all is done you should see this status screen on the RaspiBlitz LCD/display like this:

The Main Menu

If you now login by SSH into your RaspiBlitz (or you are still logged in) you will see this Main Menu.

And if you scroll down .. you will see even more options.

All options of the main menu will be explained later.

OK. .. so from here on your RaspiBlitz is ready to play with.

If you need an idea on what the most basic next steps to experience Lightning would be, here they are:

  • Fund on-chain Wallet
  • Open a channel
  • Make a payment

If you prefer to do this from a web browser with a dashboard UI instead of using an SSH terminal, just go to SERVICES, and activate the RTL Webinterface and after that, reboot and open in your web browser the following link: http://[LOCAL-IP-OF-YOU-NODE]:3000 (PASSWORD B is your RPC password).

Have fun riding the lightning :D

Funding your Wallet

Before you can open channels with other nodes you need to put some coins onto your LND on-chain wallet. Use this option to generate an address to send funds to. You can make multiple fundings — so you can start with small amounts to test. LND will always generate a different address, but all funds you send will get into the same LND on-chain wallet.

Connecting to a Peer and opening channels

Before you can open a channel with another node on the network you need to connect that node first as a peer to your node.

Opening a channel with a peer is just optional. Having another node as peer helps your node to receive information about the network through the gossip protocol. It will help your node to find better routes throughout the network.

Opening a Channel with Peer

To open a payment channel with another node you can use this option.

Find interesting nodes to open channels with on online directories like 1ML.com or join the RaspiBlitz NodeManager telegram group to meet people to open channels with https://t.me/raspiblitz

Bear in mind that this option will open a public channel that can be seen by everyone in the network. This is good if you want to route payments. If your intention is to use it privately only, you will need to go to the command line and open the channel with the -private option.

Making Payments

Pay an invoice through lightning.

Create an invoice to send to someone or a service to be paid through lightning.

RTL Web interface

The RTL Web interface is an LND Control Dashboard you can run in your browser with a nice GUI — it offers much more control over your Lightning node than the RaspiBlitz SSH menus. It’s recommended to give it a try.

Read an Intro-Tutorial to RTL: https://medium.com/@suheb.khan/how-to-ride-the-lightning-447af999dcd2

Feedback is welcome by the RTL programmer: https://github.com/ShahanaFarooqui/RTL

BTC-RPC-Explorer

BTC-RPC-Explorer is a blockchain explorer website you can run on your own RaspiBlitz. See an example running on: https://btc-explorer.com

Details on Service

Connecting to Zap Desktop (optional)

If interacting through the command-line interface is not your thing, then let’s connect to Zap Desktop. This will give you a functional GUI to check your on and off-chain balance, as well as your channels.

Make sure lnd is running before connecting.

Download Zap wallet: https://zap.jackmallers.com/

Create a new wallet.

Connect your own node.

Connection details (default):

  • Linux
  • Host: localhost:10009
  • TLS Certificate: ~/.lnd/tls.cert
  • Macaroon: ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
  • OSX
  • Host: localhost:10009
  • TLS Certificate: ~/Library/Application Support/Lnd/tls.cert
  • Macaroon: ~/Library/Application Support/Lnd/data/chain/bitcoin/mainnet/admin.macaroon
  • Windows
  • Host: localhost:10009
  • TLS Certificate: C:\Users\<username>\AppData\Roaming\Lnd\tls.cert
  • Macaroon: C:\Users\<username>\AppData\Roaming\Lnd\data\chain\bitcoin\mainnet\admin.macaroon

You’re connected!

Post Setup

Now you’re wondering, “I ran through the installation process and got everything connected. What happens if I restart my computer?”

You’ll have to make sure that you start both pieces of software again, and unlock your wallet.

  • Start Bitcoin Core
  • Start lnd
  • lnd --bitcoin.active --bitcoin.mainnet --bitcoin.node=bitcoind --bitcoind.rpcuser=rpcuser_here_844585 --bitcoind.rpcpass=rpcpassword_here_12574 --bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
  • Unlock lnd
  • lnd unlock
  • or unlock with zap wallet

Connecting to Solar Panel

80 Watt Solar Panel

30 Watt Charge Controller Solar charge controller (brand — PWM

12 V 12 Ah UPS Dry Cell Lithium-Ion Battery

1000 Watt Solar Inverter/ Charger (USB is port is not recommended cause its power rating is less than what a Pi requires)

Automatic change over, consider using Arduino Nano micro Controller combined with the following; 1.2 electrical contactors of not more than 10 Ah each 2.2 Transistors (TIP 41C) 3.Breadboard

Follow this connection drawing to finish the hack.

Sourcing your hardware
Where to buy everything you need for the Project if you live in
Nigeria.
Blockspace Technologies Ltd
https://blockspace.africa
https://blockspace.shop
WhatsApp/ Tel: +2348165430776

Buy a ready-2-go RaspiBlitz or Workshop-Set:
shop.fulmo.org (Europe)
lightninginabox.co (USA)
blockspace.shop (Africa)

Helpful Resources

--

--

Chimezie Chuta

IT Professional & Drupal Web Developer. Trainer @ Lagos DrupalVersity. Founder, Blockspace.Digital, Coordinator, Blockchain Nigeria User Group, 3D Printing guy!