Walkthrough: Building an RPi3 Safex node

Firstly, let me say… I’m no expert at this stuff. But, I got it up and running with this method.

The following walkthrough is provided for those who wish to follow it. No promises that it will work, or that the steps listed are the best way to achieve success. There may be unnecessary steps included, particularly during the conversion to USB bootable, but this is simply a record of what i did to get it going.

Please use at your own risk - during syncing, expect temperature warnings, even with heatsinks installed.

Equipment:

  • Internet Connection
  • RPi3 (Ensure you put heatsinks on the chips) and power supply
  • 8Gb Micro SD Card (& adapter for your PC, if no direct slot)
  • 32GB USB Stick
  • HDMI Cable
  • Monitor with HDMI input
  • Keyboard & Mouse
  • PC with:

Instructions:

On your PC, download the latest Raspbian Lite version from:

https://downloads.raspberrypi.org/raspbian_lite_latest

Extract Raspbian Lite to a folder using 7Zip

Burn the extracted Raspbian image to the Micro SD Card

Install Rasbian Lite as per https://pimylifeup.com/how-to-install-raspbian/ (When first booted up, the login is pi and the password is raspberry)

sudo raspi-config

  • Expand the Filesystem in Advanced Options
  • Connect to internet – set network settings for wifi if not connecting via Ethernet cable
  • Set Localisation for your specific requirements
  • Optional: change Hostname
  • Click Finish to exit

sudo reboot (if it doesn’t automatically prompt to reboot)

Login after reboot

By all accounts, USBs are far more resilient than SD cards with the read/write frequency of a blockchain node. So we will convert the RPi to be USB bootable and run the OS off USB.

Now prepare for changing to USB boot mode, as per https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

sudo apt update

sudo apt full-upgrade

echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt

sudo reboot

Login again after reboot

vcgencmd otp_dump | grep 17:

should now give the result 17:3020000a

Shutdown your RPi with

sudo shutdown –h now

Once shutdown is complete, pull the power cord from the RPi

Prepare your USB stick by flashing Rasbian Lite using balenaEtcher

Remove Micro SD Card from the RPi and insert USB stick into it

Insert power cord and wait 10-20 seconds for it to start booting from USB

When first booted up, the login is pi and the password is raspberry

sudo raspi-config

  • Set GPU memory to 16 in Advanced Options
  • Change the password
  • Connect to internet – set network settings for wifi if not connecting via Ethernet cable
  • Set Localisation for your specific requirements
  • Optional: change Hostname
  • Click Finish to exit

sudo reboot

Login after reboot (remember to use your new password)

sudo apt update

sudo apt full-upgrade

sudo reboot

Go to https://www.bitpi.co/2015/02/11/how-to-change-raspberry-pis-swapfile-size-on-rasbian/

sudo nano /etc/dphys-swapfile

Change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=4096

Change CONF_MAXSWAP=2048 to CONF_MAXSWAP=4096

Control-X

Y

Enter

sudo /etc/init.d/dphys-swapfile stop

sudo /etc/init.d/dphys-swapfile start

sudo reboot

Login

Go to the SafexNews tutorial video: https://youtu.be/m-uknb-Egtg

Watch the video, just to get an idea of what you need to do

Install the dependencies listed in the safexcore + git

sudo apt update && sudo apt install git build-essential cmake pkg-config \
    libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libminiupnpc-dev \
    libunwind8-dev liblzma-dev libreadline6-dev libldns-dev libexpat1-dev \
    libgtest-dev doxygen graphviz libpcsclite-dev libprotobuf-dev

git clone --recursive --https://github.com/safex/safexcore.git

cd safexcore

mkdir build

cd build

cmake ..

cd ..

make release-all

THIS WILL TAKE HOURS- possibly more than 24hrs

cd..

sudo nano /etc/dphys-swapfile

Change CONF_SWAPSIZE=4096 to CONF_SWAPSIZE=100

Change CONF_MAXSWAP=4096 to CONF_MAXSWAP=2048

Control-X

Y

Enter

sudo /etc/init.d/dphys-swapfile stop

sudo /etc/init.d/dphys-swapfile start

sudo reboot

Login

cd safexcore/build/release/bin

./safexd

Wait for blochchain to sync… this will take days. monitor the RPi temperature warning during syncing and apply cooling if necessary.

You now have a low power safex node.

Attempting to mine with the RPi3 node is futile, so don’t bother trying. There’s simply not enough L3 memory on the cpu.

3 Likes