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.
To run for a validator, you need to meet these prerequisites:
- You have the necessary hardware and software to run a full node.
- You have some tokens to stake;
- 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>
$ ./darwinia --name my-darwinia-node
--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
--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 \\
You will get a response similar to this.
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
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.