All posts
Run Your LN Node on a Raspberry Pi

Run Your LN Node on a Raspberry Pi

How to set up a self-custodial Lightning node with Alby Hub on a Raspberry Pi. Full control over your funds, 100% open source.

In this guide, I’ll show you how to set up a fully custodial Lightning Network (LN) node using Alby Hub on a Raspberry Pi, giving you complete control over your node. Alby Hub offers a DIY free version for a self-custodial Lightning wallet, ensuring full ownership of your funds while being 100% open-source.

It supports both Lightning and Nostr addresses, enabling seamless connectivity across ecosystems, and integrates effortlessly with dozens of Bitcoin applications. With built-in Lightning Service Provider (LSP) services and the Alby Go mobile app, managing your node on the go has never been easier.


Important: This is NOT a Bitcoin miner or a full node. It’s simply a Raspberry Pi running on an SD card power-efficient and low-cost.

⚠️ Disclaimer ⚠️

Anyway, I’ve included a brief recap of the Lightning Network basics below.

What is the Lightning Network? #

The LN is a second-layer solution built on top of Bitcoin to enable fast, cheap, and scalable transactions.

  • Why? Bitcoin’s base layer is secure but slow and expensive for small payments due to block size limits and fees.
  • How? LN uses off-chain payment channels that allow users to transact instantly without waiting for blockchain confirmations.

Key Concepts #

  • Payment Channels: Users open a channel by making an on-chain transaction, then send unlimited instant payments within that channel.
  • Routing: You don’t need a direct channel with everyone, payments can be routed through multiple connected nodes.
  • Low Fees: Only opening/closing channels require on-chain fees; most transactions cost fractions of a cent.

Goal #

LN makes Bitcoin usable for everyday transactions, like buying coffee, without waiting 10+ minutes for confirmations.

In short: Lightning Network = Instant + Cheap Bitcoin payments, secured by Bitcoin’s blockchain.


Setting up Alby Hub #

Alby Hub is a free, open-source (ideally private) Lightning Network node.

Requirements #

Before we begin, you are going to need the following things:

  • A windows or mac or linux computer
  • Raspberry Pi 4 or 5 (For Zero 2W see this tutorial!)
    • In this tutorial, I am using a raspi-4b (~60€)
  • The charger for your raspi (~10€)
  • SD memory card (32/64gb) (~10€)
  • Adapter SD card to USB (to flash the OS into the raspi) (~10€)

Raspberry Pi in a black case next to its USB-C power cable, a 64GB microSD card and an SD card reader

Installation Steps #

1. Flash a Linux kernel into the SD card #

Suggestion: You can use RPI imager on your computer. Use it to flash the recommended raspi OS for you

Raspberry Pi Imager with Raspberry Pi 4, Raspberry Pi OS (64-bit) and the SD card selected

On the Storage you will see your SD card after inserting it into your laptop.

Raspberry Pi Imager storage list showing the inserted SD card, 63.3 GB

Once you click “Next”, you will see different settings. Click to Edit Settings

Raspberry Pi Imager asking to apply OS customisation settings, with the Edit Settings button

On Settings > General: set your hostname, the username and password for your admin user. Make sure you enable your WIFI, otherwise you will have to plug it to the router with an RJ-45.

For this tutorial, I am using testhub as hostname, you can use albyhub or whatever you prefer.

OS Customisation, General tab: hostname testhub, username, password and WiFi network

On Settings > Services: make sure the access via SSH is enabled. We are going to need it to install Alby Hub.

OS Customisation, Services tab: Enable SSH with password authentication

Click “Save” and click “Yes” to start the installation.

Raspberry Pi Imager warning that all data on the SD card will be erased

You will see a confirmation. Click “Yes”. It will take ~10 mins…

macOS prompt asking for Touch ID or password while Raspberry Pi Imager starts writing

Now we got the SD with a fresh linux kernel ready to use!

Write Successful message: Raspberry Pi OS is on the SD card and ready to remove

2. Insert the SD into the raspi #

Extract the SD from the laptop and insert it in the raspi first.

Hand inserting the microSD card into the slot of the Raspberry Pi case

Once the SD is inserted, then plug in the power cable. It will turn on automatically as soon as you plug it in.

Raspberry Pi powered on with the power cable plugged in, red and green LEDs lit

3. Alby Hub installation #

It will take ~5mins since you turned it on to be able to access to it. How can you make sure it’s alive? Open the terminal and ping the hostname you defined while flashing the SD on Settings > General, remember it ended up with .local:

ping testhub.local

It’s normal if you don’t get any answer at the beginning… until you do get this.

Terminal output of ping testhub.local with replies, so the Raspberry Pi is reachable

