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 /
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


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

Edited by KawaiiCrypto
fallocate instead of dd
  • 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 libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools 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_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

I tried compiling and running denariusd on a Raspberry Pi zero W running the raspbian stretch lite image without GUI, using 512 meg RAM and 2 GB Swap. Compiling took over 10 hours, but finally succeeded. Running denariusd on a pi zero W also seems to work quite well for now, because RAM usage stays around 300 meg.

  • Like 1

Share this post


Link to post
Share on other sites

The steps I used from Carsen's post above.

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:

sudo apt purge qt4*

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools

export QT_SELECT=qt5

qmake -v
qmake "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

Share this post


Link to post
Share on other sites

I am having trouble adding the BTC PPA

When I enter this line

sudo add-apt-repository ppa:bitcoin/bitcoin

I receive this error

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch

 

I've installed software-properties-common successfully before this

Ideas?

Share this post


Link to post
Share on other sites
1 hour ago, drcopperfield said:

I am having trouble adding the BTC PPA

When I enter this line

sudo add-apt-repository ppa:bitcoin/bitcoin

I receive this error

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 95, in <module>
    sp = SoftwareProperties(options=options)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist
    self.distro.get_sources(self.sourceslist)    
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch

 

I've installed software-properties-common successfully before this

Ideas?

That is a PPA for Ubuntu specifically, not Raspbian. "Error: could not find a distribution template for Raspbian/stretch" So try installing db4.8 with: sudo apt-get install libdb++-dev or the equivalent command for your OS.

 

Share this post


Link to post
Share on other sites
21 hours ago, drcopperfield said:

Thanks. Ended up doing full Berkeley install. I’m trying to compile the qt wallet now via Qt creator but receive an error regarding qmake. Do I need a specific kit or compiler? Currently only desktop kit installed. 

You do need full QT 5, my post above should include all the necessary packages.

Share this post


Link to post
Share on other sites
On 6/6/2018 at 6:28 AM, Carsen said:

You do need full QT 5, my post above should include all the necessary packages.

Really not sure what I am doing wrong here...

I manually installed the bitcoin repository info as I am using raspbian stretch

On running make I receive the eventual error:

Makefile:2440: recipe for target 'build/sendcoinsdialog.o' failed
make: *** [build/sendcoinsdialog.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:2492: recipe for target 'build/coincontroldialog.o' failed
make: *** [build/coincontroldialog.o] Error 1

I'm stumped

  • Like 1

Share this post


Link to post
Share on other sites
On 6/11/2018 at 3:26 AM, drcopperfield said:

Really not sure what I am doing wrong here...

I manually installed the bitcoin repository info as I am using raspbian stretch

On running make I receive the eventual error:

Makefile:2440: recipe for target 'build/sendcoinsdialog.o' failed
make: *** [build/sendcoinsdialog.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:2492: recipe for target 'build/coincontroldialog.o' failed
make: *** [build/coincontroldialog.o] Error 1

I'm stumped

Well it would be something with your deps that you have installed, I would go back from the beginning of the tutorial and go step by step again, maybe best to reinstall the OS on your Raspberry to know you are starting from scratch, probably from the ppa, try doing just a:

sudo apt-get install libdb4.8++-dev

If you could maybe paste more of your make compile here it would be helpful in knowing what the actual error it is that you are getting as well.

  • Upvote 1

Share this post


Link to post
Share on other sites

Thanks, will do.

Would you suggest using the instructions as per buzzkillb's post, or no matter? I think it may be something to do with the qmake vs qt creator versions, which I've tried to reconcile but no luck yet.

sudo apt purge qt4*

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools

export QT_SELECT=qt5

qmake -v

Share this post


Link to post
Share on other sites
On 6/13/2018 at 2:59 PM, Carsen said:

Well it would be something with your deps that you have installed, I would go back from the beginning of the tutorial and go step by step again, maybe best to reinstall the OS on your Raspberry to know you are starting from scratch, probably from the ppa, try doing just a:

sudo apt-get install libdb4.8++-dev

If you could maybe paste more of your make compile here it would be helpful in knowing what the actual error it is that you are getting as well.

Also I am using Raspbian stretch on a Pi 3+

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

×