Run a Validator node

Setting up a Chiliz Chain Validator node

What is a validator node?

To become a Chiliz Chain validator, you are required to have specific hardware setup and be able to run a Validator node. A node is a computer system set up specifically to validate transactions before committing them on the Chiliz Chain.

Launch the Validator

To run a Validator node, you need to set the following parameters:

## TL;DR you need to run the following command (make sure to update the nodkeyhex parameter!)

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--mine \
--chiliz \
--datadir=/datadir \
--password=/datadir/password.txt \
--allow-insecure-unlock \
--unlock=f9100d364b45a8fdbd178ed1edfe632cc7eb2ecc \
--syncmode=full \
--gcmode=archive \
--miner.gastarget=30000000 \
--miner.gaslimit=40000000 \
--miner.gasprice=5000000000 \
--nodekeyhex=2668f377e69de_EXAMPLE_REPLACE_WITH_YOUR_VALUE_c88bea3e337446ed73 \
--nat=extip:140.250.140.250 \
--verbosity=4

Prerequisites

To run the Chiliz Chain validator node, you must have the Docker Engine installed either on your machine or server.

Therefore, please complete the Docker installation before you proceed.

System requirements

You will need a dedicated server to run your validator node. This server should have at least 4GB of RAM, 2 CPU cores, and a solid-state drive (SSD) for optimal performance. It is recommended to have at least 150GB of free disk space to sync with the chain. You can use a cloud provider like Amazon Web Services, Google Cloud Platform, or Microsoft Azure, or you can set up your own server.

Pre-build Docker images

View or use the pre-build Docker images from Chiliz Chain 2.0 public repository on the Docker hub for Mainnet.

Launch a Validator and start the sync

The recommended starting point to run a Chiliz Chain validator node is with the mounted data volume. If this method is used to recreate a Docker container, the data gets stored in the directory and can easily be reused or cloned to another validator.

Create a directory

Create a directory and point to it in the -v parameter in the following command:

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-validator \
-p 30303:30303 \
chilizchain/ccv2-geth:latest ...

Create the validator address

Create the validator node with the following command:

docker run --rm -ti \
-v $(pwd)/keystore:/root/.ethereum/keystore/ \
chilizchain/ccv2-geth:latest \
account new

You will need to type a password for the secret key file.

The result for the previous command will be:

  • Public address of the key: While running the validator, this address will be used to set the --unlock parameter.

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
...
--unlock=F9100d364b45a8fdbd178ed1edfe632cc7eb2ecc # example
  • Path of the secret key file: This file needs to be moved into the "keystore" directory inside the datadir $(pwd)/my-datadir you created in previous steps, so the final path of the file will be "$(pwd)/my-datadir/keystore/UTC–(TIMESTAMP)-(ADDRESS)". DO NOT change the name of the file.

  • Password: The password you typed during the the execution of the previous command needs to be stored in a file: $(pwd)/my-datadir/password.txt This file will be used to set the --password while running the validator node. Do not forget that all files in the host path $(pwd)/my-datadir will be located in the container in /datadir directory, this is why the password parameter should be set as the following example:

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
...
--password=/datadir/password.txt
...

It’s very important to have the following recommendations in mind:

  • You can share your public address with anyone. Others need it to interact with you.

  • You must NEVER share the secret key with anyone! The key controls access to your funds!

  • You must BACK UP your key file! Without the key, it's impossible to access account funds!

  • You must REMEMBER your password! Without the password, it's impossible to decrypt the key!

Generate the validator node key

This section is optional.

It is recommended to generate a random hexadecimal string for the node. This is helpful for traceability on the logs and to avoid peering issues with the chain.

To accomplish this, you can use https://www.browserling.com/tools/random-hex and generate one hexadecimal key with 64 characters per node. While running a validator node, you can set --nodekeyhex with this value. This will ensure that when you restart the node it will have the same node address (called "enode address") and it will allow for easier future debugging or fault finding.

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
cchilizchain/ccv2-geth:latest \
...
--nodekeyhex=2668f377e69de_EXAMPLE_REPLACE_WITH_YOUR_VALUE_c88bea3e337446ed73 # example
...

Set NAT port mapping mechanism

According to Geth documentation, the parameter --nat has different options: any, none, upnp, pmp, and extip:<IP>. The default is any.

We recommend to use extip:<IP> , where IP is the public IPv4 where the validator is being launched.

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
...
--nat=extip:140.250.140.250 # example
...

Set verbosity

For deeper troubleshooting, logging verbosity can be set as:

  • 0=silent

  • 1=error

  • 2=warn

  • 3=info

  • 4=debug

  • 5=detail

The default value for the parameter --verbosity is 3. We recommend to use 4.

docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
...
--verbosity=4 #example
...

Last updated