Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

1

Mastering Blockchain
Third Edition

Chapter 5, Consensus Algorithms


Outline 2

• Introducing the consensus problem 

• Consensus mechanism analysis and design 

• Classification 

• Types of algorithm 

• Choosing an algorithm 
Consensus problem 3

• The problem has been studied extensively in distributed systems research since the late
1970s

• This resulted in a rapid evolution of blockchain technology, and more research in novel
methods of consensus has been ongoing

• Conversion of traditional (classical) distributed consensus mechanisms into their blockchain


variants has taken place

• Here, we’ll analyse existing and novel consensus protocols 


The Byzantine generals problem  4

The famous Byzantine generals problem was formulated by Lamport et al. in their paper:
Lamport, L., Shostak, R. and Pease, M., 1982. The Byzantine Generals Problem. ACM
Transactions on Programming Languages and Systems, 4(3), pp.382-401. 

Attack?
Attack ?
Retreat ?

Retreat ?
Attack?
Fault tolerance  5

Types of fault tolerance: Limitations and results:


• Crash Fault Tolerance (CFT) • FLP impossibility

• Byzantine Fault Tolerance (BFT) • Lower bounds

• Upper bounds

How to achieve fault tolerance:


• Replication
• Active

• Passive

• State machine replication


Lower bounds 6

Where F = number of faults:

• In the case of CFT, at least 2F + 1 number of nodes is required to achieve consensus. 

• In the case of BFT, at least 3F + 1 number of nodes is required to achieve consensus.


Analysis and design  7

Designing and analyzing consensus mechanisms requires a model that can be used to study
and explore system properties, and make designs more logical.

A model consists of:

• Processes

• Timing assumptions
• Synchrony

• Asynchrony

• Partial synchrony
Classification 8

Since the invention of Bitcoin, which introduced lottery-based consensus algorithms, there are
two main types of consensus:

• Traditional
• This category includes Paxos, BFT algorithms

• Lottery-based
• This category includes modern Proof of Work (PoW) algorithms
Consensus correctness properties 9

• Safety
• Agreement

• Validity

• Integrity

• Liveness
• Termination
Algorithms 10

• CFT
• Paxos

• Raft

• BFT
• PBFT

• IBFT

• Tendermint

• HotStuff

• Nakamoto and post-Nakamoto


• PoW

• Proof of Stake (PoS)


Paxos 11
Raft 12
PBFT 13
IBFT 14
Tendermint – high-level overview 15
Tendermint process flow 16

The Tendermint process is simple:

Proposal  Pre-vote  Pre-commit

We can visualize the protocol flow with the


diagram shown here.
HotStuff  17
Proof of Work 18

A node that proposes a block has to find a nonce such that:

H (nonce || previous hash || Tx || Tx|| . . . ||Tx) < Threshold value. 


PoS 19

Types of PoS include:


• Chain-based PoS
• Committee-based PoS
• Delegated PoS 

Here, a stake calculator function is used to calculate the amount of staked funds and, based
on that, select a new proposer:

PoS mechanism
Choosing an algorithm  20

• Finality

• Speed

• Performance

• Scalability
21

Exercise

• Read the HotStuff research paper at https://arxiv.org/pdf/1803.05069.pdf


and find out how optimistic responsiveness is achieved.
Summary 22

In this presentation, we covered:

• Prominent protocols in blockchain and traditional distributed system consensus.

• Proof of Work.

• Proof of Stake.

• Traditional BFT protocols.

• Some more recent protocols, such as HotStuff.

You might also like