Chiliz Chain Developer Guide
English 🇬🇧 🇺🇸
Search
⌃K
Comment on page
👀

Install a Spicy Validator Node

What is a validator node

To become a 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 blockchain.

## TL;DR Launch The Validator

To run a validator node, you will need to run following command:
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:latest \
--mine \
--spicy \
--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, 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,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 Spicy Testnet.

Launch a Validator and start the sync

The recommended starting point to run a Chiliz Chain validator 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:v1.5.2 ...

Create the validator address

Create the validator node with the following command, you will need to type a password for the secret key file.
docker run --rm -ti \
-v $(pwd)/keystore:/root/.ethereum/keystore/ \
chilizchain/ccv2-geth:v1.5.2 \
account new
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:v1.5.2 \
...
--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 store 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 setted as the following example:
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:v1.5.2 \
...
--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 BACKUP 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 hex 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 \
chilizchain/ccv2-geth:v1.5.2 \
...
--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, extip:<IP>, the default: "any", it is recommended 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:v1.5.2 \
...
--nat=extip:140.250.140.250 # example
...
​

Set verbosity

For deeper troubleshooting, logging verbosity can be setted as:
  • 0=silent

  • 1=error

  • 2=warn

  • 3=info

  • 4=debug

  • 5=detail

The default value is for the parameter --verbosity is 3, it’s recommended to use 4.
​
docker run \
-v $(pwd)/my-datadir:/datadir \
--name ccv2-node \
-p 30303:30303 \
chilizchain/ccv2-geth:v1.5.2 \
...
--verbosity=4 #example
...
​