Running a Decred Raspberry Pi Node

Running a full node is one of the strongest actions of support you can do for a peer-to-peer distributed protocol. Every single node that runs on the network adds strength and resilience to the consensus mechanism and is the embodiment of strength in numbers.

Running a Decred Raspberry Pi Node
Running a Decred Raspberry Pi Node

By Checkmate - Sep 2, 2019

Running a full node is one of the strongest actions of support you can do for a peer-to-peer distributed protocol. Every single node that runs on the network adds strength and resilience to the consensus mechanism and is the embodiment of strength in numbers.

At a personal level, running your own node is an excellent way to get hands on with the Decred protocol, Linux and the Raspberry Pi.

This is an inexpensive learning project with a large impact and a great learning curve.

Purpose of this Guide

This guide is will show you how to setup a Raspberry Pi Decred full node on a Raspberry Pi from start to finish. Anyone who can operate a Decred wallet is more than capable of setting up a Raspberry Pi DCR node.

Setting up a Raspberry Pi is well documented elsewhere so I will provide relevant links to help you along the way.

I intend this module to be accessible for all skill levels. As such I use a VNC server (remote desktop) which may help people ease into using SSH only command line. Skill should not prevent anyone running a Decred node!

Useful References

What you will need

Step 1 — Installing Raspbian OS

Installing the latest Raspbian operating system is well documented. Your process should be:

  1. Download the latest Raspbian image file
  2. Flash the SD Card using Etcher
  3. To set up your Pi headless (without a screen, keyboard and mouse) you will need to follow the steps here to connect the Pi to your WiFi and enable SSH. You can also hardwire the Pi with an ethernet cable to your router if you have trouble setting up the WiFi.

Step 2 — Setting up Remote SSH Connection

Here we will establish a remote connection to the Pi via SSH using PuTTy.

  1. Check the IP address of your Pi. Usually you can check this by logging into your router and looking at the list of clients if your Pi is properly connected.
  2. Whilst you are logged into your router, setup port forwarding for 9108 on your router (a guide here). If you find that once dcrd is running you are not connecting to peers (in Step-5), you may need to set your external IP in the router config and change firewall rules to properly get inbounds (without this your node will be outbound-only, which is less useful).
  3. Connect via SSH to your Pi using PuTTy with the IP address (default settings are fine). Once the IP is typed in, you can name and save for future access. Login using the raspberry pi defaults (username = pi, password = raspberry)

3. Run the following commands to update your Pi and install VNC Serversudo apt-get update
sudo apt-get upgrade
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer

4. Harden your Pi. This boosts the security of your Pi and makes it much harder for any attackers to get in. This process is covered in depth here. All steps are important.

Note — Hardening your Pi is the most important step in this process. Be sure to protect your digital and network security by following all steps in the guide.

5. Next we will edit the screen resolution settings in this config file so that it appears nicely on a standard Laptop screen when we connect via the VNC server.sudo nano /boot/config.txt

6. Edit the lines as shown in the image below (in white) by deleting the # and updating the resolution numbers. Hit Ctrl + O to write out the file and then Ctrl + X to exit back to console.

7. Next we need to enable VNC on the Pi by following the first few steps of this guide.sudo raspi-configInterfacing Options --> VNC --> YES

8. It is worthwhile rebooting your Pi at this stage, confirm you can login using your new credentials and changed password and connect both PuTTy SSH and VNC Viewer.

Step 3 — Download and install dcrinstall

  1. Login to your Pi via VNC viewer using the same IP address as you did earlier for SSH.
  2. Once you have logged into VNC and can see your Pi’s desktop, navigate to the dcrinstall github page and download the latest ARM release.

3. Once the file has downloaded, it will be located in your Downloads folder. Navigate here via the SSH command line (via PuTTy).

Note — From this point on, you do not require the VNC remote desktop and can do it all via SSH. However, I prefer to use VNC and then open up terminal within the Pi so I can see how dcrd is tracking and not lose my session when I close PuTTy.)cd ~/Downloads/

4. We need to set the file to be an executable before we can run it. dcrinstall will initiate the download and install of the required files for your node. (Note, be sure to update the file version as required in the script below if it is different, v1.4.0 at the time of writing).sudo chmod u+x dcrinstall-linux-arm-v1.4.0
./dcrinstall-linux-arm-v1.4.0

5. A folder called ./decred has now been placed in your home directory. It will take a short while (5mins) to download and setup all files.

Step 4 — Get dcrd running

  1. Now we navigate to the new decred folder to start up the node daemon dcrd (update version number as before if needed).cd
    cd ./decred/decred-linux-arm-v1.4.0
    ./dcrd

2. The Decred daemon will boot up and start connecting to peers

3. If you wish to setup a wallet on this node, open up a new version of terminal and run to following command and follow the prompts.cd
cd ./decred/decred-linux-arm-v1.4.0
./dcrwallet --create

Step 5 — Your Decred Node is Now Running!

  1. Your node (dcrd) is now connecting to new peers and syncing with the blockchain. If you goal is to support the network, you have succeeded and your little Pi is now successfully participating in consensus!
  2. If you open up a new session of terminal on your Pi, navigate to the decredinstallation folder and run dcrctl to access all functions for your wallet and node.cd
    cd ./decred/decred-linux-arm-v1.4.0
    ./dcrctl --help

Decreds official documentation has a guide for accessing all functions via dcrctl and controlling dcrd and dcrwallet.

Closing thoughts

Hopefully this was a useful step by step guide for setting up your first Decred full node. This is a great way to start learning and getting comfortable with command line, IoT and most importantly, contributing a small but powerful CPU to the Decred consensus engine.

The full node setup guide by Stakey.club remains a useful reference for additional and more advanced steps including setting up your node to run via TOR which is a recommended next step. Experiment and have fun learning along the way!

You can find me on Twitter (@_Checkmatey_) where I post regular content around the fundamentals and on-chain behaviour of Bitcoin and Decred.

You can also find me over at Ready Set Crypto where our team delivers the highest quality fundamental research and pairs it with sound technical analysis for the emerging digital economy.

All the Best,

Checkmate.

Thanks to Haon (@NoahPierau) for reminding me about port forwarding!