Explore the Future of Web3: Shardeum's Whitepaper Released!

How To Run A Validator Node On Shardeum Sphinx

How To Run A Validator Node On Shardeum Sphinx

Here are steps on how to run a validator node on Sphinx to validate and perform consensus on transactions in return for testnet...

Back to top
  • Share

Benefits of Operating a Validator

Running your own validator:

-enhances Shardeum network security
-earns testnet SHM from user transaction fees

Validating Transactions

Shardeum validators perform consensus on transactions.

Shardeum validators with honest transaction consensus earn testnet SHM.

Shardeum validators with dishonest transaction consensus will have their testnet SHM slashed.

INFO
Estimate future validator rewards using the Node Reward Calculator

Minimum Hardware Requirements

-250 GB SSD storage
-Quad core CPU less than 10 years old if self hosting
-Dual core CPU works if hosted with newer Xeons / EPYC
-16 GB of ram, 4+ GB of virtual memory recommended
-Hosting: 8 GB RAM + 8 GB Virtual Memory

How Do I Run a Validator on Shardeum?

Step 1: Install prerequisites

Open a Shell Terminal

Access the terminal interface for Shell CLI commands:

  • Linux
(Press at the same time)
Ctrl + Alt + T
  • Mac
(Press at the same time)
Command + Space bar
(Type)
Terminal

Install Package Managers

We will use curl in this tutorial to download files:

INFO
Mac comes with curl, so we will install homebrew with curl (which will handle handle packages like apt in Linux).
  • Linux
sudo apt-get install curl
  • Mac
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

add Homebrew to your PATH:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"'
eval "$(/opt/homebrew/bin/brew shellenv)"

Update Package Managers

Make sure your packages are up to date first:

INFO
When you add sudo to a command, the output will ask for your system password for admin verification.
  • Linux
sudo apt update
  • Mac
brew update

Install Docker

Install docker with docker.io:

  • Linux
sudo apt install docker.io
  • Mac
brew install docker

Check that docker is working with (should return version 20.10.12 or higher):

  • Shell
docker --version

Install Docker-Compose

Curl request docker-compose:

  • Linux
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • Mac
brew install docker-compose

Setup permissions for docker-compose:

  • Shell
sudo chmod +x /usr/local/bin/docker-compose

Check that docker-compose is working with (should return version 1.29.2 or higher):

  • Shell
docker-compose --version

TIP

Shardeum Validator support on Windows will be coming in the future.

Step 2: Download and Install Validator

Run:

  • Shell
curl -O https://gitlab.com/shardeum/validator/dashboard/-/raw/main/installer.sh && chmod +x installer.sh && ./installer.sh

The terminal will ask questions about your setup settings.

Give permission to collect validator data for bug reporting:

By running this installer, you agree to allow the Shardeum team to collect this data. (y/n)?:

Enter y to set up the web-based dashboard:

Do you want to run the web based Dashboard? (y/n): y 

Set a password for dashboard access:

Set the password to access the Dashboard: 

Add a custom session port for the web-based dashboard or hit enter for port 8080:

Enter the port (1025-65536) to access the web based Dashboard (default 8080): 

Add a custom external IP address or use an automatically detected IP address:

If you wish to set an explicit external IP, enter an IPv4 address (default=auto):

Add a custom internal IP address or use an automatically detected IP address:

If you wish to set an explicit internal IP, enter an IPv4 address (default=auto): 

Set the first p2p port (default 9001):

To run a validator on the Sphinx Validator 1.X network, you will need to open two ports in your firewall.
This allows p2p communication between nodes.
Enter the first port (1025-65536) for p2p communication (default 9001):

Set the second p2p port (default 10001):

Enter the second port (1025-65536) for p2p communication (default 10001):

Add a custom path or install to root:

What base directory should the node use (defaults to ~/.shardeum): 

Wait for the installation process to complete.

CAUTION
If you are behind a router and you are using ports 9001 and 10001 for p2p communication, make sure ports 9001 and 10001, are forwarded (be careful doing this since it will modify your firewall).

