How to Set Up a Bitcoin Node on Raspberry Pi: Complete Guide 2025

If you’re interested in contributing to the Bitcoin network’s decentralization while maintaining your privacy, running your own node is essential. This guide walks you through setting up a Bitcoin full node on a Raspberry Pi, a power-efficient and cost-effective solution.

📚 Contents

⚡ 1. Why Run Your Own Bitcoin Node?

🔧 2. Hardware Requirements

🚀 3. Pre-Installation Steps

🛠️ 4. Initial Setup

💾 5. Bitcoin Core Installation

📊 6. Node Management

⚙️ 7. Advanced Configuration

❗ 8. Troubleshooting

🔒 9. Security Best Practices

🔄 10. Maintenance & Updates

Why Run Your Own Bitcoin Node?

Bitcoin Architecture

Hardware Requirements

Pre-Installation Steps

Before diving into the Bitcoin node setup, ensure your Raspberry Pi is:

1. Create Sandboxed User

Create a dedicated user with limited privileges for running Bitcoin Core:

# Create user without home directory
sudo useradd -M bitcoinSB

# Create and set home directory with restricted permissions
sudo mkdir -p /home/bitcoinSB
sudo chown bitcoinSB:bitcoinSB /home/bitcoinSB
sudo chmod 750 /home/bitcoinSB

# Set shell to /bin/bash
sudo chsh -s /bin/bash bitcoinSB

# Disable password login for security
sudo passwd -l bitcoinSB

# Verify user creation
id bitcoinSB

This creates a sandboxed user with:

1. External Drive Configuration

*Note: Skip to the bitcoin core install if just using PI SD card

Before proceeding with any formatting, let’s check if your drive actually needs it. Many drives come pre-formatted with a usable filesystem.

Testing Your Drive

  1. First, identify your drive:
# List all drives
sudo fdisk -l

# Or use lsblk for a cleaner view
lsblk
  1. Check the current filesystem:
# Replace 'sda1' with your filesystem partition
sudo blkid /dev/sda1
  1. Test mounting with the existing filesystem:
# Create mount point
sudo mkdir -p /mnt/sda

# Try mounting (for ext4)
sudo mount /dev/sda1 /mnt/sda

# Or for NTFS
sudo mount -t ntfs /dev/sda1 /mnt/sda

# Check if mounted successfully
df -h /mnt/sda
  1. Test write permissions:
sudo touch /mnt/sda/test_file
sudo rm /mnt/sda/test_file

If these tests succeed, you can skip formatting and proceed to setting up auto-mount.

Formatting (Only if Needed)

⚠️ WARNING: Formatting will erase all data on the drive. Make sure to backup any important data before proceeding!

If the above tests fail or you specifically need ext4, then format your drive:

# Replace 'sda1' with the partition you intend to erase
sudo mkfs.ext4 /dev/sda1

# Create mount point
sudo mkdir /mnt/sda

# Add to fstab by stable filesystem UUID
UUID=$(sudo blkid -s UUID -o value /dev/sda1)
echo "UUID=$UUID /mnt/sda ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
sudo mount -a

Bitcoin Core Installation

1. Download and Verify Bitcoin Core

Note: Ensure that you donwload the latest version of BTC core. Just click here to find the version number. You will have to scroll to the bottom!

# Switch to non-root user
sudo su - bitcoinSB

# Create download directory outside the Bitcoin data directory
mkdir -p ~/bitcoin-download
cd ~/bitcoin-download

# Enter the current stable version shown at bitcoincore.org/bin
read -r -p "Bitcoin Core version: " VERSION
wget "https://bitcoincore.org/bin/bitcoin-core-$VERSION/bitcoin-$VERSION-aarch64-linux-gnu.tar.gz"
wget "https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS"

# Verify checksum
sha256sum --ignore-missing --check SHA256SUMS

# Extract files
tar -xvzf "bitcoin-$VERSION-aarch64-linux-gnu.tar.gz"

2. Install Bitcoin Core

# Exit to root user
exit

