3

What are the Proof-of-Stake[PoS] algorithms available which can be configured on substrate-node-template

2 Answers2

4

Just follow this tutorial to add this staking pallet to your runtime template.

For more detail, here you go: npos-elections

AurevoirXavier
  • 2,543
  • 2
  • 17
  • 25
3

I think before I can answer concretely, it is important to understand how consensus works in substrate. Let's start by asking:

  1. Who gets to participate in consensus? --> election algorithms, PoA, PoS, anyone (PoW)
  2. Who gets to propose a block? --> Aura, BABE, PoW
  3. Which set of changes are final? --> GRANDPA, longest chain

Here is an overview of the pallets included in substrate you can compose into your node, and here are the pallets you can compose for consensus.

The node template comes packaged with Aura consensus pallet - a Proof of Authority (PoA) block production mechanism with the GRANDPA finality gadget. The template uses the Aura module pallet and the GRANDPA pallet that you see in runtime/src/lib.rs.

So if you wanted to convert the template from PoA to nPoS, you would need to swap Aura (and possibly GRANDPA) for your use case. As an example, Polkadot uses Nominated Proof of Stake (NPoS) (read more here), with BABE as the block production mechanism and the GRANDPA finality gadget. In addition there are pallets related to staking Polkadot also uses that you may want to use as a reference.

Here is also an example walking through configuring a hybrid Pow/PoS consensus node.

Nuke
  • 1,032
  • 7
  • 13