Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A quick-start guide to hosting your very own bitcoin fullnode for less than $175.00

How to Host a Bitcoin Full Node on a Raspberry Pi B+

This tutorial-demonstration is about how to run Bitcoin full-node on a Raspberry Pi 3+; please feel free to proceed with the instructions below or visit my blog-post featuring an in-depth screencast via YouTube for additional guidance, which will be released later next month (mid-September 2019)- enjoy! Thanks.

Parts List

  1. Raspberry Pi 3 B+.
  • Please note, this demonstration does require at least a Raspberry Pi B + (also note, as of this tutorial release date (08/25/19) there is no stable Ubuntu distro available for Raspberry Pi 4 models).
  1. Samsung 512GB 100MB/s (U3) MicroSDXC Evo Select Memory Card with Adapter (MB-ME512GA/AM).
  2. Mouse and Keyboard.
  3. HDMI monitor.
  4. CAT-5/6E cable.

Download and Ubuntu Server for Raspberry Pi 3 B+

  1. Go to Ubuntu and download Ubuntu Server for Raspberry Pi 3 (scroll-down the page and click on link "Ubuntu Server image for Raspberry Pi 3").
  2. Download The Unarchiver tool (available for free download at the Apple App Store) to unpackage server and unpack image file "ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz" so it formats to "ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz" to burn on the Samsung MicroSDXC.
  3. Input Samsung EVO-select MicroSDXC to dock and connect to computer via USB; download the appropriate SD-card formatter compatible with your OS to prepare this tutorial at the SD association OR you can use the Disk Utility tool in macOS Mojave- format SanDisk for FAT-32.
  4. Burning the unarchived Ubuntu Raspberry Pi 3 image-file (n00bs- download and use the balenaEtcher tool.) For Power-users:
    • diskutil list
    • sudo diskutil unmount /dev/your-SANDISK-BOOT-Identifier (eg sudo diskutil unmount /dev/disk4s1).
    • sudo dd bs=1m if=ubuntu-18.04.3-preinstalled-server-arm64+raspi3 of=/dev/disk4 conv=sync
    • You can use the shortcut Ctrl + T to check the progress of the write process.
  5. Insert SSD into Raspberry Pi 3 B+

Prepare Raspberry Pi B+ for Ubuntu Server Install

  1. Insert SSD containing burned Ubuntu Server ISO-file into Raspberry Pi.
  2. Turn-on Raspberry Pi.
  3. After configuring Raspberry Pi user-authentication credentials, run the following commands to update the the Ubuntu Server environment (default Ubuntu Server username is "ubuntu" and default password is "ubunutu"; you will be prompted to enter a new password).
  4. sudo apt-get update.
  5. sudo apt-get upgrade.
  6. sudo reboot.
  7. For the sake of InfoSec, set-up an easy firewall for the Raspberry Pi 3+ in Ubuntu Server by running sudo apt install ufw, followed by the sequence of commands below:
    • sudo ufw allow 8333 comment "Bitcoin mainnet
    • sudo ufw enable
    • Then recommend rebooting with sudo reboot
  8. Lastly, you can skip this step if you don't plan to remotely access this device on your network, but may be a good idea to prepare just in case:
    • Run ifconfig -a to list the host-IP address.
    • sudo apt-get install openssh-server
    • sudo ufw allow 22
    • sudo reboot
    • After running the above commands here in step-8 and then rebooting, you will have the option to remotely access this Raspberry Pi 3 B+ from another computer on network, which will be required if you're unable to synchronize your full-node by limiting the memory-cache on-board; basically, you will be forced to download and run a full-node briefly on another computer attached to your network and after a complete download, secure copying it from one terminal to another- please proceed to secure copy below if that becomes the case.

