7. Setup local validator node

A step-by-step guide explaining how to configure a validator node

Overview

Create required accounts:

  • Create a stash account

  • Create a controller account

  • Create a reward account

Bond stash and controller together; direct rewards to reward account.

The tutorial assumes the user already has Rust installed on the machine they will use for validating however, if you do not, please refer to the following installation guide: https://substrate.dev/docs/en/knowledgebase/getting-started/

Guide

To get a copy of the node, you have two options:

  1. Download the porta-node binary

  2. Clone the repository

Option 1

Option 2

git clone https://github.com/porta-network/porta-node.git

Once you have a copy of the node, move onto the next step.

Build the node:

Navigate to the root folder of the node and run the following command in a terminal:

cargo build --release

Start the node to begin synchronising chain data:

The following command should be run in a terminal. You must enter a name for your validator node.

./target/release/porta --chain chain-spec-padlock.json -d data/[Validator name] --name [Validator name] --validator --port 30337 --ws-port 9949 --rpc-port 9937 --ws-external --rpc-external --rpc-cors all --rpc-methods=unsafe

You will know when your node has completed synchronisation because the block number displayed in your terminal will be the same as the block number displayed on the Porta Console (https://console.porta.network/#/explorer).

While you wait for synchronisation, you may proceed to create the accounts mentioned below.

Create a stash account, controller account and, optionally, a reward account.

In our example we will direct staking rewards to our rewards account, but you may choose to direct them to your stash account.

We will call our accounts ‘user-stash’, ‘user-controller’ and ‘user-rewards’.

IMPORTANT NOTICE: SWAP TO YOUR NODE

  1. You MUST disconnect from Porta's node: https://console.porta.network/#/explorer

  2. You MUST open PolkadotJS Apps: https://polkadot.js.org/apps/#/explorer

Now, you MUST connect to your node:

For this tutorial, I am running the node on my local computer. My local IP address is 127.0.0.1, so I connect to "ws://127.0.0.1:9949", but you will need to enter the IP address of your node: ws://[your node IP address]:9949

Navigate to PolkadotJS Apps

Go Accounts > My Accounts > Add Account

  • Follow the same process to create an account for ‘user-controller’ and ‘user-reward’. You should now have the following three accounts:

Ensure the accounts have relevant funds:

You need to ensure the following:

  1. The stash account has the funds you want to stake

  2. The controller account has enough funds to cover transaction fees

  3. The reward account has more funds than the existential amount set by the blockchain

Bond stash account to controller account; delegate rewards to reward account:

  • Go to Network > Staking

  • Account Actions > + Stash

  • Fill out the field as per the image below

You will now have your bonded accounts listed.

Generate the session keys for the validator account

Go to Developer > RPC Calls

Author > Rotate Keys > Submit RPC Call Copy the hex result.

Add the session keys for the validator account

Go to Network > Staking

Account Actions > Session Key

Paste in the hex session key

Click Validate

Set commission and click validate

Check everything is working and wait for the next era

Network > Staking > Account Actions > All Stashes This screen will confirm the session keys are set.

Network > Staking > Waiting This will confirm the intention to be a validator

Network > Overview This will confirm the time until the next Era

Once the new era has begun

You we see yourself in the validator list

You will notice your node producing blocks in the terminal

Eventually, you will notice your validator have a reward and being able use PAYOUT to capture that reward