read -r -p "Bitcoin Core version: " VERSION
sudo chmod +x /home/bitcoinSB/bitcoin-download/bitcoin-$VERSION/bin/bitcoin*

# Copy binaries
sudo cp /home/bitcoinSB/bitcoin-download/bitcoin-$VERSION/bin/bitcoin* /usr/local/bin/

3. Configure Bitcoin

External HDD

# Setup Bitcoin directory for External HDD
sudo mkdir -p /mnt/sda/bitcoin
sudo chown bitcoinSB:bitcoinSB /mnt/sda/bitcoin
sudo -u bitcoinSB ln -s /mnt/sda/bitcoin /home/bitcoinSB/.bitcoin

Or On PI SD Card

# Setup Bitcoin directory for Internal SD 
sudo -u bitcoinSB mkdir -p /home/bitcoinSB/.bitcoin

Create /home/bitcoinSB/.bitcoin/bitcoin.conf:

Must read Notes:

# Core Settings
server=1
dbcache=2048
prune=10000

# RPC Settings
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
rpcport=8332

# Storage uncomment for your usecase
#datadir=/mnt/sda/bitcoin
#datadir=/home/bitcoinSB/.bitcoin/blockchain

# Performance
maxconnections=40

This configuration keeps Bitcoin Core RPC local to the Raspberry Pi. MetaMask and Cake Wallet do not connect directly to Bitcoin Core RPC.

Remote access requires a separately secured interface or compatible wallet server. A Tailscale exit node is not required merely to reach a service over your tailnet.

5. Start Bitcoin Node

sudo tee /etc/systemd/system/bitcoind.service >/dev/null <<'EOF'
[Unit]
Description=Bitcoin Core daemon
After=network-online.target
Wants=network-online.target

[Service]
User=bitcoinSB
Group=bitcoinSB
ExecStart=/usr/local/bin/bitcoind -datadir=/home/bitcoinSB/.bitcoin
ExecStop=/usr/local/bin/bitcoin-cli -datadir=/home/bitcoinSB/.bitcoin stop
Restart=on-failure
TimeoutStopSec=600

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable bitcoind
sudo systemctl start bitcoind

# Monitor progress
sudo -u bitcoinSB tail -f /home/bitcoinSB/.bitcoin/debug.log

Important Notes

Monitoring

Monitor your node using:

bitcoin-cli getblockchaininfo
bitcoin-cli getnetworkinfo
bitcoin-cli getblockchaininfo | grep -E "blocks|headers|verificationprogress"

Consider setting up monitoring tools for system resources and node status.

Security Considerations

Here is how to have an auto update check 1 time per day (must be root/sudo user)

Create the updater script wherever you please and name it update-bitcoin.sh. I will do it in the root user at ~/bitcoin/.

WARNING DO NOT USE YET: still debugging

#!/bin/bash
set -euo pipefail

echo "==================================================================="
echo "Bitcoin Core Auto-Update Script"
echo "==================================================================="

# Log file setup
LOG_DIR="/home/bitcoinSB/logs"
echo "Setting up logging in: $LOG_DIR"
mkdir -p $LOG_DIR
exec 1>> "$LOG_DIR/bitcoin-update.log" 2>&1

echo "=== Bitcoin Core Update Check Started $(date) ==="

# Directory setup
BACKUP_DIR="/usr/local/bin/backup"
TEMP_DIR="/tmp"
BINARY_DIR="/usr/local/bin"

echo "Directory Structure:"
echo "- Logs: $LOG_DIR"
echo "- Backups: $BACKUP_DIR"
echo "- Temporary files: $TEMP_DIR"
echo "- Bitcoin binaries: $BINARY_DIR"

# Get current installed version
echo "[1/12] Checking current installed version..."
CURRENT_VERSION=$(bitcoin-cli --version | grep -o "v[0-9.]*\.[0-9]" | tr -d 'v')
echo "➜ Current installed version: $CURRENT_VERSION"

