Consensus Mechanism

Vincent Castelin
Vincent Castelin
Thu Jan 05 2023

Introduction to Consensus

Consensus, in peer-to-peer distributed systems, is the means by which the network participants come to an agreement on the system state, in a nearly synchronous way. 

The principle is simple:

  • A participant provides new data to the network. Think about it as a sentence.
  • The data validity is evaluated against the system rules by the network. Think about it as a grammar.
  • The validated data is inserted in the system history, creating a new system state. Think about it as a paragraph.
  • The new state is shared and validated. Think about it as an story.

However it is still possible to provide valid data - sentence & grammar is ok - while violating the shared state: 2 participants may end with 2 different stories. It can be because:

  • Data is malicious: it matches the system rules but it does not reflect real user actions. In other words the sentence is grammatically correct but does not describe something true.
  • Data is not correctly ordered which may be caused by the propagation time needed to reach all system participants. Sentences described real actions but one happened before the other. And yes, order matters.

That's where consensus mechanisms join the game.

What are consensus mechanisms?

In blockchain, we often talk about consensus mechanisms when we talk about Proof of Work or Proof of Stake, and more broadly about all the other "Proof of x". And yet these are NOT consensus protocols but measures of resistance to Sybil attacks: a means of deciding who is the author of the last block.

It is the combination of this Sybil attack resistance mechanism and a chain selection rule that constitutes a consensus mechanism! Once we agree on the validity of a block and who issued it, we need to agree on the chain to add it to.

Sum up: Consensus = Sybil Resistance Mechanism + Chain Selection Rule

There you are, ready for your discussions at geek parties.

Sybil Resistance Mechanisms

It is used in peer-to-peer distributed systems to resist against Sybil attacks. Sybil attacks are when one entity operates multiple identities at the same time to take control or influence the system. Someone tries to propagate wrong data in the system. If it succeeds, the system will consider the wrong data as...right data. At this point it could sound similar to some companies having financial, political and media influence in our societies but that's another story.

Resistance mechanisms often comes with slash and rewards systems in order to incentivize "good" behavior and punish "bad" ones: you get paid for doing the job correctly, and you pay to attack the network in such a way that attacking the system becomes very costly. It's not always enough and it has to be well studied and designed, but it's part of the solutions portfolio. It can be completed with identity verification measures.

Some examples:

  • Proof of Work : Bitcoin and most of the first blockchains generation such as Ethereum until September 2022, Monero, Litecoin, etc.
  • Proof of Stake and its derivatives (dPos, nPoS, etc.): Ethereum since September 2022, Polkadot
  • Proof of history: Solana
  • Some proprietary ones: Ripple
  • Practical Byzantine Fault Tolerance: PBFT

Chain Selection Rule

We now have correct data and we are sure it has been provided by an authentic and good participant. The last item to address is correct data ordering. A rule is defined and followed by all participants: it's the chain selection rule. For a participant who would receive 2 different chain versions, it allows selecting the one to keep adding information to.

Bitcoin uses the "longest chain" rule: the longest blockchain is the one the rest of the nodes accept as valid and work with. 

The combination of proof-of-work and longest chain rule is known as "Nakamoto Consensus."

Exploring Consensuses