This is a practical Bitcoin Core setup for Raspberry Pi with systemd.

Assumptions:

1) Base system

sudo apt update && sudo apt full-upgrade -y
sudo apt install -y curl wget gnupg git ca-certificates
sudo reboot

2) Prepare storage

If your SSD is already formatted and mounted correctly, skip this section.

Identify the disk:

lsblk -f

Example below assumes disk /dev/sda and creates partition /dev/sda1.

sudo parted /dev/sda --script mklabel gpt
sudo parted /dev/sda --script mkpart primary ext4 1MiB 100%
sudo mkfs.ext4 -L bitcoin /dev/sda1

Mount by UUID:

sudo blkid /dev/sda1
sudo mkdir -p /mnt/bitcoin

Add to /etc/fstab (use your actual UUID):

UUID=REPLACE_WITH_UUID /mnt/bitcoin ext4 defaults,noatime 0 2

Apply mount:

sudo mount -a
df -h /mnt/bitcoin

3) Create service user

sudo adduser --system --group --home /var/lib/bitcoind bitcoin
sudo chown -R bitcoin:bitcoin /mnt/bitcoin

4) Download and verify Bitcoin Core

Set version and fetch release artifacts:

cd /tmp
VER=30.2
wget "https://bitcoincore.org/bin/bitcoin-core-${VER}/bitcoin-${VER}-aarch64-linux-gnu.tar.gz"
wget "https://bitcoincore.org/bin/bitcoin-core-${VER}/SHA256SUMS"
wget "https://bitcoincore.org/bin/bitcoin-core-${VER}/SHA256SUMS.asc"

Checksum verification:

sha256sum --ignore-missing --check SHA256SUMS

Signature verification (recommended):

git clone --depth 1 https://github.com/bitcoin-core/guix.sigs /tmp/guix.sigs
gpg --import /tmp/guix.sigs/builder-keys/*.gpg
gpg --verify SHA256SUMS.asc SHA256SUMS

Install binaries:

tar -xzf "bitcoin-${VER}-aarch64-linux-gnu.tar.gz"
sudo install -m 0755 -o root -g root bitcoin-${VER}/bin/* /usr/local/bin/
bitcoind --version

5) Configure Bitcoin Core

sudo mkdir -p /etc/bitcoin
sudo chown root:bitcoin /etc/bitcoin
sudo chmod 750 /etc/bitcoin

Create /etc/bitcoin/bitcoin.conf:

server=1
daemon=0

# Storage
datadir=/mnt/bitcoin
prune=100000

# Performance (adjust for your RAM)
dbcache=1024

# RPC: local-only default
rpcbind=127.0.0.1
rpcallowip=127.0.0.1

# Network
listen=1
maxconnections=40

Notes:

6) systemd service

Create /etc/systemd/system/bitcoind.service:

[Unit]
Description=Bitcoin daemon
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/local/bin/bitcoind -pid=/run/bitcoind/bitcoind.pid -conf=/etc/bitcoin/bitcoin.conf -datadir=/mnt/bitcoin
User=bitcoin
Group=bitcoin
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
RuntimeDirectory=bitcoind
RuntimeDirectoryMode=0710
Restart=on-failure
TimeoutStopSec=600

PrivateTmp=true
ProtectSystem=full
ProtectHome=true
NoNewPrivileges=true
PrivateDevices=true
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target

Enable and start:

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

7) Verify node state

bitcoin-cli -datadir=/mnt/bitcoin getblockchaininfo
bitcoin-cli -datadir=/mnt/bitcoin getnetworkinfo
journalctl -u bitcoind -f

Common sync check:

bitcoin-cli -datadir=/mnt/bitcoin getblockchaininfo | grep -E "blocks|headers|verificationprogress|pruned"

8) Optional: LAN RPC access

Default config is local-only RPC. Keep that unless you need remote RPC.

If you do expose RPC on LAN:

Generate rpcauth (from extracted release tree):

python3 /tmp/bitcoin-${VER}/share/rpcauth/rpcauth.py yourrpcuser

Then put the generated rpcauth=... line in bitcoin.conf and restart:

sudo systemctl restart bitcoind

9) Optional: Tor outbound

Install Tor and route peer traffic through it:

sudo apt install -y tor

Add to bitcoin.conf if desired:

proxy=127.0.0.1:9050
listenonion=1

Restart:

sudo systemctl restart bitcoind

https://zaclloyd.net/

RSS Feed