Jump to content
DenariusTalk
KawaiiCrypto

Building denariusd on Raspberry Pi 3

Recommended Posts

I bought a Raspberry Pi 3 a while ago and got it recently. So of course I decided to run my denarius wallet on it, so it can stake always without my computer being on.

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 /
dd if=/dev/zero of=swapfile bs=1M count=4000
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


Now, your denariusd is ready to run and you set it up like you always would. 

  • Like 4
  • Upvote 1

Share this post


Link to post
Share on other sites

Awesome tutorial @KawaiiCrypto B|

...If you want to run the full Denarius QT Wallet on a Raspberry Pi 3, then do the following:

Install the deps, you may only need to install libqt4-dev and libqrencode-dev packages if you followed the tutorial above.

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev libboost-all-dev libminiupnpc-dev libqt4-dev libprotobuf-dev protobuf-compiler libqrencode-dev -y

Then install the final dependency needed for Denarius QT, this is an alternative method to Kawaii's above that does not require you to compile the Berkeley DB 4.8

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev

Create the swapfile on your Pi (same as Kawaii's above) so that you can compile the code, since it has only 1GB of RAM. This creates a 4GB Swapfile.

cd /
dd if=/dev/zero of=swapfile bs=1M count=4000
chmod 0600 swapfile
mkswap swapfile
swapon swapfile

Then we just need to clone our Denarius repository:

cd ~/Downloads 

git clone https://github.com/carsenk/denarius.git 

cd denarius

Once inside our denarius directory, we need to tell Qt (qmake) to setup our makefile for compiling:

qmake "USE_LEVELDB=1" "USE_UPNP=1" "USE_QRCODE=1" denarius-qt.pro

USE_LEVELDB=1 is required, USE_UPNP and USE_QRCODE are optional.

Now we are finally ready to make!

make -j4

(4 is the number of cores of your processor that you want to use for compiling, generally on the Pi3s you can use 4 cores)

Once it is done building and if you didn't get any errors you will be able to run the following to launch the Denarius QT Wallet!

./Denarius

If you run into any issues during the first time trying to make the QT, try going into the /src directory from Kawaii's tutorial above and compiling the denariusd first and then compile the QT. (Also when compiling denariusd in Kawaii's tutorial, you can avoid having to edit any makefiles by installing the Berkeley DB 4.8 from the PPA I listed above).

PeHgTnx.jpg

  • Thanks 1

Share this post


Link to post
Share on other sites
15 hours ago, buzzkillb said:

This is what it says after running ./Denarius
"Denarius: cannot connect to X server"

No errors in the compile. Will try kawaii's guide next and see if that changes anyhting.

Sounds like it is potentially a permissions issue with your X server on your OS install. You can try the below to set the permissions to the root user.

You need to allow the root user access to the X server:

xhost local:root

And point the command to the right DISPLAY:

sudo DISPLAY=$DISPLAY gedit /etc/profile
  • Upvote 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×