Staking STRAX On A Raspberry Pi

Introduction

In this article, I will demonstrate how you can set up Stratis Wallet and start staking on Raspberry Pi. Since Raspberry consumes very little power and computing resources so it can be kept online all time.

Proof of Stake

The Proof Of Stake method selects a node to be the validator of the next block using a pseudo-random selection process based on a mixture of parameters such as staking time, randomness, and the node's wealth. It's worth noting that blocks in Proof of Stake systems are referred to as "forged" rather than "mined." Proof of Stake cryptocurrencies frequently begin by selling pre-mined coins, or they begin with the Proof of Work method and then move to Proof of Stake. Whereas with Proof Work-based systems, more and more bitcoin is generated as an incentive for miners, the Proof-of-Stake method typically pays miners with transaction fees. Users that wish to participate in the forging process must deposit a particular quantity of coins as a stake in the network. The stake level influences a node's chances of being chosen as the next validator to generate the next block - the higher the stake, the better.

Advantages of PoS over PoW

  • Greater energy efficiency - mining blocks don't use a lot of energy.
  • Reduced entrance hurdles and hardware requirements — you don't need top-of-the-line technology to create new blocks.
  • Improved resistance to centralization – proof-of-stake should result in more nodes in the network – greater support for shard chains – a crucial upgrade in Ethereum network scalability

Staking

On a proof-of-stake (PoS) blockchain, staking is the process of actively engaging in transaction validation (similar to mining). Anyone with a minimum necessary cryptocurrency balance can validate transactions and receive Staking rewards on these blockchains.

How does Staking work?

  1. When a node's minimum balance is reached, it stakes that amount of cryptocurrency in the network (similar to a security deposit).
  2. The probability of a node being picked to forge the next block is directly proportional to the size of the stake.
  3. The validator earns a payment if the node successfully generates a block, similar to how a miner is rewarded in proof-of-work chains.
  4. If validators double-sign or seek to assault the network, they lose a portion of their investment.

Advantages of Staking

  1. One of the major advantages of staking coins is that it avoids the need to purchase expensive gear and consume energy regularly.
  2. Unlike conventional mining devices, the value of your staked coins does not decrease, albeit it can be affected by current market price movements.
  3. It enables investors with sufficient ownership of the cryptocurrency to validate network transactions.
  4. Unlike the proof-of-work method, which rewards coins based on a low-probability random procedure, PoS Staking provides assured returns and a predictable source of revenue.
  5. It is also more environmentally friendly and energy-efficient.

Staking Pool

Multiple stakeholders (or bagholders) can join a staking pool to pool their computing resources and maximize their chances of being paid. To put it another way, they pool their staking power in the process of verifying and validating new blocks to increase their chances of winning block rewards. A staking pool is often run by a pool operator, and participants who join the pool must lock their money at a specified blockchain address (or wallet). While some pools force users to stake their coins with a third party, there are a variety of different options that enable users to contribute their staking power while still keeping their coins in a personal wallet.

Stratis Staking Rewards

Staking rewards offered by Stratis for staking 100 STRAX is as follows:

1. Average Staked Coin

  Yearly Monthly Daily
Cash $22.1 ± $0 $1.8 ± $0 $0.1 ± $0
Strax 16.5 ± 0 1.4 ± 0 0 ± 0

2. Current staked Coin

  Yearly Monthly Daily
Cash $19.5 $1.6 $0.1
Strax 14.5 1.2 0
 
Note
Currently, 44,653,205 STRAX have been staked with 16.5% annual expected return.

You can visit here for more details.

Cold Staking

Staking on a wallet that isn't linked to the internet is known as cold staking. This can be done using a hardware wallet, but an air-gapped software wallet can also be used.

Users can stake while their assets are safely held offline on networks that enable cold staking. It's important to note that if a shareholder takes their money out of cold storage, they will no longer get incentives.

Cold staking is especially important for significant stakeholders who want to ensure that their money is fully protected while still helping the network.

Cryptocurrency Wallet

A cryptocurrency wallet is a hardware device, software application, or service that keeps the public and/or private keys for cryptocurrency transactions. A cryptocurrency wallet usually includes the ability to encrypt and/or sign information in addition to the fundamental function of holding keys. Signing can result in the execution of a smart contract, a cryptocurrency transaction, identification, or the legally signing of a "document".

STRAX Wallet

STRAX Wallet is a wallet for sending and receiving STRAX Tokens.

The Proof of Stake (PoS) technique is used on the STRAX blockchain to validate transactions, therefore STRAX owners can choose to stake their tokens. You may earn STRAX by writing blocks to the blockchain once you've staked STRAX. Importantly, the STRAX Wallet has a dual purpose, allowing you to stake your STRAX as well as to conduct transactions.