Router port forwarding example with AT&T:

https://www.att.com/support/article/u-verse-high-speed-internet/KM1010280/

More info on router port forwarding:

https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/

Reference:

https://gitlab.com/shardeum/validator/dashboard/

Step 3: Open Validator CLI

Make sure you are in the root directory by running:

  • Shell
cd

Go to the hidden Shardeum directory:

  • Shell
cd .shardeum

Start the CLI by running the following shell script:

  • Shell
./shell.sh
WARNING

If you see docker container error:

Error response from daemon: Container <container_id_hexadecimal> is not running

start all docker containers until the errors go away:

  • Shell
docker start <container_id_hexadecimal>
WARNING

If you see docker permission error:

Got permission denied while trying to connect to the Docker daemon socket at 
unix:///var/run/docker.sock:
Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/shardeum-dashboard/json":
dial unix /var/run/docker.sock:
connect:
permission denied

run:

  • Shell
sudo usermod -a -G docker $USER && newgrp docker

if that does not work, also try:

  • Shell
sudo service docker start 

then try to start the shell script again.

Step 4: Open Validator GUI

While inside the shell script, run:

  • Shell
operator-cli gui start

Go to your web browser and go to:

  • Local
https://localhost:8080/
  • Server
https://<server_ip>:8080/

CAUTION

You might see a warning page when trying to access this address in your web browser. Ignore this warning and continue to the validator dashboard. Another way to work around this warning:
  • Firefox
From the three bar button (hamburger) menu button, go to Settings

Click on “Privacy & Security” on the left.

Scroll down to locate “View Certificates” and click that button.

Click the “Servers” tab, then click “Add Exception”.

Type: “https://localhost:8080” (or your remote/VPS server’s IP and port), 
then click “Get Certificate”, then click “Confirm Security Exception”.

The result should be the server/localhost in the list, click “OK”.

Refresh the operator dashboard page and the certificate error should be gone.
  • Chrome
Click on the “Not secure” alert and select/click on “Certificate is not valid”.

Click on the “Details” tab, then click n “localhost” in the “Certificate Hierarchy” box and click the “Export” button.

Click on the “Details” tab, then click on 
“mynode-sphinx.shardeum.local” in the “Certificate Hierarchy” box and click the “Export” button.

The result of the steps above are two certificate files save in a location to be used in the following steps.

Type: chrome://settings in address bar, hit enter. 

Click on “Privacy and security” on the left menu. Then click “Security” from the list in the main window.

Scroll down to find “Manage device certificates” in the main windows and select it.

Click the “Import” button.

Follow the import prompts. 

Place the ‘mynode-sphinx.shardeum.local.crt” in the “Trusted Root Cert… Auth..” folder.

Click “Yes” and then “OK”.

Click “Import” once more. 

Then follow the import prompts. 

Place the ‘localhost.crt” in the “Personal” folder.

Close all Chrome windows (as in Exit Chrome). 

When you have successfully restarted chrome, the operator dashboard will not show with a white lock.

You will be asked for your password set during setup.

Shardeum Vaildator

DANGER

The login will fail even if you put no password during the setup process. To set a new password inside the validator CLI:
  • Shell
operator-cli gui set password <type_new_password__here>

You should see the “Overview” page for the Shardeum Validator Dashboard in your web browser:

Shardeum Overview page

Step 5: Start Validator

Go to the “Maintenance” page, then click the “Start Node” button in the top left white box:

Maintenance page

(Same as running)

  • Shell
operator-cli start

Wait and refresh the page.

The node is running correctly if the “Start Node” button now says “Stop Node”. If you want to stop the node with the CLI:

  • Shell
operator-cli stop
Maintence

Step 6: Monitor Validator

Go to “Performance” to see your node’s hardware performance here:

Performance

For more details about your node status run the following inside the CLI:

  • Shell
operator-cli status

DANGER

