A comprehensive guide to setting up your own Bitcoin node on a Raspberry Pi, including both full and pruned node configurations. Covers external storage setup, security considerations, and performance optimization.
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?
🛠️ 4. Initial Setup
💾 5. Bitcoin Core Installation
📊 6. Node Management
⚙️ 7. Advanced Configuration
❗ 8. Troubleshooting
🔄 10. Maintenance & Updates
Why Run Your Own Bitcoin Node?
- Verify your own transactions without trusting third parties
- Contribute to Bitcoin’s decentralization
- Enhance your privacy in Bitcoin transactions
- Learn about blockchain technology hands-on
- Potentially run Lightning Network nodes in the future

Hardware Requirements
- Raspberry Pi 4 (recommended) or 3B+
- 1TB+ External SSD/HDD (for full node)
- 32GB+ SD card (for pruned node)
- Stable internet connection
- Optional: Case with cooling
Pre-Installation Steps
Before diving into the Bitcoin node setup, ensure your Raspberry Pi is:
- Running the latest 64-bit OS
- Connected to the internet
- Updated with latest system packages
- Has a static IP (recommended)
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
# Add to specific groups if needed (optional)
sudo usermod -a -G disk,plugdev bitcoinSB
# Verify user creation
id bitcoinSB
This creates a sandboxed user with:
- No password login (enhanced security)
- Limited system access
- Specific home directory permissions
- Basic group memberships for Bitcoin operation
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
- First, identify your drive:
# List all drives
sudo fdisk -l
# Or use lsblk for a cleaner view
lsblk
- Check the current filesystem:
# Replace 'sda' with your drive identifier
sudo blkid /dev/sda
- Test mounting with the existing filesystem:
# Create mount point
sudo mkdir -p /mnt/sda
# Try mounting (for ext4)
sudo mount /dev/sda /mnt/sda
# Or for NTFS
sudo mount -t ntfs /dev/sda /mnt/sda
# Check if mounted successfully
df -h /mnt/sda
- 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:
# Format drive to ext4
sudo mkfs.ext4 /dev/sda
# Create mount point
sudo mkdir /mnt/sda
# Add to fstab for auto-mounting
echo '/dev/sda /mnt/sda ext4 defaults 0 0' | 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
mkdir .bitcoin
cd .bitcoin
# Download Bitcoin Core aarch64 for arm (update version as needed)
wget https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-aarch64-linux-gnu.tar.gz
wget https://bitcoin.org/bin/bitcoin-core-27.0/SHA256SUMS
# Verify checksum
sha256sum --ignore-missing --check SHA256SUMS
# Extract files
tar -xvzf bitcoin-27.0-aarch64-linux-gnu.tar.gz
2. Install Bitcoin Core
# Exit to root user
exit
sudo chmod +x /home/bitcoinSB/.bitcoin/bitcoin-27.0/bin/bitcoin*
# Copy binaries
sudo cp /home/bitcoinSB/.bitcoin/bitcoin-27.0/bin/bitcoin* /usr/local/bin/
3. Configure Bitcoin
External HDD
# Switch back to sandbox user
sudo su - bitcoinSB
# Setup Bitcoin directory for External HDD
mkdir /mnt/sda/bitcoin
ln -s /mnt/sda/bitcoin /home/bitcoinSB/.bitcoin
Or On PI SD Card
# Switch back to sandbox user
sudo su - bitcoinSB
# Setup Bitcoin directory for Internal SD
mkdir /home/bitcoinSB/.bitcoin/blockchain
Create /home/bitcoinSB/.bitcoin/bitcoin.conf
:
Must read Notes:
- Uncomment the correct sotorage location!
- Make sure you set a good RPC Password!
- You can run it over tor too (ask chatgpt)
- Note the
prune
variable. its in mb. You can change to whatever you want - Can also remove the
prune
variable, note the blockchain is >500GB
# Core Settings
server=1
dbcache=2048
prune=100000
# RPC Settings
rpcuser=bitcoinrpc
rpcpassword= **CHANGE ME**
rpcallowip=127.0.0.1
rpcallowip=192.168.1.0/24
rpcbind=0.0.0.0
rpcport=8332
# Storage uncomment for your usecase
#datadir=/mnt/sda/bitcoin
#datadir=/home/bitcoinSB/.bitcoin/blockchain
# Performance
maxconnections=40
This configuration will allow any device on your local network to connect to this node. This means if you enter your pi ip address and the rpc port in metamask or cakewallet, then you will connect to your node!
The functionality can be extended by setting up a vpn into your local network via the pi. This allowes you to access your bitcoin node anywhere in the world! Take a look at tailscale, no networking required, can be setup in 10 minutes and its free! Just set your pi as the exit node.
5. Start Bitcoin Node
sudo systemctl enable bitcoind
sudo systemctl start bitcoind
# Monitor progress
tail -f ~/.bitcoin/debug.log
Important Notes
- For faster initial sync, consider importing existing blockchain data
- Monitor system resources during sync
- Default dbcache is 100MB; increase for faster initial sync
- Ensure adequate disk space on external drive
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
- Keep system and Bitcoin Core updated
- Use strong passwords
- Regular backups
- Monitor system logs
- Consider setting up alerts for critical events
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
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 -s https://bitcoin.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://bitcoin.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://bitcoin.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
- Full Node: ~500 GB (as of 2024)
- Pruned Node: ~5-10 GB