How to set up a validator node on CENNZnet

Cathy Breed
CENNZnet
Published in
6 min readMar 18, 2021

Translations of this article can be found here:

This guide will cover how to set up a Validator node on CENNZnet. Specifically how to set up a Validator node in a non-programmatic way which can be done with docker or system admin skills.

There are two ways to set up a validator node on CENNZnet:

  1. Using the CENNZnet API
  2. Using the CENNZnet portal (https://cennznet.io/)

The API method requires JavaScript programming skills. It allows you to automate the process, so you can set up multiple validators more easily. To set up a validator programmatically using CENNZnet’s API, please refer to our technical documentation found on the Wiki here.

The CENNZnet portal method can be done by anyone regardless of coding skill and is quicker to complete.

Requirements:

  • Familiar with using the command line
  • Docker or system admin experiences

Setting up a validator node using the CENNZnet.io portal

You can follow a visual guide to the below steps here:

Step 1: Start a validator node

There are two ways to start a validator node:

  1. Start a fresh node: this is a faster process, but you may need to wait a couple of days for it to finish synchronisation, depending on the network conditions.
  2. Start a node from a snapshot: this requires downloading a snapshot (a complete copy of the state of a node) which is currently around 50G. Once you have downloaded the snapshot, you can start a node that’s already synchronised.

Starting a fresh node

Run the following command in your terminal to start a node as a validator and join the CENNZnet Mainnet (Azalea).

This command won’t create blocks or participate in validating until you have completed all of the steps outlined in this document.

Starting a node from a snapshot

  1. Download the latest archive of validator nodes from here
  2. Unzip the archive
  3. Edit the following command and run it

Step 2: Wait for the node to synchronise

The node finishes synchronising when the best block number is the same or close to the target block number. Example output from the node:

INFO ⚙️ Syncing 21.2 bps, target=#1140132 (1 peers), best: #532405 (0xfad8…07ea), finalized #531968 (0x1a24…d249), ⬇ 7.3kiB/s ⬆ 60 B/s

Step 3: Place funds at stake

To become a Validator you need to lock away the minimum threshold stake of 10,000 CENNZ. This is done using a bonding transaction which places an amount of CENNZ into the staking system.

During the bonding transaction, we can also set a controller account and specify the account where you wish to receive staking rewards.

  1. Go to CENNZnet.io
  2. Navigate to Advanced->Extrinsics
  3. In the first row, select the stash account: the account that holds the CENNZ you’d like to stake.
  4. In the second row, select “Staking” and “bond”
  5. In the “controller” field, select a controller account: the account that manages staking for your validator. The controller can be the same as the stash account, but it’s recommended to use a separate controller account as a security best practice.
  6. Set the amount of CENNZ to stake
  7. In the “pay” field, select the account where you would like to receive the staking reward. By default, the staking reward goes back to the stash account. You can choose to replace the default with a different account here.

For more information about stash vs controller account, please refer to our technical document on our Github Wiki here.

Step 4: Claim session keys

Session keys prove that your controller account represents the node that you are running, securely connecting your two accounts for the process of validating.

To claim your session keys you need to link your running validator node with a controller account which will act on behalf of the stash account. The controller account will make a transaction to claim some session keys on behalf of the stash.

Session keys may be rotated using this process at any time.

There are 2 steps in claiming session keys:

  1. Generate a new session key
  2. Set session keys

Step 4.1 Generate a new session key

  • Run the following command in the terminal
curl \-H "Content-Type: application/json" \-d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params": []}' localhost:9933
  • Copy the value of “result” to be used in the next step. This is your new session key. Please make sure you copy the entire session key. You may need to zoom out on the page to copy the whole string.

Step 4.2 Set session keys

  1. Go to CENNZnet.io
  2. Navigate to Advanced->Extrinsics
  3. In the first row, select the controller account, which you selected in Step 3
  4. Select “session” and “setKeys”
  5. Set the keys to the value obtained from the last step
  6. Leave the “proof” as default
  7. Click Submit Transaction

Step 5: Signal intent to validate

⚠️ Please note: before starting this action make sure the validator node has synchronised and has it’s session keys configured. Failure to do so can lead to slashes, as your validator node will not be able to complete its duties on the network.

Note: You cannot signal your intent to validate when the election window is closed. Normally the election window is closed in the last 10 minutes of an era. Please wait and try again in the next staking era if you see the error “staking.CallNotAllowed”.

When signalling your intent to validate, the controller account will send a transaction to join the validator candidate pool. This allows your validator to be nominated for the next staking era. To do this:

  1. Go to CENNZnet.io
  2. Navigate to Advanced->Extrinsics
  3. In the first row, select the controller account, which you selected in Step 3
  4. In the second row, select “Staking” and “validate”
  5. In the “commission” field, set the amount of commission, which is the amount of reward your validator will take. The rest of the rewards will be shared between your nominators. This amount is expressed as parts-per-billion and converted to a hexadecimal number.

You can calculate commission value in the Javascript page:

const commission = 20; // Percentconst perbill = 1_000_000_000; // Baseconst commissionPerBill = (commission/100)*perbill;const commissionEncoded = api.registry.createType("Perbill", commissionPerBill);console.log(`For ${commissionEncoded.toHuman()} commission`);console.log(`Enter ${commissionEncoded.toHex()}`);

Congratulations! You did it 🎉 Now you have a working validator node on the CENNZnet.

How to stop validating

To stop validating you will need to call the Chill method, which will stop your validator from being elected after the current staking era. When you have successfully chilled your validator node then you can safely take it offline and unstake if you desire.

To call the chill method:

  1. Go to CENNZnet.io
  2. Navigate to Staking->My Stake
  3. Find the entry for your validator and click the cog wheel, this opens the Manage stake window
  4. In the Manage stake window, select the Chill action

Need help?

You can ask questions and get fast support in our Validators channel on the CENNZnet Discord channel here.

You can also learn more about being a validator on CENNZnet vai our validator FAQ here.

To stay up-to-date on the progress of our technology, follow us on Twitter, Telegram, LinkedIn, Discord and Instagram.

--

--