Install Bitcoin Core

  1. sudo apt-add-repository ppa:bitcoin/bitcoin
  2. sudo apt-get update
  3. sudo apt-get install bitcoind
  4. After running the aforementioned commands, you must configure your router for port-forwarding at your Raspberry Pi local-IP address- to that run, ifconfig -a.
  5. Note the local/host-IP address for the Raspberry Pi after running the previously mentioned command and access the "Port-Forwarding" options within your router and set the local/host-IP address to forward at port: 8333 (this does require some technical expertise about your local-network infra/InfoSec- only proceed if you're comfortable and knowledgable about your network topology).
  6. For the RaspberryPi, you will need to limit the memory required to initially synchronize blocks; to do this, run bitcoind -dbcache=30 && --maxconnections=8 (you can also chance bitcoind -dbcache=50 && --maxconnections=8 but the "30" is a safe-bet); after the first successful download, you can run bitcoind -printtoconsole to restart the node (as you would on a regular computer without RAM limitations) and the entire Bitcoin ledger should begin successfully downloading to your Raspberry Pi- please note, this will probably require an entire day to download every transaction recorded on the network since January 3, 2009.
    • You can also download the entire full-node on another device and then transfer the 'blocks' and 'chainstate' folders to the Raspberry Pi as well; we'll cover that in the below section.
  7. Confirm that your Bitcoin FullNode hosted on your Raspberry Pi by retrieving your public-IP address by running curl within the terminal and visiting Bitnodes; look beyond the fold of the web-page and your Raspberry Pi public-IP address should automatically populate for verififcation with port 8333 suffixed- click "Check Node" to confirm success!
    • For future reference, Bitnodes also offers a convenient one-line for downloading and installing curl | sh but since this is a tutorial-demonstration, it's probably better to proceed with this tutorial first to understand the process before installing the convenient one-liner :)
  8. The Bitcoin-Core file downloads as hidden files so they will not appear in the default Ubuntu server path simply by running ls; you must run ls -a to access the hidden files contained within the default directory (assuming that's where you downloaded it as instructed by this tutorial)- it should appear as '.bitcoin' within the directory, so to access run cd .bitcoin, which is where the "blocks" and "chainstate" folders are stored.

Secure Copy from Another Bitcoin Full-Node to the Raspberry Pi 3 B+

  1. If your Raspberry Pi 3+ is unable to download the entire Bitcoin ledger (aka full-node), you can temporarily run a node from another device on your network and then copy over to the Raspberry Pi 3 + Ubuntu server upon completion.
  2. In the Raspberry Pi 3 + Ubuntu Server terminal, run pwd; it should return a file path within the terminal output (e.g. /home/ubuntu/).
  3. ls -a to access the hidden files contained within the default directory (assuming that's where you downloaded it as instructed by this tutorial)- it should appear as '.bitcoin' within the directory, so to access run cd .bitcoin, which is where the "blocks" and "chainstate" folders are stored.
  4. The command-syntax will resemeble scp -r /local/directory/ username@to_host-ip:/remote/directory/
    • e.g. sudo scp -r local-computername/directory/.bitcoin/blocks ubuntu@
  5. After successfully transferring both "blocks" and "chainstate" folders from the other computer on network hosting the completed Bitcoin full-node to the Raspberry Pi 3 +, restart + Ubuntu Server by running sudo reboot.
  6. After logging-in to Ubuntu Server, you can always start the Bitcoin full-node, simply by running bitcoind -daemon and safely stop by running bitcoin-cli stop; other handy commands are listed below:
    • bitcoin-cli -getinfo
    • bitcoin-cli getnworkinfo
    • bitcoin-cli getwalletinfo
    • bitcoin-cli getblockchaininfo
    • bitcoin-cli getpeerinfo
    • bitcoin-cli getconnectioncount

Ubuntu 18.04.02 Bionic Mate

  1. After downloading the entire Bitcoin full-node on your Raspberry Pi 3 B+, you have the option of running a liter version of Ubuntu Desktop on your Raspberry Pi 3+- or Ubuntu Mate Desktop- simply run the following commands.
  2. sudo apt update && sudo apt upgrade -y
  3. sudo apt install ubuntu-mate-desktop
  4. sudo reboot upon reboot, you can log-in to the Ubuntu Mate desktop by entering your original credentials configured for Ubuntu Server.
  5. If you click on the App-button in the top-left corner of the Ubuntu Mate desktop and search for "Bitcoin" it will highlight the Bitcoin Core app originally downloaded in Ubuntu Server- click on the icon or hit "enter" on your keyboard and it will launch the app; you can now send and receive Bitcoin payments on its wallet- enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.