Polkadot innovates the Staking economy under the NPoS consensus

After attending Polkadot's party in Beijing at the end of last year, I have been looking forward to the official economic and governance plan for Staking. Although the final plan has not yet been finalized, the Web3 research documents seem quite complete, and the whole design has made me amazing. I feel that I have seen many projects with PoS as the consensus. The design of the Staking economy is different. The new project will always learn the past projects. The NPoS brought by Polkadot is quite innovative and solves the PoS to a certain extent. There is a problem .

Polkadot can write a lot of things, this article will mainly surround the Staking part and the NPoS formula to select the method of the verifier node, these two aspects have a very close relationship with the income of the holders and the festival.

If a friend who doesn't know about the background of Polkadot can look at my past articles , I will start the topic directly.

Simply review the complete process of the PoS consensus project.

Team running node

2. Register as a certifier

(after the basic threshold)

3. Staking process

(The holder of the coin is entrusted to the node, or the team is free to make a Staking commission)

4. Electoral verifier

(The system selects each round of the block node or the verification node by some algorithm. This article elaborates on Polkadot's NPoS election algorithm.)

5. Package transactions, broadcast transactions, certifiers confirm a series of processes

6. Earn rewards (reward is assigned by node and holder in accordance with Staking ratio)

From the perspective of the holder, it is easier to understand PoS

The holder has a token, Moon, which is based on PoS, and delegates Moon to Slove to the favorite node. The node performs the block and receives the reward, and the reward is distributed according to the Staking ratio. (Staking ratio = number of Moon people participating in Staking / number of Moons participating in Staking).

The above mentioned is the general PoS project calculation of rewards (the amount of reward is positively related to the amount of money held by the holder)

Polkadot proposed NPoS, the original intention is to solve the problems encountered in the past PoS operation, because the positive correlation between the reward and the Staking amount makes the rich nodes richer, and the token distribution tends to be centralized.

The final reward result in NPoS is not based on the amount of Staking, but on the amount of work that each selected node does. (In vernacular, no matter how many Stakings a node has, the reward for a block or verification of a block is The same), NPoS will solve some of the big nodes because of the large amount of Staking to get more rewards, but it also harms some big nodes.

PS: Personal opinion The general project may not be suitable for such an approach at the beginning. This is a game process. Polkadot is a star project. He believes that most people are willing to participate in the network, even if the node exceeds a certain amount of Staking. As expected, they are still willing to contribute

How did Polkadot do it?

Since NPoS is different from the traditional PoS project, the higher the Staking weight is, the higher the probability of the block. The algorithm of the NPoS election verifier is detailed.

Very detailed documentation in the Web3 study, there is another medium article "How Nominated Proof-of-Stake will work in Polkadot", I refer to the example inside (Web 3 research has a lot of mathematics, if I find my logic error please tell me)

NPoS consensus algorithm history

NPoS referred to the electoral method proposed by a Swedish mathematician, Lars Edvard Phragmén, at the end of the 19th century. At that time, the Swedish parliamentary seats were occupied by mainstream parties. Through his algorithm, the allocation of seats was more fair and the proportion of voting was higher. The contact, the small party can get the seats that were not available in the past, the Polkadot team believes that the two have similarities in design concepts, and the improved is the NPoS that is now seen.

NPoS's electoral algorithm, we all know that the blockchain is a distributed system that is maintained by a large number of scattered nodes (verifiers). In the PoS consensus, most of the chains will limit a certain number in order to ensure certain efficiency and security. The certifier is out of the block, that is, the certifier who is not selected is only the candidate, and NPoS selects the formal certifier from a group of certifiers. In Polkadot, a group of formal certifiers becomes the electoral committee ( Committee).

The electoral algorithm has three objective objectives

Balance Balance

Once the Electoral Commission has been determined, the Staking amount of the Holder Nominators will be distributed as evenly as possible to each of the selected Electors Validators. PS: The holder of the currency can choose multiple electors, so there is a system reallocation space.

2. Maximum support Support

Elect a committee of electors, and the number of Stakings received by the electors Validators in the committee should be as close as possible to the Staking amount of the total holder user Nominators.

3. Fair representation of FairRepresentation

Elect a committee of electors, in which the voting rights of the holders of the Nominators will not be overrepresented and will not be underestimated.

PS: The holder can choose multiple nodes. The fairness is the most simplified. At least one of the nodes corresponding to each holder will be selected, plus the actual conditions (the currency status and the system have to select several nodes). After that, some nodes will be eliminated, but as far as possible, the holder of a certain Staking weight can correspond to at least one node.

There may be more than one verification crowd (electoral committee) selected based on these three principles. The final system will select a group of the most reasonable Committee (Electoral Committee) to make a block. It looks complicated and embarrassing. I am the most It started for a long time, and will be followed by the following example of the holder of the electoral certifier. We will understand it more clearly. It is recommended to quickly read this example and then consider the objective objectives of the above three electoral algorithms in the reading process. Finally, take a closer look at the example.

This is an example of an official on Medium (I will help you better understand)

Suppose there are 5 holders (left) and 5 nodes (on the right). From which 4 nodes are selected for block-out, in order to simplify the model, first ignore the node's own Staking amount.

The following are examples of the results of the election (I will explain it to you one by one)

First picture (leftmost)

It does not meet the goal of FairRepresentation, because the first holder of the chart has a weight of 10Dot, which is only 3Dot weight compared to the fifth holder, but ultimately does not correspond to any node he supports, no The holder of a currency that meets the fair representative goal and has a certain Staking weight corresponds to at least one node (in the present case, the first holder is not rewarded).

Second picture

In line with the goal of FairRepresentation, some people may question why the E node is selected and the Node B is not selected. This is related to the redistribution algorithm that will be exemplified next. This is a simple understanding, the second in the figure. The holder has three nodes at the same time. The system only needs to ensure that at least one of the nodes he supports is elected. (There are two nodes supported by him. The second holder will have all the Staking amount. Assigned to these two nodes), while keeping the fifth holder has a supported node E, one of the possible election results for Polkadot.

Third picture

In line with the goal of FairRepresentation, some people may question this contradiction with the second picture. The goal is to make each holder have at least one support node selected, the 5th holder. The supported nodes are not selected because the entire system only needs to select 4 nodes, so it is possible that the fifth Staking weight-lower holder-supported node has no selected result.

The following are the possible outcomes of the above two electoral committees that are in line with the principle of fairness. After the establishment of the electoral committee, the system will be redistributed through Staking.

The Polkadot system will choose a more equitable distribution and security result from each time. In this example, the right side is chosen because it averages better. The average node on the right has a Staking weight of 9.

The above introduces Polkadot's election algorithm. The logic above is very round. The mathematics behind it is more complicated. The official example is in a simple case. If the real situation is enlarged to 100 nodes, each holder will take Staking. The weights are different, and at the same time, it is quite complicated to entrust to multiple nodes. You can think about it several times. According to the three goals mentioned above, each target can be tested as a standard, and you can understand more.

The NPoS election algorithm dynamically assigns the holder's Staking weight, and also selects the last selected node based on some rules, which causes some differences in the existing PoS ecosystem.

1. Under the multiple nodes of the holder, the big node does not strive to win community support, and has the opportunity to be excluded under the algorithm (see the middle B node in Figure 2).

2. Under the goal of balancing staking amount, nodes with small capital and no capital are more favorable, because as many people in the community choose it, under the mechanism of system allocation Staking amount, the probability of winning the selection is higher (Figure 2). Right D node)

