Part 1 of 3
Understanding PoS+ Algorithm
Document link: here.
Stomping Elephant (1 of 3):
Understanding PoS+ Algorithm
Latest Core Engine Milestone
Catapult is the upcoming full-featured core NEM engine. The development milestones are chronologically alphabetized and code-named for organization and recognition. Most recently, the Dragon update soared past us, and now the fifth milestone is fast approaching. In this series, we will introduce and examine the changes in the imminent milestone, Elephant.
NEM1 uses a modified proof-of-stake consensus algorithm called Proof of Importance (PoI). Recall that in a basic Proof-of-Stake (PoS) consensus algorithm, the formation of a subsequent block in a blockchain is stochastically assigned to a coin-holding “stakeholder” of the blockchain weighed by a combination of factors relating to the stakeholders’ wealth. PoI was so named because the block creators (all block creators are sourced from the pool of local and delegated “harvesters”) are selected on the basis of each account’s “importance” in the NEM network.
The novel algorithm determines the score based on a network theory that considers each account’s recent transactions, “vested stake”, and transaction partners. It was cleverly innovated by NEM’s devs to overcome the pitfalls of the Proof of Work (PoW) and PoS consensus systems, but the PoI system as in NEM1 needed improvement.
- Scalability: While PoI compares favorably to PoW in terms of scalability, PoI is not projected to scale well in the long run. The computation of importance for large numbers of harvesters puts an exponential strain on the network. For instance, if the minimum required balance for harvesters were 10,000 XEM, the number of harvesters could potentially near 900,000 in the worst-case scenario; the collection of relevant transactions and subsequent calculation of importance scores for all eligible accounts would simply cost too much memory and computing power.
- Harvesting distribution: PoI was originally designed to disrupt the unfair advantage given to coin hoarders in the standard PoS consensus system. However, the present PoI protocol does not involve smaller accounts to the extent originally intended, making PoI behave much too similarly to PoS.
From an ecosystem’s health perspective, there were three primary factors to consider:
- Stake: Owners with larger balances create stability and have more incentive to see the ecosystem flourish.
- Transactions: Usage of the network should be encouraged
- Nodes: More active nodes lead to a more robust and stable network.
The combination of these factors should determine an account’s stake in the ecosystem and their appropriate reward. Hence, the new algorithm factors in three sub-scores for all high-value accounts:
- Stake Score (S'): Percentage of the effective balance of all high value accounts at time P.
- Transaction Score (T'): Percentage of total transaction fees among all high-value accounts in period P-1 to P.
- Node Score (N'): Percentage of total beneficiaries among all blocks in P-1 to P.
In summary, the new algorithm rewards accounts for having stake, participating in the network, and running active nodes.
This consensus protocol is much more efficient. In NIS1, power iterations are calculated by creating an outlink matrix that defines the transaction graph. Catapult simplifies the calculation, using transaction fees as a proxy of activity. As a result, the scalability of NEM’s consensus protocol is significantly improved.
Furthermore, the algorithm selects harvesters more fairly. It is constructed so that the combination of the Activity Score and the Node Score has a multiplier effect when the Stake Score is low but becomes insignificant when the Stake Score is high. The mathematical adjustments were made in accordance with observations made in NIS1; the influence drops sharply between effective balances of 10,000 to 100,000 and phases out almost entirely at 200,000. Consequently, the rich-get-richer problem is corrected.
The improved consensus protocol considers accounts’ stakes in the network, but with more variables than the standard PoS protocol. Thus, the consensus protocol for Catapult is aptly named PoS+, and it will perform as how the PoI was originally envisioned to. More efficient than PoW and more egalitarian than the PoS, the upgraded PoI will enhance the NEM blockchain experience for all users powering the network.
For more details about the PoS+ algorithm, please visit the NEM Developer Center. In the next part of this series, we will introduce the notable upcoming features such as metadata and Mosaic Restriction.