If your node becomes inactive, try checking its status.
  • Shell
pm2 list

Reset the validator from the list by running:

  • Shell
pm2 delete [id]

Step 7: Connect Wallet to Betanet

Connect to Sphinx 1.X with your wallet by clicking the button linked here

Step 8: Get SHM from Betanet Faucet

Shardeum Twitter SHM Faucet Guide for Sphinx 1.X

Step 9: Stake SHM to Validator

GUI

After you start the validator, go to the “Settings” page. You will be asked to connect your wallet:

Connect a wallet

After you connect your wallet, you should see the following:

Add Stake

When you click “Add Stake”, you will see the following:

Add Stake
-Stake Wallet Address [wallet connected]
-Nominee Public Key [filled in automatically while validator is running]
-Stake amount (SHM) [empty and is in units ether not wei]

This example has filled in 10 SHM tokens to stake.

TIP
It is recommended to stake just 10 SHM per Validator node, since rewards will be the same with 10 SHM or more staked for a Validator.

Once all fields are filled, click the “Stake” button.

Your wallet will ask you to sign the transaction stake your SHM.

Once the transaction is signed and complete, you have staked your SHM tokens successfully.

TIP

If your node status is on Standby and you have 10 SHM or more staked, your validator node is setup correctly.
The network will automatically add your validator to be active in the network.
The time to be added as an active validator will vary based on network load and validators in the network.
CAUTION
If you have staked before, you can “Remove Stake”. However, you will stop getting testnet SHM rewards when you unstake.
DANGER

If you see your validator IP address as “0.0.0.0”:

