Skip to content

Chain-Games/supernet-validator-node

 
 

Repository files navigation

Supernet Validator Node Guide

This guide was created using Ubuntu 24.0.4 LTS as the base operating system. While any *nix-based system should work, these instructions are tailored for Ubuntu.


Prerequisites

  • A wallet with 5 $POL ($MATIC) & (250,010 $CHAIN) on Polygon mainnet.
    • This wallet will be referred to as the Primary Wallet.
  • A dedicated Polygon RPC node from a provider like Ankr or Alchemy. You can sign up for a free account.

Hardware Requirements

Component Minimum Requirement Recommended
Processor 4-core CPU 8-core CPU
Memory 8 GB RAM 16 GB RAM
Storage 160 GB SSD 1 TB SSD
Network High-speed internet connection Dedicated server with gigabit connection
OS Ubuntu LTS Ubuntu LTS

Technical Requirements

When setting up the Supernet Validator Node, you need the following dependencies:

General Dependencies

sudo apt update
sudo apt install -y curl vim netcat-traditional jq screen psmisc

Install Node.js & npm

sudo apt install -y nodejs npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 18
nvm use 18

Install Go

wget https://dl.google.com/go/go1.20.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz

Update ~/.bashrc

Append the following lines at the end of the file:

export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
go version

Setting Up the Validator Node Repository

⚠ Warning: The genesis.json file is crucial for running the node correctly. Do not modify it except for RPC changes.

git clone https://github.com/Chain-Games/supernet-validator-node.git
cd supernet-validator-node
npm install

Configure genesis.json

Replace the jsonRPCEndpoint value with your Polygon Mainnet RPC URL from Ankr or Alchemy (or another provider).

"jsonRPCEndpoint": "your-rpc-here"

Update .env Files

Modify the following files to include your Polygon Mainnet RPC URL and Primary Wallet Private Key:

  • ./.env
  • ./scripts/.env

Setting Up the Validator

Step 1: Install Validator

sudo ./scripts/addValidator

Step 2: Start Validator Node

  • You have 2 options for starting the validator node.

    • Option 1 is to run it locally using the local binary. (Preferred)
    • Option 2 is to run it from a Docker container.
  • Only choose one option and follow those instructions. Don't perform both options.

Option 1: Run Validator Node using Local Binary (Preferred)

sudo screen ./scripts/start

Check if the process is running:

ps ax | grep polygon

Example output:

./polygon-edge server --data-dir ./test-chain-5 --chain ./genesis.json --grpc-address :10000 --libp2p 0.0.0.0:30301 --jsonrpc :10002 --relayer --num-block-confirmations 2 --seal --log-level INFO

If screen terminates, run:

sudo ./scripts/start

Option 2: Run Validator Node using Docker

Install Docker

sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Add Docker Repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install Docker Tools

sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify Docker Installation

sudo docker run hello-world

Build & Run Validator Node with Docker

sudo docker build -t validator5 .
sudo docker run -d --name validator5 -it -p 10000:10000 -p 30301:30301 -p 10002:10002 validator5:latest /bin/fish
sudo docker exec -it validator5 /bin/fish

Start Validator Node Inside Docker

sudo screen ./scripts/start

Docker Helper Commands

Access Running Docker Container

sudo docker exec -it validator5 /bin/fish

Check Running Validator Node Process

ps ax | grep polygon

Example output:

./polygon-edge server --data-dir ./test-chain-5 --chain ./genesis.json --grpc-address :10000 --libp2p 0.0.0.0:30301 --jsonrpc :10002 --relayer --num-block-confirmations 2 --seal --log-level INFO

Stop Running Validator Node Process

sudo killall polygon-edge

Supernet Validator Node Helpers

Retrieve Node Validator Private Key

⚠ Warning: When you run the validator node script, it creates a new wallet address and private key. This is a different wallet address and key than what you started with. The validator.key file is your node's private key. DON'T LOSE IT or you will lose access to your stake. Back this key up. You can also add it to your MetaMask or any other EVM wallet as well to have another instance of it.

sudo cat ./test-chain-5/consensus/validator.key

Set Validator Name & Image

  • Note: Navigate to this updateValidatorInfo repository, and follow the instructions there.

https://github.com/Chain-Games/updateValidatorInfo

Example:

node setValidatorInfo.js validatorPrivateKey CG-Validator " " /root/chaingames.png

Set Validator Commission Rate

node updateCommissionRate.js <pk> <amount-in-percentage>

Example (2% commission):

node updateCommissionRate.js validatorPrivateKey 2

🎉 Congratulations! Your Supernet Validator Node is now set up!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 67.7%
  • Shell 25.7%
  • Dockerfile 6.6%