Installing Stratis Full Node On Raspberry Pi

Introduction

 
This article demonstrates and explains the process of installing and setting up Stratis Full Node on Raspberry Pi.
 

Raspberry Pi

 
The Raspberry Pi Foundation is a UK-based registered educational charity. The Raspberry Pi is a small, low-cost computer the size of a credit card that connects to a computer display or television and utilizes a conventional keyboard and mouse. Raspberry Pi allows anyone of any age to learn to program in a variety of programming languages. It is a little computer with computing skills. The Raspberry Pi has a lot of features, including the capacity to interface with the outside world and many other computer functions, such as accessing the internet and playing high-definition video, as well as spreadsheets, word processing, and gaming. 
 
To learn more about Raspberry Pi, you can enroll yourself into the C# Corner Internet of Things learn series.
 

Stratis Platform

 
Stratis Ltd. is the creator of Stratis Platform, a blockchain technology platform for enterprises to build enterprise-grade blockchain-based solutions using Microsoft’s .NET framework and C# language. Stratis Platform is easy to learn, adapt, and integrate with existing enterprise applications. Stratis offers both public blockchain and private blockchain solutions. Stratis’s product offerings include Distributed Ledger Technology (DLT), Identity Platform, Supply Trust, STO Platform, DiFi, and Smart Contracts written in C# and executed on native .NET CLR makes it appealing to companies that want to build blockchain solutions on Microsoft stack.
 
Visit here to learn more about Stratis Platform.
 

Blockchain 

 
A blockchain is a growing list of records, known as blocks, that are cryptographically linked together. A cryptographic hash of the preceding block, a timestamp, and transaction data are all included in each block (generally represented as a Merkle tree). To get into the hash, the timestamp validates that the transaction data existed when the block was published. Each additional brick reinforces the ones before it, forming a chain. 
 
To know more about Blockchain, visit the C# Corner Blockchain category. 
 

Blockchain Full Node 

 
In a distributed network, there are a lot of computers connected. Each computer is called a node. A node is a point of intersection or connection within the network. It can act as both a redistribution point or a communication endpoint. A Blockchain full node is a node on a Blockchain network.
 
Every block and transaction is downloaded and checked against Blockchain's consensus rules by full nodes. Even if every other node on the network considers a transaction or block is acceptable, it is rejected if it defies the consensus rules. Miners have limited power on full nodes: they can only rearrange or delete transactions, and only with a lot of computational power. Although a powerful miner may carry out certain major assaults, full nodes rely on miners for just a few things, therefore miners cannot fully modify or destroy the Blockchain. 
 
To know about Stratis Full Node, visit here.
 

Pre-Requisite

 
Before starting, you need to have Raspberry Pi with either Rasbian or Linux or Ubuntu or any of the operating systems of your choice installed.
 
If you wish to buy Raspberry Pi, you can visit here.
 
Raspberry Pi 4 is the latest Pi hardware version. You can have a look at the following to learn more about it,
 
 

Important Points to remember

  1. I am assuming that you have installed and configured your OS with remote login.
  2. I am using Raspberry Pi 3 Model B with Raspbian OS. For remote login, I am using AnyDesk.
  3. Raspberry Pi 3 is a 32-bit machine and Raspberry Pi 4 is a 64-bit machine, so download the resources accordingly.

Quick Fix - Download package on Raspberry Pi

 
Use the following command to download any package on Raspberry Pi:
sudo apt install [package-name]

Installing Dot Net 

 
Stratis Full Node is based on C#.Net, so we need to install the dotnet framework onto the Raspberry Pi. This involves 2 steps,
  1. Downloading the binaries from the StratisFullNode Github repository 
  2. Extracting the downloaded repository and copying it into the root directory

Downloading DotNet

 
Open the terminal by clicking CTRL+ALT+T or you can click on the terminal button on the top left side.
 
Type the following command and hit enter,
  • Raspberry Pi 4
    sudo curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz 
  • Raspberry Pi 3
    sudo curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm.tar.gz 
