Setting up DigiByte Core on a Raspberry Pi 3/4

Yoshi Jäger
Jun 27 · 7 min read
Raspberry Pi 3B+: Running DigiByte Core without OOM issues

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

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 [1] 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 [2]).

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.

In this screenshot you can see that my digibyted is running on my Raspberry Pi 3B+ since 8th June, 2019. More importantly look at the virtual memory: 5.69 GB.

Where to start?

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

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"
mkswap "$SWAP"
chmod 0600 "$SWAP"
swapon "$SWAP"

Verify your SWAP device using

# This should output your SWAP device
cat /proc/swaps

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:

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

Continue with

# unmount the device, if it was mounted automatically
umount /dev/sda1
# 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

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
adduser $USER
usermod -aG sudo $USER

Login as the user you want to have digibyte running:su $USER

# Switch to homedir
# 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 && cd digibyte
# Start compilation. Note that you should install a compatible BerkeleyDB, but it requires additional steps
./configure --with-incompatible-bdb
make -j4

2) Using a cross-compiler to compile DigiByte for ARM systems

This guide shows you how to do it properly:

3) Using our precompiled binaries

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.

Performance optimizations

  1. 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 /swapfile should point to the SSD.
  2. 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)
  3. Run DigiByte Core using your desktop computer in order to download the block files and copy them to the Raspberry using scp
  4. Limit the number of connections by creating $HOMEDIR/digibyte.conf and 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.

Big news!

Official blueprint illustration of the new Raspberry Pi 4 (Copyright 2019 Raspberry Pi Foundation)

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.


Well, it’s fine like that :-)