This is an editorial by Anthony Feliciano, Bitcoin Event Organizer and Contributor to Bitcoin Magazine.
This article is a follow up to A previous article I wrote, talking about different types of lightning nodes. I will expand on RaspiBlitz Lightning Network Node. I won’t go into many other options and features of what RaspiBlitz has to offer, but this is a unique development.
This project started four years ago when I was sitting in my apartment, in the middle of the day, and suddenly the power went out. The first thing on the average person’s mind is “Damn, the power went out – I wonder how long it would take and do I need to start looking in the fridge to be able to grill what might melt?”
not me! I immediately thought, “My contract is lightning!” Long story short, the power went out for only a few hours. But at the time it got me thinking, if something like this happens again, what should I do?
What emerged next was the project that followed me creating a RaspiBlitz LN node. This project is about figuring out a way to keep the LN node running when the power and internet are out.
Issues to be resolved:
- Power – What can I use to keep the LN node running during the next power outage?
- Internet – How do I keep an LN node online to keep the LN in sync?
- Mobility – What if there is a fire or emergency and I have to leave, taking only what I can carry?
Energy
If you read the problems, you are probably already thinking about solutions yourself. The first problem is easy to solve – get an uninterruptible power supply (UPS) as a backup. meaning right? In the event of a power outage, the UPS starts to operate and maintains the device’s power without problems. The only follow-up question is, how much time do you need? There are many UPSs on the market that provide power for any number of hours, so at this point it becomes a matter of preference and budget. I went for a UPS model for power supply for about 2 hours. At the time I had none, so this was still new to me and never crossed my mind. While it’s not the longest-running or most powerful UPS out there, the UPS I chose only provides backup power to my LN node and router; If I lose internet, I can still keep router power on and connect via Secure Shell (SSH) Terminal for my network devices. The first problem has been solved.
Internet
** Note ** The following solution depends on whether you are using the WiFi setting as a start. If you are using an Ethernet cable, you can still add a WiFi network as a backup from the steps below. Also, if you keep your router powered by UPS, it doesn’t always mean that you lose internet in the event of a power outage, as this will depend on whether your provider is affected as well. This method is intended for a power outage in a larger area or an emergency situation, and it will contribute to solving the third problem – mobility.
Internet and maintaining connectivity
While everyone is concerned about power, and rightfully so, many forget the second most important part – getting online. How can I keep this device connected in the event of a power failure? Easy – that’s when I started searching; Thank God I’m using a file Raspi 4 Which comes with built-in WiFi, with a simple WiFi profile configuration, you can add a second WiFi.
How to set up a second network on your Raspi:
Head over to this page for more information: Set up WiFi on Raspi
This is the line of code you are looking for:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
** NOTE ** If you are not using WiFi and instead use RJ45 (Ethernet), the wpa_supplicant.conf file may not have this icon at the top; Add it if it’s missing:
ctrl_interface = DIR = /var/run/wpa_supplicant GROUP = netdev
update_config = 1
Country = United States – ** Change the country code if you are outside the United States **
To enter this code, exit the RaspiBlitz menu to the device screen, which should look like this:
admin @NODEIPADDRESS: ~ $
Enter the code to look like this:
admin @NODEIPADDRESS: ~$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
I won’t show my configuration, but you will see yours when you open the file. I took this from the “Set up WiFi on Raspi” link above.
ctrl_interface = DIR = /var/run/wpa_supplicant GROUP = netdev
update_config = 1
Country = United States
network = {
ssid = “SchoolNetworkSSID”
psk = “passwordSchool”
id_str = “school”
}
network = {
ssid = “HomeNetworkSSID”
psk = “passwordHome”
id_str = “home”
}
What you will see in your file is the WiFi network you are actually using. What you add is that second network. So what is your second network? I mean how many WiFi points can you connect to? Do you know the SSID (Service set identifier) And the password to connect to them? In my case, I used my cell phone hotspot. That’s right, you can use your mobile phone as a hotspot to act as a WiFi network, so that your LN node can connect to it. For the second network in the list, I entered the SSID and password provided by my mobile hotspot feature.
Question – But what if I use my mobile hotspot? How will I know the IP address to connect to? Don’t worry, I’ve got you covered too. On your phone (I use Android), download an app called Termius Which works as an SSH terminal from your mobile phone to your LN device.
**Note** If you have a screen on RaspiBlitz, the IP address you want to connect to will appear there as well, which means you entered the second WiFi correctly and your phone and device are communicating.
**Note** If you boot your device without a head (without a screen) like I do, you have to get the IP address, from the “connected device” info, a step I’ll discuss below
Termius App
steps: Due to the security policy, I can’t take screenshots to show how to set up the app on your phone, but I can guide you.
- Open the app
- Click “+” – New Host
- Fill in the information – alias (contact name)
- Hostname or IP Address: You will get this IP address when the node connects to your mobile hotspot. I’ll show how to get this later.
- Make sure the “SSH” box is checked.
- Username: For RaspiBlitz users, the username is “admin” but if you change it to something else, it will be whatever you name it.
- Password: Do not enter a password! If you enter it, it will connect automatically, which is a security flaw if someone gets into your phone. Leave it blank When you click on an alias, it will ask you for the password of your device to connect to it.
- Click the check mark at the top to add the new connection.
- When you make the first SSH connection into the device, it will ask you to accept the fingerprint to do so. Click Yes.
Below is a screenshot of what all this looks like:
As you can see, I’m on my cell phone hotspot.
My WiFi is “Gopoundsand” along with the provided password (psk), which I entered as a second WiFi.
network = {
ssid = “Gopoundsand”
psk = “passwordHome”
id_str = “home”
}
If you see Connected devices (your LN node name), then you have successfully setup sudo nano /etc/wpa_supplicant/wpa_supplicant.conf and your device is now connected to your mobile WiFi and internet. Congratulations on getting this far!
**NB** Make sure that your first connection if you are using Ethernet is not connected, or if you are using WiFi, as your main connection, it is off. On reboot, the device will lock up on the main WiFi network and won’t search for your second connection. It will take a few minutes on reboot to establish a connection.
Now you can go to the mobile hotspot from Settings and see the connected devices or swipe down from the notification bar, as shown above to see the connected devices. Now click on “Details” of the connected device, and “Details” again. This is where you will see the IP address given from your mobile phone to the device. (Example: 192.168.200.102.) This information will now go to the Termius app: hostname or IP address: You will get this IP address when the node connects to your mobile hotspot.
If you managed to do everything correctly, you should get to this place in the screenshot:
This is the RaspiBlitz menu screen, on my Android phone with the Termius app.
If you can bypass all the steps, you have successfully added a second WiFi to sudo nano /etc/wpa_supplicant/wpa_supplicant.conf, you have been able to get the LN node to connect to your mobile via the hotspot and you are finally able to SSH into your machine and get the private LN node You need to re-sync via cell phone and access the RaspiBlitz menu as shown in the screenshot above. Congratulations, you will succeed!
Hints if the connection fails:
- Make sure the SSID and password are correct in the sudo nano /etc/wpa_supplicant/wpa_supplicant.conf file. Ctrl + x to exit, “y” to save the file if the information is correct. or “no” if you misspelled something.
- When the LN node restarts, to connect to your cell phone’s hotspot, give it a few minutes to establish that connection. So don’t be afraid that you’re doing something wrong – if it takes more than five minutes, it’s probably worth troubleshooting.
- Make sure that your first connection if you are using Ethernet is not connected, or if you are using WiFi, as your main connection, it is off. On reboot, the device will lock up on the main WiFi network and won’t search for your second connection.
- On SSH via Terminal, make sure you have the correct IP address from your hotspot. And add this information to the new host connection. (Side note: On some devices like mine, every time I turn the hotspot off and on I get a new IP, so I have to “edit the connection alias” in the app with the new IP, and SSH will reconnect.
Mobility
We’ve finally come to the last step. What if there’s a big emergency, a fire or you just say vacation, and you just have to take what you can and go? Could you take the LN node with you? How do you do that? If you go with a mid-size UPS, you can always have it and go, as it saves the few hours needed to keep your unit running until you can get to a more stable setup. Let’s say, your UPS is big and stocky, and taking it with you is not feasible. I thought about that too, and decided to use a 28800mAh backup solar charger, which you can use to charge your cell phone. Why is this useful? Because it is small, light and versatile. The unit also has uses (USB-C connector) to charge the unit on the wall. But most importantly, the solar charger provides the power (3Amp) needed to power your device including the external SSD.
Tips:
- You cannot charge the backup charger on the wall while trying to power the LN device; It didn’t kill the Pi, just turned it off. I pulled out the power, waited a while, and turned it back on again.
- You cannot use two USB ports to connect to Raspi USB ports. This will fry your board: Well, you killed my board. Fortunately, it was only the plate, which was only a $35 replacement.
To sum it up, I learn through trial and error. I hope you laughed at this, but I hope it helps someone avoid unnecessary stress.
This is the end result (the photo was taken in a state park in the Rocky Mountains):
conclusion
This could be the weekend project for you. If you’re already running node and feel like you’re getting a little #reckless this is a fun way to expand your applications and skills. Even if you didn’t do it exactly that way, I hope this has inspired you to think of a more creative way to solve the problems you’ve had.
Now go #reckless.
This is a guest post by Anthony Feliciano. The opinions expressed are their own and do not necessarily reflect the opinions of BTC Inc or Bitcoin Magazine.
.