Build CLI Wallet on Raspberry Pi3

The operating system is Raspbian Stretch, so I assume this tutorial will work for debian stretch as well.

Start by opening a terminal and paste the following code to install dependecies:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install autoconf libtool libssl1.0-dev libboost-all-dev libminiupnpc-dev -y

Because compiling can take up a large amount of RAM and the raspberry Pi only has 1 gigabyte of it, let us create a swapfile:

cd /
fallocate -l 4G swapfile
chmod 0600 swapfile
mkswap swapfile
swapon swapfile

Now, because the daemon requires Berkeley database version 4.8 to work, we need to download, compile and install it since that is not included in the software repositories.

cd ~/Downloads
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx
make
sudo make install

Now, let us download the denarius source code and compile it.

cd ~/Downloads
git clone https://github.com/carsenk/denarius.git
cd denarius/src

Because we use a custom Berkeley library, we need to specify its location in the makefile, so go ahead and open that up using nano:

nano makefile.unix

look for this line:

DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(CURDIR)/json $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))

Change it to this line:

DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(CURDIR)/json $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH) /usr/local/BerkeleyDB.4.8/include/)

Press CTRL+O to save the file, press enter to verify the filename, then press CTRL+X to exit nano.

Now we are ready to compile it!

When you have typed in this command, prepare to wait for a while, maybe grab a good book or go to the denarius gitter chat to socialize.
Compiling took 63 minutes on my Pi, it will depend on your swapfiles read/write performance and if you have overclocked your Pi.

make -f makefile.unix -j4 LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"

Now since we are using a custom library, we need to tell the operating system to let programs use that. To do that, we need to edit the file /etc/ld.so.preload:

nano /etc/ld.so.preload

Add the following line to the file, then save and exit, like before:

/usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so

and reboot:

sudo reboot

Leave a Reply

Your email address will not be published. Required fields are marked *