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

·

Running your own Bitcoin full node and Lightning Network node is one of the most empowering ways to take control of your financial sovereignty. While many assume this requires expensive hardware, the truth is you can achieve it affordably using a Raspberry Pi—a compact, low-power computer that costs under $150. This guide walks you through setting up both nodes step by step, even if you're new to command-line tools or Linux.

Whether you're interested in privacy, decentralization, or exploring Bitcoin’s second layer, this tutorial gives you everything needed to run a fully functional node setup with minimal technical overhead.

👉 Discover how to securely manage Bitcoin with powerful tools on OKX.


Hardware Requirements and System Setup

The Raspberry Pi 4B (8GB RAM) is an excellent choice for hosting a Bitcoin and Lightning node. It offers enough processing power, supports 64-bit operating systems, and consumes only about 15W of power—making it far more energy-efficient than traditional desktops.

Recommended Hardware Configuration

💡 While the 8GB model ensures smooth performance, users have successfully run nodes on 4GB and even 2GB variants. For future-proofing and better multitasking, however, 8GB is ideal.

Bitcoin’s blockchain exceeds 500GB and grows daily, so external storage is essential. Use a dedicated USB-powered drive formatted in NTFS or ext4 to ensure compatibility across systems.


Preparing the Operating System

We’ll use Raspberry Pi OS (32-bit)—a stable, Debian-based system optimized for the Pi. You don’t need deep Linux knowledge; most steps involve copying commands.

Step 1: Flash the SD Card

  1. Insert your microSD card into your computer.
  2. Download Raspberry Pi Imager from raspberrypi.com/software.
  3. Open the app and select:

    • Operating System: Raspberry Pi OS (Other) > Raspberry Pi OS Full (32-bit)
    • Storage: Your SD card
  4. Click "Write" and wait for completion.

This installs the OS image directly onto the card.

Step 2: Initial Setup

Insert the SD card into the Pi, connect peripherals (monitor, keyboard, mouse), and power it on.

On first boot:

Keep track of your login credentials—they’re crucial for remote access.

Step 3: Enable Remote Access (Optional but Recommended)

If you only have one monitor or want headless operation:

Option A: SSH Access

Enable SSH via:

Then connect from another machine using:

ssh pi@<raspberry-pi-ip-address>

Use ifconfig in the terminal to find your Pi’s local IP address (look for wlan0 or eth0).

Option B: Remote Desktop

Install XRDP for GUI access:

sudo apt install xrdp -y

From Windows, open “Remote Desktop Connection” and enter your Pi’s IP.

👉 Learn how OKX supports secure Bitcoin wallet integrations.


Mounting the External Hard Drive

Bitcoin’s blockchain must be stored externally—your SD card isn’t large or durable enough.

Format & Mount Steps

  1. Plug in your external drive.
  2. Find the drive name:

    lsblk

    Look for something like /dev/sda1.

  3. Create a mount point:

    sudo mkdir /mnt/bitcoin
  4. Mount the drive:

    sudo mount /dev/sda1 /mnt/bitcoin
  5. Set permissions:

    sudo chown -R pi:pi /mnt/bitcoin
  6. Make it permanent by editing /etc/fstab:

    sudo nano /etc/fstab

    Add this line:

    /dev/sda1 /mnt/bitcoin ntfs defaults 0 0

    (Replace ntfs with ext4 if applicable.)

Now your blockchain data will persist across reboots.


Installing and Configuring Bitcoin Core

Bitcoin Core is the reference implementation of Bitcoin. It downloads and validates every transaction since 2009.

Install Bitcoin Core

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/*

Verify installation:

bitcoind --version

Configure Bitcoin Core

Create a config file:

nano /home/pi/bitcoin.conf

Add these lines:

datadir=/mnt/bitcoin/blockchain
server=1
txindex=1
prune=0
rpcuser=myusername
rpcpassword=mypassword123
zmqpubrawblock=tcp://127.0.0.1:27500
zmqpubrawtx=tcp://127.0.0.1:27501

Save (Ctrl+O, then Enter), exit (Ctrl+X).

Create .bitcoin folder and copy RPC credentials:

mkdir /home/pi/.bitcoin
nano /home/pi/.bitcoin/bitcoin.conf

Paste only the rpcuser and rpcpassword lines.

Start Bitcoin Core:

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

Check sync status:

bitcoin-cli getblockchaininfo

Initial sync may take several days depending on internet speed.


Setting Up LND (Lightning Network Daemon)

LND enables fast, low-cost Bitcoin payments over the Lightning Network.

Install LND

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

Verify:

lnd --version

Configure LND

Create config file:

nano /home/pi/lnd.conf

Add:

bitcoin.active=true
bitcoin.mainnet=true
bitcoin.node=bitcoind
bitcoind.rpcuser=myusername
bitcoind.rpcpass=mypassword123
bitcoind.zmqpubrawblock=tcp://127.0.0.1:27500
bitcoind.zmqpubrawtx=tcp://127.0.0.1:27501
rpclisten=0.0.0.0:10009
listen=0.0.0.0:9735
tlsextraip=0.0.0.0

Set aliases for easier use:

echo "alias lnd='lnd --configfile=/home/pi/lnd.conf'" >> ~/.bashrc
echo "alias lncli='lncli'" >> ~/.bashrc
source ~/.bashrc

Start LND:

lnd

In a new terminal, create a wallet:

lncli create

Follow prompts to set a password and back up your 24-word recovery seed.

Unlock when restarting:

lncli unlock

Connect via Zap Wallet (Mobile)

Zap allows easy mobile access to your Lightning node.

Install lndconnect

First install Go:

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
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc

Install lndconnect:

git clone https://github.com/LN-Zap/lndconnect.git
cd lndconnect
go build
sudo cp lndconnect /usr/local/bin/

Generate QR code:

lndconnect --configfile=/home/pi/lnd.conf -i --port=8080

Scan the QR code with Zap Android/iOS app while both devices are on the same network.

You now control your funds directly—no third party required.


Frequently Asked Questions

Q: Can I use a lower-spec Raspberry Pi?

Yes! Users run full nodes on Pi 3B+ and 4B with 2GB RAM, though performance improves with more memory.

Q: How long does blockchain sync take?

Typically 3–7 days over broadband. Use bitcoin-cli getblockchaininfo to monitor progress.

Q: Is it safe to leave my node online?

Yes—nodes don’t store private keys unless wallets are created. Always back up seeds and passwords securely.

Q: Can I access my node remotely from anywhere?

Only if you have a public IP or use secure tunneling services (e.g., Tor or reverse proxies). Most home networks use NAT, limiting direct access.

Q: What happens if I lose my LND wallet?

Use your 24-word seed and password to recover funds on another LND instance.

Q: Does running a node earn me Bitcoin?

Not directly—but you support network health, improve privacy, and enable trustless transactions.


Running a Bitcoin full node + Lightning node on a Raspberry Pi is not only feasible but empowering. With under $200 in hardware and a few hours of setup time, you become part of Bitcoin’s decentralized backbone.

This project blends practicality with philosophy—giving you real control over your money while strengthening the network for everyone.

👉 Explore advanced Bitcoin tools and security features on OKX today.