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
- Mainboard: Raspberry Pi 4B 8GB version
- System Storage: SanDisk Class10 64GB micro SD card
- External Storage: 1TB+ HDD or SSD (recommended: HDD + enclosure)
- Optional: Monitor (HDMI-supported)
- Cooling: Passive aluminum alloy heat sink
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
- Download Raspberry Pi Imager from the official site.
- Insert the micro SD card into your computer and open the Imager.
- Select Raspberry Pi OS Full (32-bit) or a 64-bit alternative like Ubuntu.
- Write the OS to the micro SD card and insert it into the Raspberry Pi.
2. Initializing Raspberry Pi OS
- Boot the Raspberry Pi with a connected monitor, keyboard, and mouse.
- Set a login password (note it down securely).
- Connect to the internet via Ethernet or Wi-Fi.
Remote Access Tips:
- Use
ifconfigto 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:27501Start Bitcoin Core:
bitcoind -conf=/home/pi/bitcoin.confVerify sync status:
bitcoin-cli -getinfoInstalling 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:10009Start LND:
lnd -C /home/pi/lnd.confCreate a wallet:
lncli createConnecting 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 build2. Generate QR Code for Zap
lndconnect --configfile=/home/pi/lnd.conf -i -oScan 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.