In the above commands,
  • "sudo" is used to access system resources with admin rights
  • "curl -SL" is used to download the "dotnet-sdk-latest-linux-arm.tar.gz" file
  • "-o dotnet.tar.gz" is used to rename the downloaded file

Installing DotNet 

 
After the downloaded is finished. We need to create a system folder to copy the extracted file contents, this can be done using the following command,
sudo mkdir -p /usr/share/dotnet  
Next, we will copy the extracted tar.gz onto that folder using the command,
sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet  
Now we will create a symbolic link, so that system can find where it had to look for dotnet,
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet  
A symbolic link is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.
 
So, we are done installing DotNet. You can verify the installation by typing in "dotnet" and you will get something like the following,
 
dotnet
 
If you encounter any errors, please start from the beginning.
 

Installing StraxNode (Stratis FullNode)

 
Since we have successfully downloaded the DotNet, we can now move on to downloading and setting up the Stratis Full Node.
 
You can download it using the following commands, 
  • Raspberry Pi 4
    sudo wget -O SNode.zip https://github.com/stratisproject/StratisFullNode/releases/download/1.0.7.3/Stratis.StraxD-linux-arm64.zip  
  • Raspberry Pi 3
    sudo wget -O SNode.zip https://github.com/stratisproject/StratisFullNode/releases/download/1.0.7.3/Stratis.StraxD-linux-arm.zip  
In the above command:
  • "sudo" is used to access system resources with admin rights
  • "wget is used to download the "Stratis.StraxD-linux-arm.zip" file
  • "-O Snode.zip" is used to rename the downloaded zip file
Note 
I am installing version 1.0.7.3, make sure to download the latest version from the Official GitHub Repository.
 
We will then be extracting the downloaded zip file to the StraxNode folder using the following command:
sudo unzip SNode.zip -d ~/StraxNode  
Congratulations, we are done installing and setting up the Stratis FullNode on Raspberry Pi.
 

Starting the Stratis FullNode

 
Once we are done installing, the final step includes running the node. We run the FullNode using the command,
sudo screen dotnet ~/StraxNode/Stratis.StraxD.dll run -mainnet  
In the above command,
  • "screen" package is used to open/fork a virtual terminal on top of the current terminal.
  • "dotnet" is used to run the dotnet application
  • "mainnet" is the default network, on which we deploy the blockchain. If you want you can use "testnet".
You need to run the above command every time you need to start the FullNode, or you can make it a daemon process so that I can start every time you boot the Pi.
 
Once we run the command we would be getting an output like the following,
 
stratis
 
In order to make it a background process, use shortcut Ctrl+A and then Ctrl+D.
 

Quick Fix - Screen not working

 
It may be possible that "screen" may not run on your pi, so you can run the command without using "screen".
 

Quick Fix - FullNode not starting

 
If you are facing difficulties in starting the FullNode make sure to run the following command,
sudo find /root/.stratisnode/ -mindepth 1 ! -regex '^/root/.stratisnode/strax/StraxMain/wallets\(/.*\)?' -delete  

And then reinstall the Stratis FullNode.

Note
If you have configured a wallet on your system,
  1. Please make sure you have a backup of your wallet before proceeding.  
  2. If you want to delete both the FullNode and Wallet use the following command:
    sudo rm -r /root/.stratisnode/  

Points to remember 

  1. Whenever you want to stop FullNode use "CTRL+C". And that also only one time, otherwise it would not shut down safely, which will eventually corrupt the whole blockchain.
  2. If you closed the wallet before it has not fully synched, you may not be able to restart the FullNode, as one of the blocks may get corrupted. So make sure you reinstall StratisNode.
     
    Stratis Development Team is working to solve this issue. And shortly, you will get the version with an automatic ReSync facility. 
Watch the following complete video, to install and configure Stratis FullNode on Raspberry Pi.
 
 

Conclusion

 
We successfully installed and configured the Stratis Full Node on Raspberry Pi. For any doubts or clarification, feel free to visit Stratis Discord.
 
Visit C# Corner to find answers to more such questions.
 
If you have any questions regarding any other technology do have a look at the C# Corner Technology Page.


Similar Articles