Go into the operator dashboard docker (may be different if you customized install location:

  • Shell
cd ~/.shardeum
./shell.sh

Get your node’s external IP:

  • Shell
curl https://ipinfo.io/ip

The returned IP in the format of nnn.nnn.nnn.nnn is your EXTERNAL_IP.

Set the number above in place of EXTERNAL_IP:

  • Shell
export APP_IP="EXTERNAL_IP"

CLI

You can also stake and unstake from the Validator CLI if you are not able to access a web browser for the Validator GUI.

First, set your private key in your Validator CLI:

WARNING
Be very careful with your private keys. We recommend you use a private key which has testnet tokens only to be safe.
export PRIV_KEY=<private_key>

make sure your private key is stored in your Validator CLI by running:

echo $PRIV_KEY

add stake with:

operator-cli stake 10

check your stake amount with:

operator-cli stake_info <wallet_address>

remove stake with:

operator-cli unstake

Validator

Version

WARNING

New validator versions will be released over time. It is necessary to keep your validator updated by checking the minimum version required and your current version periodically.

Run:

  • Local
curl localhost:9001/nodeinfo
  • Server
curl <server_ip>:9001/nodeinfo

Update

  • Stop your validator before updating (you don’t need to unstake though)
  • In your terminal, first exit from the container using
exit
cd ..
  • Run the following curl script
curl -O https://gitlab.com/shardeum/validator/dashboard/-/raw/main/installer.sh && chmod +x installer.sh && ./installer.s
CAUTION

You might manually have to start the GUI afterwards with:

Shell

operator-cli gui start
  • Check your currect version from either CLI or GUI and make sure it is the latest version.

Exit Error Logs

  • Shell
sudo docker exec shardeum-dashboard cat cli/build/logs/exit-summary.json
  • CLI

Navigate to the .shardeum directory by entering:

cd .shardeum

Execute the shell.sh script by entering:

./shell.sh

With the Validator CLI running, navigate to the cli/build/logs directory by entering:

cd cli/build/logs

View the contents of the exit-summary.json file by entering:

cat exit-summary.json

CLI And GUI

Version

Run:

  • Shell
operator-cli version

Update

Run:

  • Shell
operator-cli update

Commands

To see all CLI commands, run:

  • Shell
operator-cli --help

Uninstall Validator

Useful if your validator is outdated and you want to clean your last installation.

You can delete the validator folder while in your root directory with:

rm -rf .shardeum

You can also delete docker containers and images that the Shardeum validator was using.

DANGER

These commands will delete all docker images and containers on your computer!

Delete all docker containers:

docker rm -vf $(docker ps -aq)

Delete all docker images:

docker rmi -f $(docker images -aq)

Note : This blog was originally published on Shardeum’s docs page of the website here. Follow the link for latest updates on how to run a node and how to build on Shardeum!

Frequently Asked Questions (FAQs)

1. How do GUI and CLI Features help me in Operating a Node?

With GUI, you can start running a node with a few clicks of your mouse. Shardeum is one of the first L1 networks to enable user-friendly GUI feature for node validators. CLI is the primary interface used by the vast majority of blockchain networks. It is enabled for more advanced users and developers who intend to work with nodes more deeply and technically

2. What is the Reward I will get by Running an Honest Node on Betanet?

Your node will earn Betanet SHM, but these will not have any value. That said, we will be keeping track of the addresses that helped out during Betanet. While we haven’t yet decided on Mainnet rewards for Betanet users, we’ll announce in due time if and when it is decided.

3. My Node status is Standby. What does it Mean and when does it Become Active?

When you have the needed amount of SHM staked and you start your node, your Node starts with a Standby status. This means that it is ready to be included in the network. Whenever network rotation occurs, your node will get the opportunity to become Active. This will entirely depend on the network demand and there is no fixed timeline when your node will become Active.

4. My Transaction is Failing Whenever I try to add Stake on my Validator.

Please Reset your Metamask Wallet. (Settings > Advanced > Reset Account)

5. Can I run a Shardeum Validator on Windows?

While the team has not done extensive testing on windows, technically if you have Windows Subsystem for Linux (WSL) in your system, you should be able to run a Shardeum validator node.

6. Troubleshoot Error: Got Permission Denied while trying to Connect to the Docker Daemon Socket at unix:///var/run/docker.sock:

Run the following command in your shell –>
sudo usermod -a -G docker $USER && newgrp docker
Then run the shell script again.

7. I see my Validator IP as 0.0.0.0 and get the Error of “Node cannot Join with Invalid External IP: 0.0.0.0”. What should I do?

Go into the operator dashboard docker (may be different if you customized install location:

cd ~/.shardeum
./shell.sh

Get your node’s external IP:
curl https://ipinfo.io/ip

The returned IP in the format of nnn.nnn.nnn.nnn is your EXTERNAL_IP.
Set the number above in place of EXTERNAL_IP:
export APP_IP=”EXTERNAL_IP”

8. How to do a Fresh Install of a Shardeum Node?

Use the following commands in your shell:

cd ~/.shardeum

./cleanup.sh

cd ~/

rm -rf .shardeum

rm installer.sh
After these, Start from Step 2 from the Validator Node Installation Guide (https://docs.shardeum.org/node/run/validator#step-2-download-and-install-validator)

9. Can I Operate Archive Nodes on Betanet?

During betanet the community can operate Validator nodes. After mainnet, the community can also operate Archiver nodes.

Popular Searches

DAO Guide  |  Blockchain Beyond Crypto  |  What is Chainlink  |  What are Cryptopunks  |  Advantages and Disadvantages of Decentralization  |  Peer to Peer Transaction  |  Web3 Training  |  Blockchain Proof of Work Vs Proof of Stake  |  What is Defi 2.0  |  What is Phishing and How to Prevent it  |  Main Features of Web 3.0  |  Blockchain Layers Explained  |  Cryptocurrency Liquidity Provider  |  EVM Wallet Address  |  EVM Blockchains Add EVM Network  |  Custodial Wallets Vs Non Custodial Wallets  |  Decentralized Identifiers  |  Cryptocurrency Career Opportunities  |  What is Consortium Blockchain  |  Major Components of Blockchain

2
The Shard

Sign up for The Shard community newsletter

Stay updated on major developments about Shardeum.

  • Share