Having received multiple requests on how to run the DigiByte Core on a Raspberry Pi 3, finally the time has come to fulfill these requests (IT WAS DUE!)
Running it on a Raspberry Pi 3 is — by no doubt — an interesting and cheap method of running your own DigiByte node at home, which is not only a true commitment to the distribution of the network but also let’s you feel nerdy, being part of a giant revolution.
Please be informed that the steps described in this article are for education purposes only. It is at your own risk and I am not accountable for any loss or damages which might occur due to the steps described in this article.
Requirements and why it doesn’t work with the default setup
DigiByte is the fastest and secure PoW blockchain that currently exists — as of June 2019 — capable of processing 560+ transactions PER SECOND.
However, this comes with a caveat. It needs to handle more blocks than other available products, and thus results in a bigger memory footprint as pieces of information about each block are kept in (runtime-) memory.
Multiple trials of optimizing the memory footprint only resulted in a very complex pull request, which probably introduces new bugs and issues.
The third generation of the Raspberry Pi includes 1GB of RAM, which clearly isn’t enough to keep 10 millions of block entries in memory. Usually you can still run the application, by enabling SWAP  on your system, which would put the least used memory pages of your application to your disk, being able to load them into the memory again, if required. Modern systems can therefore still run high-memory footprint applications. Since your HDD/SSD is slower than the RAM, offloading, loading and managing pages takes notably longer opposed to having enough RAM (see ).
So, are we fine by just enabling SWAP memory on our Raspberry Pi 3th Gen?
The answer would be: YES, but actually it is NO.
I don’t want to tease you. But in this case there is one serious limitation: address space.
Basically 32 bit operating systems can not address more than 4 GB of virtual memory. At least 5 GB are required for the current DigiByte daemon.
The default setup of a Raspberry Pi 3th Gen comes with a 32 bit operating system, although carrying a 64 bit CPU. For most of you that is Raspbian or NOOBS.
32 bit is old school as hell, considering that 64 bit was largely introduced in consumer desktop machines by 2003+.
As I said, the Raspberry Pi comes with a 64 bit CPU, that is, theoretically and practically enabling us to use the SWAP technology described above.
Where to start?
You can’t just install any 64 bit operating system. The Raspberry Pi is designed to be very energy efficient which is the reason it carries a ARM based CPU. That is not unusual, considering that your mobile phones most likely is ARM based as well.
The first thing you gotta do (after doing a backup of your current Raspberry Pi) is to flash your SDCard using a 64 bit operating system. There are some out there:
You should stick to Ubuntu Server as this is the one on which I ran DigiByte Core flawlessly and you will probably have proper support. I will stick to Ubuntu Server during this article.
Install it according to this guide installation media instructions or the way you used to flash your SDCards. There is really nothing special to note.
Configuring the system
If you have managed to install the operating system on your SDCard, you should be able to login using the default credentials: ubuntu (pw: ubuntu).
Switch to root using:
sudo su (password: ubuntu)
and configure SWAP:
# change the SWAP variable if you want to use a different path
swapoff -a# I have chosen 6GB for the SWAP size which should be more than enough!
fallocate -l 6000M "$SWAP"
chmod 0600 "$SWAP"
Verify your SWAP device using
# This should output your SWAP device
and make it permanent by adding a fstab entry and reboot
echo "$SWAP none swap defaults 0 0" >> /etc/fstab
At this point, you should already have your system ready to run the official DigiByte Core.
If you would like to put your swapfile to an external drive:
Attach your USB device (in my case it’s a simple 32GB USB stick formatted with FAT32) and determine the device filename using:
dmesg | tail
which gives us
[1792368.237723] sd 0:0:0:0: Attached scsi generic sg0 type 0[1792370.064837] sd 0:0:0:0: [sda] 62652416 512-byte logical blocks: (32.1 GB/29.9 GiB)[1792370.065717] sd 0:0:0:0: [sda] Write Protect is off[1792370.065733] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00[1792370.066583] sd 0:0:0:0: [sda] No Caching mode page found[1792370.089302] sd 0:0:0:0: [sda] Assuming drive cache: write through[1792371.917445] sda: sda1
# unmount the device, if it was mounted automatically
umount /dev/sda1# WARNING: THIS WILL DELETE ALL FILES ON YOUR USB DEVICE
# Format the drive as ext4
mkfs.ext4 /dev/sda1# create a directory for the usb stick
mkdir -p /media/usb# mount the usb stick
mount /dev/sda1 /media/usb
Repeat the steps in Configuring the system but using SWAP=/media/usb/swap
Ways to install the DigiByte Core
1) Using the Raspberry to compile DigiByte Core
For this solution you don’t need a cross compiler, but it takes AGES (~5 days). However, you can still try it, if you have enough time:
Add a new user (you can skip this part if you like to use the default user)
# change this, if you wish to have another username than digibyte
usermod -aG sudo $USER
Login as the user you want to have digibyte running:
# Switch to homedir
cd# Update your system and install dependencies
sudo apt-get update
sudo apt-get install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev
sudo apt-get install -y libdb-dev libdb++-dev# Download the recent source code
git clone https://github.com/digibyte/digibyte.git && cd digibyte# Start compilation. Note that you should install a compatible BerkeleyDB, but it requires additional steps
2) Using a cross-compiler to compile DigiByte for ARM systems
This method should result into working binaries very quickly, but it is more difficult to setup.
This guide shows you how to do it properly: https://github.com/digibyte/digibyte/blob/master/doc/gitian-building.md
3) Using our precompiled binaries
You can always use our precompiled binaries, which is the easiest way.
Be careful from where you download the binaries. The only correct URL is our official GitHub. Choose to download the aarch64 build, which runs fine on the RPi3.
It is highly recommended to apply these steps in order to save some performance:
- Use a SSD or USB Flash Storage, instead of a MicroSD card. This will result in a notably faster Raspberry, specifically in that use case. The
/swapfileshould point to the SSD.
- Use Wifi instead of an Ethernet cable (as the Ethernet hub and the USB-connectors share their bus, and Wifi is using a separate bus)
- Run DigiByte Core using your desktop computer in order to download the block files and copy them to the Raspberry using
- Limit the number of connections by creating
$HOMEDIR/digibyte.confand adding the following restrictions:
maxconnections = 5
minrelaytxfee = 0.0000005
limitfreerelay = 0
Note that your Raspberry Pi 3th Gen will be operating very slow. You may have to wait sometimes about a minute until the low-cost device responds.
Just after buying myself a Raspberry Pi 3B+ and while writing this article the Raspberry Pi Foundation released a brand new model: The Raspberry Pi 4B. If you plan to buy a Raspberry Pi in order to operate a DigiByte node, please stick to the new model.
It supports up to 4GB of LPDDR4–2400 SDRAM, which will definitely be more appropriate than 1GB. Also the CPU operates a bit faster, as operates on 1.5 GHz now. If you follow my list of performance optimizations, the USB-3.0 will come in handy, too.
You may stick to this guide as well, if you plan to install DigiByte Core on the Raspberry Pi 4th Gen.
Big thanks to my friend Josiah Spackman, who helped me out when I didn’t realize what I was doing — while trying to cross compile the binaries for the arm64 architecture. This article could have been released way before the release of the Raspberry Pi 4.
Well, it’s fine like that :-)