The tutorial is based on Polkadot POC2.
This is the second article of the series, articles already published on Medium:
Where’s the Party?
I suppose you followed the steps as described in my first article and have now a stable Polkadot Validator cloud instance running.
So what does that mean, actually?
Well, you have a node running which is building up a local copy of the parachain exposed by the Krumme Lanke Polkadot POC-2 test net. So you are more or less an active listener on the relay chain and are processing the newly created block and seal them into your local blockchain DB.
This situation can be explained by using a modified tweet of @ iamdevloper, which is famous for funny to-the-point messages, as for example
Actually you entered the blockchain space with a validator node … but … are not part of the party yet.
In order to join the party, getting the possibility to earn DOT tokens and getting rich ( test-rich only) you have to apply for one of the four Polkadot basic roles, which upkeeps a Polkadot network (refer to the roles discussion in my last article).
Let’s walk-Through the four steps which are necessary to enter the Proof of Stake (PoS) party room in the Validator role.
1. Create an account
As a first step, you have to create an account on https://poc-2.polkadot.io/#/accounts.
Choose a name and password and create your account.
In return, you will get an Account Address (which you can use in public), as well a seed, which you have to keep private! In a later stage when you start up your validator applying as an official validator, you will require your seed again.
2. Get some funding
Having created your account, you now have to get some DOT test tokens for your account.
You require DOT’s test token in order that you can pay the “staking” transaction fee, which brings you forward into the intention queue of future validators.
Head over to the Polkadot Watercooler on Riot, where you will find a lot of helpful people which will send you some DOT’s to your account address.
After receiving some test DOT’s head over to your account and check the balance, in my case 20’000 dots were deposited.
Reconfigure your Validator node and restart
Having a funded account, it’s time to restart your node by applying some parameters, which will bring you onto the intention list of Validators.
Modify the parameter of your Validator, by applying the following values: “—validator —key <yourPrivateSeed>”
and restart your node.
You now have A Validator node running, which is ready for work as a “Proof of Stake” (POS) consensus Polkadot Validator node. So you have expressed the desire to take over this role, but you are not eligible yet.
So grab some of your DOT tokens and head over to the Stake account transaction process.
BTW: The Polkadot Validator will show in his log the following message in this mode (you don’t have to care about this error, it just signifies that you aren’t an official validator yet)
Deep Dive Section: Consensus in context of Polkadot
But what means “BFT agreement” in log entry? Well we have to go way back in the history to the Byzantine Generals
The so-called T wo-General Problem described in 1975 a scenario where two generals are attacking a common enemy and try to communicate via messengers in a reliable and secure way the attack time. The scenario was proven to be unsolvable.
“There is no way to guarantee the second requirement that each general is sure the other has agreed to the attack plan. Both generals will always be left wondering whether their last messenger got through.”
In 1982 a follow-paper was published describing the Byzantine General Problem, which is a generalized version of the Two Generals Problem with a twist. It describes the same scenario, where instead more than two generals need to agree on a time to attack their common enemy. The added complication here is that one or more of the generals can be a traitor, meaning that they can lie about their choice.
The algorithm described in paper was proven, that the algorithm can reach consensus as long as 2/3 of the actors are honest. If the traitors are more than 1/3, the consensus is not reached, the armies do not coordinate their attack and the enemy wins.
Byzantine Faults are the most severe and difficult to deal with. Byzantine Fault Tolerance has been needed in airplane engine systems, nuclear power plants, as well as blockchains. There are various algorithms available tackling the problem.
A consensus algorithm (BFT) is Byzantine Fault Tolerant as long as the number of traitors does not exceed one-third of the generals. You can find a good overview of the following Medium article.
The big breakthrough with blockchains was the usage of Proof of Work (PoW), as well as later Proof of Stake (PoS) as a probabilistic solution to the Byzantine General Problem. The following email by Satoshi Nakamoto (the Bitcoin anonymous founder) from 2008, explains how PoW should be used to solve the problem in an easy language.
In the context of the Polkadot algorithm - which is under development - the white paper states:
Ultimately we expect to be inspired by a number of promising BFT consensus algorithms in the core; Tangaora (a BFT variant of Raft ), Tendermint and HoneyBadgerBFT ]. The algorithm will have to reach an agreement on multiple parachains in parallel, thus differing from the usual blockchain consensus mechanisms.
As Gavin Wood states in the White Paper
For a proof-of-authority (PoA) style network, this alone would be sufficient, however, Polkadot is imagined to be also deployable as a network in a fully open and public situation without any particular organisation or trusted authority required to maintain it. As such we need a means of determining a set of validators and incentivising them to be honest. For this, we utilise PoS based selection criteria.
So it’s important to realise that a BFT algorithm in a PoA environment only (with a consensus mechanism based on identity as a stake) would be sufficient. But the open an public situation of Polkadot ask for additional means.
To conclude the section, there was some debate about Polkadot being a permission-less platform on the Riot channel, let’s summarize the findings (which are backed by the statements in the white paper)
Polkadot will be a public network. Anyone is free to participate in the network, and if nomination processes are used to select validators as the white papers outlines, it might take place daily.
Polkadot’s process will allow any party to attempt to validate as described, just like anyone is free to mine on Ethereum or Bitcoin, that doesn’t mean they are guaranteed a block.
Additionally, the term permission can often apply to more than just block creation, but also to a white or black list allowing or disallowing participation among other restricted sets.
All things considered, Polkadot fits the definition of a permissionless platform.
Having a basic understanding now of the consensus topic let’s move forward with our process of stake and getting nominated.
3. Stake and Get Nominated
This step is the PoS selection process, which will finally incentivise us, in case we are behaving in an honest manner.
To get you on the intention list of potential validators requires you to execute a stake transaction, which comes with some transaction fees (around 210 DOT’s).
Open the Polkadot Admin GU, select the Staking Tab ( https://poc-2.polkadot.io/#/staking) and press the “stake” action button.
You have to provide your password to sign and submit the “staking.stake” transaction. Due to the fact that is your first stake transaction, it’s index is 0.
The execution of this transaction brings you in the waiting room of Validator nodes, which expressed their intention to participate in the Proof of Stake consensus validation process with the next “era” (era will be explained shortly).
Waiting for the next free seat - Taos. New Mexico, 1942 ( Creative CC0 Commons Licence )
Technically the waiting room looks like this
On the left side are the validators shown (with their Nominators - small polkadot icon, below the Validator node) on the right the nodes waiting to enter the party room.
As mentioned above, the listed Intention nodes may get a chance to get an official Validator at the end of an era.
An era is defined as the time required to create and seal 720 blocks on the relay-chain. A new block is created, processed and verified around every 5 seconds. I.e. that means an era lasts for around an hour.
As the white paper describes:
We imagine validators be elected, infrequently (at most once per day but perhaps as seldom as once per quarter), through a Nominated Proof-of-Stake (NPoS) scheme.
For the test environment, the selection process is happening around every hour. The Header information of the Staking GUI, gives some basic information, among other the actual time slot in an era cycle.
As one can see on the header information, there are 22 slots for Validators available and there are 6 validators (22+6=28) waiting on the intentions list. The time passed in an era is slot 653 of the total of 720.
The session counter will express the number of block sealing left until the validator and its nominators are incentivized. In our example 7 block sealings (60-53) left until the next payout phase takes place.
After the end of an era, the eligible validator set will be newly calculated, by applying the following rule
the 22 validators with the highest overall account balance will be the validators for the next era cycle.
The GUI will also show, the lowest validator node of the era with 1’099’715 DOTS and the highest intention node with 2’303’173 DOTS, which means in the next era, there will be a replacement happening (highest intention node will replace the lowest validator).
Now checking my own account balance above (19’793) shows me that I’m way behind the highest intended node with an account balance of 2’303'173.
That means I have to reach out for Nominators, which will back me with their account balance.
So it’s time to describe the second role in the Polkadot ecosystem, the “Nominator”. Let’s use the white paper definition here:
A nominator is a stake-holding party who contributes to the security bond of a validator. They have no additional role except to place risk capital and as such to signal that they trust a particular validator (or set thereof) to act responsibly in their maintenance of the network. They receive a pro-rata increase or reduction in their deposit according to the bond’s growth to which they contribute.
Together with collators, nominators are in some sense similar to the miners of the present-day PoW networks.
It’s important to realise, that a nominator will get either an increase (in case you behave in line with the rules) or a decrease (in case you misbehave and get slashed) of its deposit put on you. So its risk capital in his context, dependent on your misbehavior various level of slashing is foreseen (which affects directly you, as well as indirectly the nominators), as the white paper states:
Some cases of misbehavior threaten the network’s integrity (such as signing invalid parachain blocks and validating multiple sides of a fork) and as such result in effective exile through the total reduction of the bond. In other, less serious cases (e.g. inactivity in the consensus process) or cases where blame cannot be precisely allotted (being part of an ineffective group), a small portion of the bond may instead be fined.
It’s clear that a nominator is keen on supporting validators who stick with the rules.
Reach out to a nominator
So you have to reach out to nominators which are willing to add an increase of your security bond in order to get a chance to get nominated. Potentially you are already in contact with some members via the riot polkadot watercooler or polkadot beginners lounge chat. Contact them:
Entering as Validator
As soon enough Nominators support you, i.e. you are under the 22nd Validators with the highest overall balance, you will be part of the official validator set, which can earn DOTS for sealing new blocks. The log entries will now look like:
You are now an official Polkadot validator which takes part in PoS consensus process.You will find your validator now on the left side of the Staking page:
As you can see here, my account is backed by a nominator which adds 2’226’461 dots.
That’s it for today. In the next article, we will address some reliability and security topics of your node.
Stay tuned …
This blog entry was fully produced within Evernote and published using the Cloudburo Publishing Bot .