DARWINIA NETWORK
Published in

DARWINIA NETWORK

「Using Darwinia Tools 3–11」: Darwinia Apps Guide Part IV: How to Become a Validator

More advanced users are encouraged to run for a validator. Once you become a validator, you can have a passive source of income. To be eligible for running for a validator, you need to run a full node and stake some tokens. In this article, we will show you how to run for a validator step by step.

Prerequisites

To run for a validator, you need to meet these prerequisites:

  1. You have the necessary hardware and software to run a full node.
  2. You have some tokens to stake;
  3. You are currently not a nominator.

Running a Node

Run a binary

The darwinia-network/darwinia repo’s master branch contains the latest Darwinia code.

$ git clone <https://github.com/darwinia-network/darwinia.git>
$ cd darwinia && cargo build --release

Alternatively, if you wish to use a specific release, you can download the binary from the release page. (v0.11.4 in the example below):

$ wget <https://github.com/darwinia-network/darwinia/releases/download/v0.11.4/darwinia-x86_64-linux-gnu.tar.bz2Copy>

Then,

$ ./darwinia --name my-darwinia-node

Add the --ws-external and --rpc-cors all options if you want to remotely connect to this node:

$ ./darwinia --name my-darwinia-node --ws-external --rpc-cors all

Run in Docker

$ docker run -it -v node-data:/darwinia/data quay.io/darwinia-network/darwinia:v0.11.4 --base-path /darwinia/data --name my-darwinia-node

Add the --ws-external and --rpc-cors all options and map out the RPC ports if you want to remotely connect to this node:

$ docker run -it -v node-data:/darwinia/data quay.io/darwinia-network/darwinia:v0.11.4 --base-path /darwinia/data --name my-darwinia-node --ws-external --rpc-cors all

It is recommended to use systemctl, pm2, tmux, screen and other tools to maintain the process.

Appendix — Darwinia and Crab Network Database Snapshot

Darwinia provides the node database snapshots for node maintainers. It enables maintainers to download the latest snapshot, unarchive, and start a node instantly without syncing from block zero.

Available Snapshots Darwinia Network: https://snapshots.darwinia.network Crab Network: https://snapshots.crab.network The number in the file names indicates the block height of the snapshot. For example, the block number of snapshot darwinia-3468533.tar.zst is 3468533.

Usage For Kubernetes users, please use snapshot-init-container.

  • Install zstd:
# Debian, Ubuntu
apt install zstd
# CentOS, Rad Hat
dnf install zstd
# Arch Linux
pacman -S zstd
  • Download the snapshot archive and extract:

Copy the snapshot archive URL from https://snapshots.darwinia.network (Darwinia Network) or https://snapshots.crab.network (Crab Network). Always choosing the latest snapshot with the highest block number is strongly recommended.

wget -c <https://snapshots.darwinia.network/darwinia-xxxx.tar.zst> # the snapshot URL
tar xv --zstd -f darwinia-xxxx.tar.zst -C /path/to/chain-dir # Or tar xv -I zstd -f darwinia-xxxx.tar.zst -C /path/to/chain-dir

It’s worth noting that /path/to/chain-dir depends on two factors: 1) the node CLI option --base; 2) the chain name. For example, assume with --base /data, the chain dirs for networks are:

* Darwinia Network: /data/chains/darwinia
* Crab Network: /data/chains/crab
  • Run the validator (optional):

If you want to use the snapshot to initialize a validator node, please notice that the node CLI options — unsafe-pruning and — pruning=xxx are required since the database format of the snapshots is not “archived”. For example, to run a Darwinia validator:

darwinia --validator --unsafe-pruning --pruning=15000

Run Your Server as a Validator Node

$ ./darwinia --name my-darwinia-node --validator --rpc-methods=Unsafe --unsafe-rpc-external --ws-external --rpc-cors all

If you are using Docker, it should be like this:

$ docker run -it -v node-data:/darwinia/data -p 9933:9933 -p 9944:9944 quay.io/darwinia-network/darwinia:v0.11.4 --base-path /darwinia/data --name my-darwinia-node --validator --rpc-methods=Unsafe --rpc-external --rpc-cors all