# Get latest available version
echo "[2/12] Checking latest available version..."
LATEST_VERSION=$(curl -fsSL https://bitcoincore.org/bin/ | grep -o 'bitcoin-core-[0-9.]*/' | grep -v 'insecure' | sort -V | tail -n 1 | sed 's|/||g')
VERSION_NUM=${LATEST_VERSION#bitcoin-core-}
echo "➜ Latest available version: $VERSION_NUM"

# Compare versions
echo "[3/12] Comparing versions..."
if [ "$CURRENT_VERSION" == "$VERSION_NUM" ]; then
    echo "✓ Already running latest version. No update needed."
    exit 0
fi

echo "➜ Update needed: $CURRENT_VERSION -> $VERSION_NUM"

# Set architecture
ARCH="aarch64-linux-gnu"

# Create backup directory if it doesn't exist
echo "[4/12] Creating backup directory..."
mkdir -p $BACKUP_DIR
echo "➜ Backup directory ready at: $BACKUP_DIR"

# Construct download URL
DOWNLOAD_URL="https://bitcoincore.org/bin/$LATEST_VERSION/bitcoin-$VERSION_NUM-$ARCH.tar.gz"
echo "[5/12] Download URL prepared:"
echo "➜ $DOWNLOAD_URL"

# Stop Bitcoin service
echo "[6/12] Stopping Bitcoin service..."
sudo systemctl stop bitcoind
echo "➜ Bitcoin service stopped"

# Backup old binaries
echo "[7/12] Backing up old binaries..."
echo "➜ Moving from: $BINARY_DIR"
echo "➜ Moving to: $BACKUP_DIR"
sudo mv $BINARY_DIR/bitcoin* $BACKUP_DIR/
echo "✓ Backup complete"

# Download new version
echo "[8/12] Downloading Bitcoin Core $VERSION_NUM..."
echo "➜ Downloading to: $TEMP_DIR"
cd $TEMP_DIR
wget "$DOWNLOAD_URL"
wget "https://bitcoincore.org/bin/$LATEST_VERSION/SHA256SUMS"
echo "✓ Download complete"

# Verify and extract
echo "[9/12] Verifying and extracting..."
echo "➜ Verifying checksums"
sha256sum --ignore-missing --check SHA256SUMS
echo "➜ Extracting files"
tar -xvf bitcoin-$VERSION_NUM-$ARCH.tar.gz
echo "✓ Extraction complete"

# Install new version
echo "[10/12] Installing new version..."
echo "➜ Copying from: $TEMP_DIR/bitcoin-$VERSION_NUM/bin/"
echo "➜ Copying to: $BINARY_DIR"
sudo cp bitcoin-$VERSION_NUM/bin/bitcoin* $BINARY_DIR/
sudo chmod +x $BINARY_DIR/bitcoin*
echo "✓ Installation complete"

# Clean up
echo "[11/12] Cleaning up temporary files..."
echo "➜ Removing: $TEMP_DIR/bitcoin-$VERSION_NUM*"
rm -rf bitcoin-$VERSION_NUM*
echo "✓ Cleanup complete"

# Start Bitcoin service
echo "[12/12] Starting Bitcoin service..."
sudo systemctl start bitcoind
echo "➜ Bitcoin service started"

# Verify new version
echo "Verifying update..."
NEW_VERSION=$(bitcoin-cli --version | grep -o "v[0-9.]*\.[0-9]" | tr -d 'v')
echo "✓ Successfully updated to version: $NEW_VERSION"
echo "=== Update completed at $(date) ==="
echo "==================================================================="

Now ensure it executable, ensure the path is just where you have created the script (likely in root home dir)

chmod +x /home/zac/bitcoin/update-bitcoin.sh

Now we will setup a cronjob to run this once per day during off peak hours in the early morning.

crontab -e

Then enter the following (change path as needed)

30 4 * * * /home/zac/bitcoin/update-bitcoin.sh

Storage Requirements Comparison

This setup provides a robust, privacy-focused Bitcoin node running on Raspberry Pi.