I somehow got LOC token coins which were migrating from ETH network to new Hydra chain. Speaking about coins next time now I wanna share how I setup Rpi4 and Hydra wallet for staking.

I bought Rpi4 with maximum RAM and with 1TB SSD as originally I wanted to play with BTC full node and LN. But I diverged my plan after a while to Hydra as it promised around 70% APY reward. I am going to share what steps I took to setup Rpi and the wallet as it wasn’t straight forward.

Rpi4 setup

Imagine you buy Rpi, have some microSD card and want to run Linux from SSD as your goal is to run full BTC node. Where to start? Great start is to prepare SD card and put Raspberry Pi OS on it (https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/2). As I don’t have external keyboard nor microHDMI cable I wanted to set everything via SSH. For that you need to enable SSH on first boot, the post (https://www.raspberrypi.org/documentation/computers/remote-access.html) is straight forward, you need to create file with ssh name in boot partition. Same page also helps with finding what is the IP address associated with Rpi when you connect it to computer via cable. I used arp -a command to list all interfaces and associated address on my MacOS. As I allowed to share internet I was searching for bridges and one of them had IP address 192.168.2.2. Then connection is easy: ssh pi@192.168.2.2.

Now you are connected to Rpi which starts from SD card, how to configure it to start from SSD without SD card? (https://peyanski.com/how-to-boot-raspberry-pi-4-from-ssd/) or (https://www.maxinoha.cz/raspberry-pi-4-boot-z-ssd/) articles shows how to copy system from SD card to SSD and enable boot from SSD, but the copy tool is GUI application. How to copy that from console and e.g. expand partition? I used rpi-clone console application which is pretty straight forward to use (https://github.com/billw2/rpi-clone).

Building Hydra wallet

As we installed RPI OS, which is 64bit system we are gonna hit first issue, wallet deamon woudn't run when unpacking the downloaded 64bit Hydra release:

./hydrad
-bash: ./hydrad: cannot execute binary file: Exec format error

So continue with manual installation on Ubuntu: (https://github.com/Hydra-Chain/node):

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev
sudo apt-get install software-properties-common

We cannot add bitcoin repository as it is obsolete, but it is added only to have Berkley DB binaries. We need to build libdb4.8 on our own from source. All details can be found in this answer (https://askubuntu.com/a/976624).

$ 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

Tell your system where to find db4.8:

$ export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
$ export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
$ sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
$ sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so
$ sudo ldconfig

After that you can continue with compilation of Hydra

$ ./autogen.sh
$ configure  CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
$ make -j2

See we did tell configure where the libraries are. More details here: (https://vhernando.github.io/bitcoin-core-node-build-sources-debian)

After that we should also set LD_LIBRARY_PATH this way:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/libdb-4.8.so

And we are ready to run daemon to sync the chain history on the machine. Try to run from src folder

$ hydrad

Voala, it works. So now it is time to import your keys (https://docs.hydrachain.org/hydra-for-beginners#importing-your-key-using-the-cli-in-linux) or setup fresh wallet. After that you can start daemon to run on background:

hydrad -daemon

Solving issues

Once RPi wasn't reachable via SSH with error: kex_exchange_identification: read: Connection reset by peer. After restart I was checking /var/log/auth.log for any clues why sshd disconnected (https://raspberrypi.stackexchange.com/a/111734). I dug up the syslog with the

tail -f -n X /var/log/syslog

command (where X  is number of lines you want to display. I then noticed few lines mentioning a Voltage problem (sorry I did keep the exact terms).

Another fancy issue is when you want to connect old monitor with DVI-HDMI adapter. It could or couldn't work. Fix is easy. Either use raspi-config or edit /boot/config.txt and enable hdmi_force_hotplug=1.