Every device running the STRAX wallet has a full copy of the STRAX blockchain, therefore the wallet is basically resting on top of a Stratis Full Node. When the Full Node detects that STRAX Tokens have been staked, it mines aggressively, adding to the network's overall power and resilience. When contrasted to Proof of Work alternatives, staking democratizes the mining process because even tiny stakes have a chance to mine. A significant investment in hardware and energy is necessary to have any chance of earning rewards from mining on a mature Proof of Work blockchain.

Features of STRAX Wallet

  1. Provides an easy-to-use user interface for STRAX transactions, making it simple to send and receive payments.
  2. Supports staking, allowing you to become a miner and receive rewards from your STRAX (whatever the amount).
  3. Working with a full copy of the Stratis blockchain improves security and network strength.
  4. Implements a Hierarchical Deterministic (HD) design, making wallet recovery and migration to other wallet implementations simple.

Setting up Stratis Wallet on Raspberry Pi

Before setting up, we need to start the Stratis Full Node. Please read my article on Installing and setting up Stratis Full Node on Raspberry Pi

To run the Stratis wallet, we need to download a python script, which will start the Stratis Wallet CLI. You can download that using the following command

sudo wget https://github.com/stratisproject/StraxCLI/archive/refs/tags/StraxCLI-1.0.0.zip

After that we need to inflate or unzip the downloaded zip file, using the following command

sudo unzip StraxCLI-1.0.0.zip -d ~/StraxCLI

Before going to run the python script, we need to start the Stratis Full Node. You can start the node using the command

sudo screen dotnet ~/StraxNode/Stratis.StraxD.dll run -mainnet

Note
If you find any issue starting the full node, please read my article here, or you can post your doubts on C# Corner Forums. You can visit Stratis Discord to find help. You can tag me on discord at @rohitgupta#5250.

Once the full node starts successfully, open a new terminal and execute the following command

sudo python3 ~/StraxCLI/StraxCLI-StraxCLI-1.0.0/straxcli.py

The above command will output the following screen,

You will get 7 options namely,

  1. Start Staking
  2. Check Balance
  3. Re-Sync Wallet
  4. Recover Wallet
  5. Remove Wallet
  6. Refresh
  7. Quit

Follow the following steps to recover your wallet,

  1. Type 4, and hit enter.
  2. You will be asked to enter the secret words. Add the secret words and hit enter.
  3. It will now ask you for your wallet password, which you must confirm by typing it again.
  4. The passphrase is the next stage; if you don't have a passphrase for your wallet, simply hit ENTER; if you do, please input it. After that, you must give your wallet a name, and it will then ask you for the date you created it. It follows the yyyy-mm-dd format. For instance, 2021-06-15
  5. When your wallet is restored, it will immediately sync all of your transactions back to the date it was created. Even if you were fully synchronized upon restoring the wallet, this is required. It will also bring up the main menu once more.

Staking on Raspberry Pi

By selecting the first option, you can activate staking i.e. Start staking.

Please keep in mind that you can't stake until you've fully synchronized with the network. The status >> Fully Synced: Yes/No>, as well as the Current Block and sync percentage, are displayed in the menu. Before you may be synchronized, your current block must match the most recent block on the network.

You must use option 6 to see the updated data because the CLI does not contain live data.

Staking can still be enabled (without actually staking), so choose 1. It will request the name and password for the wallet you wish to stake on (unless if you in the same session have recovered a wallet).

In the main menu, you can view your current wallets. If the network is completely synchronized, it should immediately begin staking; otherwise, try the option again.

When you activate staking, option 1 should now be set to stop staking. If you want to cease staking, you may choose 1.

Check Balance

It will then show you your current balance. The outcome will not be correct until the wallet is fully synchronized; if this is the case, you will be notified.

Quit

This option will close the python script, i.e. it will stop the wallet CLI.

Note
When staking, the script does not need to be open. When you enable staking, it remains active until the StraxFullNode, not the script, goes offline.

Points to Remember

  1. Make a startup script that automatically starts the StraxNode and staking. If you want it to start staking automatically, keep in mind that there is no easy/practical method to hide your wallet password, which must be kept in a text file.
  2. Every time you boot the Pi, you need to re-run the following command, you can create a script to that or you can manually do that
    sudo screen dotnet ~/StraxNode/Stratis.StraxD.dll run -mainnet

    and

    sudo python3 ~/StraxCLI/StraxCLI-StraxCLI-1.0.0/straxcli.py
  3. 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.
  4. 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. 

Conclusion

We are done setting up the Strax wallet and started staking on Raspberry Pi. For any doubts or clarification, feel free to visit Stratis Discord.

Visit C# Corner to learn more about Stratis and Blockchain.

If you have any questions regarding any other technology do have a look at the C# Corner Technology Page.