3. Under the goal of balancing the amount of staking, the profit of the big node is relatively compressed, and the big node needs to think about whether to entrust its own money and get more profit.

4. The holder is more motivated to choose a small node, and the profit is higher, because the reward is calculated according to the workload of the selected node, as long as the small node supported by the holder is successfully selected for the block, the accumulation on the small node The weight of Staking is not so high. Different holders are rewarded according to the Staking ratio entrusted to the small node. Compared with the delegate to the big node, the entrusted to the small node is more profitable (Imagine that each node earns 10 bucks, large The node needs to be divided into 100 people, and the small node only needs to be divided into 30 people)

Polkadot wants to solve the problem of existing PoS


1. Part of the inevitable centralization problem

2. The low fee will not attract the amount of staking indefinitely in the future, because the income is the workload of the node (now there is a 0 fee node on Cosmos to attract a large number of holders to entrust, such a high Staking weight node in Polkadot and ordinary Staking The weight of the node gets the same benefit)

3. Holders can maximize their interests by selecting different nodes while promoting decentralization

(For the holders, there are a variety of commissioning strategies. I can choose safe and reliable nodes, and I can also pick some small but also reliable nodes to get higher yields.)

Polkadot is actually very complicated in the whole mechanism. I may also have some missing areas. How to attack such a mechanism, whether there are loopholes in the election algorithm, or not, it requires professionals to invest a lot of energy in the area, and there is no discussion here. .

This is the first article to interpret the Polkadot mechanism. After the official parameters and test network come out, it will give you more examples.

(Source: wetez)