Now you can install Alby Hub in your raspi using the SSH connection that you enabled earlier:

# Source code: https://github.com/getAlby/hub/tree/master/scripts/pi-aarch64
ssh testhub@testhub.local '/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-aarch64-install.sh)"'

You will be asked to type the word “yes”; type it.

Terminal running the Alby Hub install script over SSH and asking to confirm the host fingerprint

Then, you will be asked to enter your password. Enter the password you chose in Settings > General for the username.

Terminal output ending with Installation finished and the URL http://testhub.local

4. Alby Hub Setup #

Wait another 2-3 mins and visit your host: http://testhub.local/

Alby Hub welcome screen served from testhub.local in the browser

Your Alby hub is now running. Let’s connect it to your GetAlby account!


Creating a GetAlby Account #

🔗 getalby.com

GetAlby sign up form asking for name and email


Connecting GetAlby with Alby Hub #

I created an account named testhub.

Left: the GetAlby account. Right: the node in the raspi.

GetAlby dashboard with 0 sats on the left and the Alby Hub welcome screen on the right

Click “Connect Now”.

Alby Hub step Connect Your Alby Account, listing the benefits and a Connect now button

Click “Request Authorization Code”.

Alby Hub step with the Request Authorization Code button

You get the auth code (left) that you need to insert it into your setup (right).

GetAlby page showing the authorization code, next to the Alby Hub field where it is pasted

Create a Password for your Alby Hub installed in your raspi. It can be different from the password that you set up for your root user in the rapi itself.

Alby Hub Create Password screen with two password fields and two confirmation checkboxes

Alby Hub showing Setting up your Hub while the node starts

Alby Hub home page with the five initial setup steps, starting with Open your first channel

Now it’s time to Link your Alby Account

Link Alby Account to Wallet page on GetAlby next to the Connections page of Alby Hub

Unless you specify otherwise, set the default “Budget renewal: Monthly 1M sats”.

Alby Hub dialog Link to Alby Account with Monthly budget renewal and 1M sats selected Alby Hub showing Alby Account Linked with a 1,000,000 sats budget, and GetAlby with the linked wallet


Opening Lightning Channels #

I recommend following the Initial Steps to set up your Alby Hub.

Alby Hub home page with the Link to your Alby Account step done and Open your first channel pending

Let’s open the first channel.

Open Your First Channel page with the Open Channel button

You need to pay ~$20 in sats to open a 1M sats incoming liquidity channel.

Lightning invoice QR code of 19,897 sats (about 19 USD) to pay for a channel with 1M sats of incoming liquidity

After the payment, then you will see the channel open. It might take a couple of mins until the funding transaction is mined in the next block.

Alby Hub Node page with the new channel online and a menu to view the funding transaction


Receiving Sats #

You can receive sats using your LN Address.

Left: Public page linked to your node. Right: Private page from your Alby Hub.

Public GetAlby tip page on the left and the private Receive page of Alby Hub with the LN address on the right

Optional: You can add ln funds to your wallet using GetAlby’s third-party services: getalby.com/topup - mind the KYC…


Using Your Sats #

After that, you will be able to use it via the Alby Extension or the AlbyGo.

Alby Hub App Store listing Alby Extension and Alby Go, each with a Connect button

Your node is the ultimate source of truth. Connecting these apps to it will allow you to use your sats seamlessly across different platforms.

GetAlby wallet and Alby Hub wallet side by side showing the same list of sent and received payments

Disclaimer: the testhub LN address was created only for testing and tutorial purposes. My real address is chemaclass ;)

Maintenance and Troubleshooting #

Updating Your Node #

Similar to the installation process, there’s a script available to update your node. You can find it in the source repository: GitHub - Alby Hub Update Script

ssh testhub@testhub.local '/bin/bash -c "$(curl -fsSL https://getalby.com/install/hub/pi-aarch64-update.sh)"'

Handling Power Outages #

If the power goes out, the Raspberry Pi will turn off. Once power is restored, it will automatically restart, but Alby Hub will prompt you to enter the password you set earlier.


Related links

Keyboard Shortcuts

Movement vim hjkl

hPrevious post← left
jScroll down↓ down
kScroll up↑ up
lNext post→ right
ggScroll to top
GScroll to bottom
nNext sectionnext heading
NPrevious sectionprevious heading

Go to g = go

ghHomego home
gbBloggo blog
grReadingsgo readings
gcCVgo cv

Actions

/⌘KSearchvim search
dToggle themedark mode
tToggle TOCtable of contents
iSwitch languagei18n
mToggle highlightmark text

General

?Show this help
EscClose
:Terminalvim command mode
↑↑↓↓←→←→BA???