Get the Session Key of Your Running Node

Run the following command on the shell where your validator node is running.

$ curl <http://127.0.0.1:9933> -H "Content-Type:application/json;charset=utf-8" -d \\
'{
"jsonrpc":"2.0",
"id":1,
"method":"author_rotateKeys",
"params": []
}'

You will get a response similar to this.

{  
"jsonrpc":"2.0",
"result":"0xba99ecfb4a87357a44ee3765cf617a6d81adf8f43e522db52e348d2e9d45ccde12d53d562e14bb18523fbc3032b786f44b2b92340f4756386d4baec68bbfb882bbaccce1440c84d7f5b67c8ecb956345130d5dbd07adfeba3d9482f95d9dec6c68d085323e61590f850c38244dd2d2bc4055548d9edfd0471f47da7667c17fe8",
"id":1
}

The “result” is the session key we need. (This key is only for demonstration. Please DO NOT use it for yourself.)

Stake Some Tokens

Log in the Darwinia Apps and enter the “Staking” section, and click “Staking now”.

Then set parameters accordingly and check for estimated Power value and KTON and click “Bond”. For a detailed explanation of every item, please refer to How to Become a Nominator, but we recommend using different accounts for “stash account” and “control account” for better security and management.

Set the Session Key

After staking, you can see your “stash account” is displayed on the left. Click “Session Key”. If you are nominating someone, this button will not be displayed. You need to stop nominating first.

Here the “controller account” you set is displayed. Paste your session key and click “OK”.

Then click “Sign and Submit” to continue.

Set Validator Parameters

Click “Validate” and set the validator parameters.

The parameter “reward commission percentage” defines the proportion of the node’s priority distribution of income, and the range is 0–100. (Example: For a 5% reward commission, this node will first receive 5% of the node’s revenue, and the remaining 95% of the node’s revenue will be distributed in proportion to the amount of one’s token in staking, be it the validator or a nominator; Validator’s income = node reward commission + staking reward share).

Now you are finished, but it will not take effect until the next era.

About Darwinia & Crab

Github | Website | Medium | Twitter | Telegram

Darwinia is a cross-chain messaging infrastructure, which will provide a reliable and programmable cross-chain platform for decentralized applications. Darwinia will provide developers with an SDK, and developers can easily integrate cross-chain capabilities into their Dapps. Crab Network is the canary network of Darwinia, it is substrate-based, EVM compatible, and connected to Kusama.

Darwinia Network has gained a high reputation and recognition along the way to building the universal cross-chain messaging infrastructure. Darwinia was written in Polkadot light paper as one of the friends of Polkadot and Substrate. And Darwinia was selected to join Substrate Builder Program and Web3.0 Bootcamp, and for the outstanding work in Substrate Builder Program, Darwinia Network was officially awarded the Level 2 badge by Parity. The products and tools developed by Darwinia have been rewarded with three W3F Grants.

--

--

--

Darwinia Network provides a light-client based, programmable, universal cross-chain message Network for DApp developers.

Recommended from Medium

Codefresh adds native integration for Azure Helm Repositories

How to use Redis and Lua Scripts in a C# ASP.NET Core Microservice Architecture

Parentheses and Curly Braces in Ruby, Who Needs em’?

Quick Test: Ubuntu Studio 20.04.3

Our new website address is MacroMas

「Understanding Darwinia 1–8」How to Develop a Substrate-to-Substrate Bridge

NBA Season Lines Project Blog

Happy Birthday, OpenBSD (6.8)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Darwinia

Darwinia

As an open cross-chain bridge protocol based on Substrate, Darwinia focuses on the construction of future Internet of Tokens. TG: http://t.me/DarwiniaNetwork

More from Medium

PhalaWorld’s Spirit NFT Free Mint Starts Now!

Back to Asgard: the first NFT collection launched by Bifrost.

We Look Forward To Meeting You At Polkadot Decoded 2022!

Moonwell Artemis Claim Guide