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.
- 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).
- Samsung 512GB 100MB/s (U3) MicroSDXC Evo Select Memory Card with Adapter (MB-ME512GA/AM).
- Mouse and Keyboard.
- HDMI monitor.
- CAT-5/6E cable.
- 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").
- 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.
- 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.
- 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
(egsudo 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.
- Insert SSD into Raspberry Pi 3 B+
- Insert SSD containing burned Ubuntu Server ISO-file into Raspberry Pi.
- Turn-on Raspberry Pi.
- 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).
sudo apt-get update
.sudo apt-get upgrade
.sudo reboot
.- 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
- 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.
- Run
sudo apt-add-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind
- 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
. - 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).
- 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 chancebitcoind -dbcache=50 && --maxconnections=8
but the "30" is a safe-bet); after the first successful download, you can runbitcoind -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.
- Confirm that your Bitcoin FullNode hosted on your Raspberry Pi by retrieving your public-IP address by running
curl https://ipinfo.io/ip
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 https://bitnodes.earn.com/install-full-node.sh | 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 :)
- For future reference, Bitnodes also offers a convenient one-line for downloading and installing
- 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 runls -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 runcd .bitcoin
, which is where the "blocks" and "chainstate" folders are stored.
- 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.
- In the Raspberry Pi 3 + Ubuntu Server terminal, run
pwd
; it should return a file path within the terminal output (e.g./home/ubuntu/
). 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 runcd .bitcoin
, which is where the "blocks" and "chainstate" folders are stored.- 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 [email protected]:/~/.bitcoin/blocks
- e.g.
- 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
. - After logging-in to Ubuntu Server, you can always start the Bitcoin full-node, simply by running
bitcoind -daemon
and safely stop by runningbitcoin-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
- 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.
sudo apt update && sudo apt upgrade -y
sudo apt install ubuntu-mate-desktop
sudo reboot
upon reboot, you can log-in to the Ubuntu Mate desktop by entering your original credentials configured for Ubuntu Server.- 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!