Validator Node

Validator nodes are critical to the Sonic chain, responsible for validating transactions and creating new blocks in accordance with the consensus protocol. These nodes ensure the integrity and security of the network by verifying data, participating in block creation, and maintaining the chain’s state.

Unlike archive nodes, validator nodes focus on real-time operations rather than storing extensive historical data or responding to general API requests.

To run a validator node on the Sonic mainnet or Blaze testnet, follow the steps below.

Steps to Run a Validator

  • Minimum self-stake amount: 500,000 S

  • Maximum validator size: 15x self-stake

  • Rewards: ~6% APR initially, plus 15% of delegators' rewards and network fees

The minimum self-stake on Sonic is set at 500,000 S to ensure security during the network's early months, with plans to gradually reduce it.

1. Launch a Server Instance

You can run your validator node on dedicated hardware (bare metal) or use a cloud provider. We recommend choosing one of the established providers, such as Google GCP or Amazon AWS.

Node Hardware Specifications

  • At least 4 vCPUs and 32 GB of RAM

  • At least 1 Gbps redundant backbone connectivity for stable and uninterrupted network traffic

  • At least 1 TB of local SSD/NVMe storage. Remote block devices (e.g., AWS EBS) typically do not provide the required latency and random access performance. Google GCP N2D instances with local SSD or AWS i3en.xlarge with instance storage are good options.

  • Ubuntu LTS Server (64-bit) or a similar Linux distribution is recommended.

Required Storage Capacity

  • 1 TB of local SSD/NVMe is sufficient for a validator database.

Network Settings

A Sonic node requires both TCP and UDP network traffic allowed on port 5050 by default. You can use --port <port> to customize this if needed.

2. Install Required Development Tools

You need the essential build tools and the latest Go compiler, version 1.22 or newer, to build the Sonic client and its bundled tools. Example (Ubuntu/Debian):

sudo apt-get update
sudo apt-get install -y build-essential git

Install Go language compiler (Ubuntu/Debian):

sudo rm -rf /usr/local/go
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
sudo tar -xzf go1.23.4.linux-amd64.tar.gz -C /usr/local/
rm -f go1.23.4.linux-amd64.tar.gz

sudo tee /etc/profile.d/golang.sh > /dev/null <<EOT
export GOROOT=/usr/local/go
export GOPATH=\$HOME/go
export PATH=\$PATH:\$GOROOT/bin:\$GOPATH/bin
EOT

source /etc/profile.d/golang.sh

3. Build the Sonic Node Software

Check the latest Sonic release and adjust commands if necessary:

git clone https://github.com/Fantom-foundation/Sonic.git
cd Sonic
git fetch --tags && git checkout -b v2.0.1 tags/v2.0.1
make all

You can confirm the Sonic release by running:

build/sonicd version

Optionally, copy the binaries to a system-wide location:

sudo mv build/sonic* /usr/local/bin/

4. Prime the Sonic Database

To participate in the Sonic network, you need a valid state database. The fastest way is to use a genesis file from the official repository. Download the appropriate genesis file. For the mainnet, for example:

wget https://genesis.soniclabs.com/sonic-mainnet/genesis/sonic.g

Use sonictool to prime the state database. Adjust GOMEMLIMIT and --cache according to your available RAM size. For the most common cases, use 12GiB as --cache and ~90% of RAM as GOMEMLIMIT.

GOMEMLIMIT=54GiB sonictool --datadir ~/.sonic \
    --cache 12000 genesis \
    --mode validator sonic.g

After processing, you should see a confirmation of a successfully imported state.

5. Synchronize With the Network

Now that your database is primed, start the node to synchronize it with the network. Ensure your firewall is configured correctly.

GOMEMLIMIT=54GiB sonicd --datadir ~/.sonic --cache 12000 --mode validator

The Sonic node will connect to the network and advance its state by processing new blocks. Once fully synchronized, the "age" of new blocks should be only a few seconds.

6. Create a Validator Wallet

Your Sonic node is now synchronizing. Next, create a wallet to identify and control your validator account. This wallet must hold the minimum amount you are going to use as the self-stake (500,000 S).

We recommend creating the wallet securely (e.g. a hardware wallet). If you choose to create it locally using sonictool:

sonictool --datadir ~/.sonic account new

Important: Keep your wallet and keys secure. Never share them.

7. Create a Validator Signing Key

A Sonic validator node signs consensus messages. Your node needs a validator signing key to participate. Create it on the server:

sonictool --datadir ~/.sonic validator new

Follow the prompts and set a secure password. Note the public key (starts with 0xc00). This key will be used during registration.

Important: Back up your signing key. Although it cannot move funds, misuse could lead to penalties.

8. Register Your Validator

The network must recognize your validator key. Register by invoking the SFC (Staking and Consensus) contract:

Call createValidator with your validator public key and at least the minimum required stake (500,000 S). Sign this transaction with your validator wallet. After confirmation, query your validator ID using the getValidatorID function. The easiest way would be to open the Sonic explorer and navigate to the SFC address.

The contract is validated and you can interact with it using SonicScan and a connected Web3 wallet. The control validator account can be imported into your Web3 wallet either using the generated JSON key store or as your hardware wallet. With the account open, you can sign the createValidator transaction call specifying the amount of stake and the public key obtained in the previous step.

9. Run Your Validator Node

Stop the currently running node:

pkill sonicd

Wait for it to gracefully shut down. Never force-terminate it, as it could corrupt the database. Restart your node in validator mode, providing the validator ID, public key, and password file:

GOMEMLIMIT=50GiB sonicd \
    --datadir ~/.sonic \
    --cache 12000 \
    --mode validator \
    --validator.id <your_validator_ID> \
    --validator.pubkey <your_public_key> \
    --validator.password <path_to_password_file>

Your validator node will now participate in consensus and produce blocks.

10. Next Steps

Validator/Name Logo

You can set a validator name and logo on the explorer. Check official repositories for instructions.

Community and Help

Join Sonic community channels, follow updates, and use your stake to participate in network governance. If you have issues, the community can provide guidance.

Monitoring and Health

If your node goes offline, you stop earning rewards. Extended downtime (e.g. more than 5 days) may result in suspension, requiring you to withdraw and start over. Regular monitoring, maintenance, and backups are essential.

Congratulations! You are now running a Sonic validator node.

Last updated

© 2024 Sonic Labs