How to Run a Bitcoin Full Node and Lightning Node on a Raspberry Pi

ยท

Running a Bitcoin full node and Lightning Network node on a Raspberry Pi is an economical and efficient way to participate in the Bitcoin network. This guide provides a step-by-step tutorial for setting up both nodes, even if you have limited computer knowledge.


Hardware Preparation and Operating System Selection

Hardware Setup

Why Raspberry Pi?

The Raspberry Pi is cost-effective, consuming only 15W of power compared to traditional PCs (50W+). Its compact size and low energy usage make it ideal for running nodes 24/7.


System Setup

1. Flashing the OS

  1. Download Raspberry Pi Imager from the official site.
  2. Insert the micro SD card into your computer and open the Imager.
  3. Select Raspberry Pi OS Full (32-bit) or a 64-bit alternative like Ubuntu.
  4. Write the OS to the micro SD card and insert it into the Raspberry Pi.

2. Initializing Raspberry Pi OS

  1. Boot the Raspberry Pi with a connected monitor, keyboard, and mouse.
  2. Set a login password (note it down securely).
  3. Connect to the internet via Ethernet or Wi-Fi.

Remote Access Tips:

  • Use ifconfig to find the Raspberry Piโ€™s local IP.
  • Enable SSH (sudo raspi-config) or use Remote Desktop (xrdp).

3. Mounting External Storage

Follow this tutorial to ensure Bitcoin Core stores data on your external drive (not the micro SD card).


Installing and Configuring Bitcoin Core

1. Download and Install

Run these commands in the terminal:

wget https://bitcoin.org/bin/bitcoin-core-0.21.1/bitcoin-0.21.1-arm-linux-gnueabihf.tar.gz  
tar xzf bitcoin-0.21.1-arm-linux-gnueabihf.tar.gz  
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.21.1/bin/*

2. Configuration

Create bitcoin.conf in /home/pi/ with:

datadir=/path/to/external/drive  
server=1  
prune=0  
txindex=1  
rpcuser=[your_username]  
rpcpassword=[your_password]  
zmqpubrawblock=tcp://127.0.0.1:27500  
zmqpubrawtx=tcp://127.0.0.1:27501

Start Bitcoin Core:

bitcoind -conf=/home/pi/bitcoin.conf

Verify sync status:

bitcoin-cli -getinfo

๐Ÿ‘‰ Optimize your node setup


Installing and Configuring LND

1. Install LND

wget https://github.com/lightningnetwork/lnd/releases/download/v0.15.3-beta/lnd-linux-armv7-v0.15.3-beta.tar.gz  
tar xzf lnd-linux-armv7-v0.15.3-beta.tar.gz  
sudo mv lnd-linux-armv7-v0.15.3-beta/* /usr/bin/

2. Configure LND

Edit lnd.conf:

bitcoin.active=true  
bitcoin.mainnet=true  
bitcoin.node=bitcoind  
bitcoind.rpcuser=[same_as_bitcoin.conf]  
bitcoind.rpcpass=[same_as_bitcoin.conf]  
tlsextraip=192.168.1.5  # Your Piโ€™s local IP  
rpclisten=192.168.1.5:10009

Start LND:

lnd -C /home/pi/lnd.conf

Create a wallet:

lncli create

Connecting with Zap Wallet

1. Install lndconnect

wget https://studygolang.com/dl/golang/go1.17.3.linux-armv6l.tar.gz  
sudo tar -C /usr/local -xzf go1.17.3.linux-armv6l.tar.gz  
git clone https://github.com/LN-Zap/lndconnect.git  
cd lndconnect && go build

2. Generate QR Code for Zap

lndconnect --configfile=/home/pi/lnd.conf -i -o

Scan the QR code with the Zap mobile app to remotely control your node.

๐Ÿ‘‰ Explore Lightning Network tools


FAQs

Q1: Can I use a 2GB Raspberry Pi?

A: Yes, but 4GB+ is recommended for smoother performance, especially with LND.

Q2: How long does blockchain sync take?

A: 2โ€“7 days, depending on internet speed and hardware.

Q3: Is a monitor necessary?

A: No, but helpful for initial setup. Remote access (SSH) suffices afterward.

Q4: How to secure my node?

A: Use strong passwords, enable firewalls, and avoid exposing RPC ports publicly.

Q5: Can I prune the blockchain?

A: Yes (prune=550), but a full node (prune=0) is recommended for Lightning.


Final Notes

This guide simplifies running a Bitcoin + Lightning node on a Raspberry Pi. For advanced users, consider Tor integration or automated backups.