consensus algorithms.pptx
consensus algorithms.pptx
1
Hashing and Digital Signature in Blockchain &
2
Generic terms used in Blockchain
Hashing and Digital Signature in Blockchain &
3
Generic terms used in Blockchain
Hashing and Digital Signature in Blockchain &
4
Generic terms used in Blockchain
Objectives of Consensus Protocol
● Unified Agreement
● Fault Tolerant
● Collaborative and participative
● Egalitarian
● Incentivization
● Prevent double spend
8
● Miners called forger or validator
● An algorithm selects forger randomly based on
the availability of stake with the miner
14
Practical Byzantine Fault Tolerance
2f+1
17
Hashing and Digital Signature in Blockchain &
18
Generic terms used in Blockchain
Hashing and Digital Signature in Blockchain &
19
Generic terms used in Blockchain
Hashing and Digital Signature in Blockchain &
20
Generic terms used in Blockchain
Hashing and Digital Signature in Blockchain &
21
Generic terms used in Blockchain
Blockchain Trilemma
● The Blockchain Trilemma refers to the trade-off between three critical aspects of
blockchain technology: Security, Scalability, and Decentralization.
● Bitcoin and Ethereum prioritize decentralization and security, making scalability a
challenge.
● Public blockchains can typically only achieve two out of the three benefits at any given
time.
● Efforts are ongoing to overcome this hurdle and achieve balance.
22
Decentralization
23
Security
24
Scalability
25
blockchain scalability without compromising decentralization is a significant challenge
These solutions involve modifying the fundamental blockchain protocol to enhance scalability.
● The blockchain is divided into smaller partitions (shards), each capable of processing its own transactions.
● Ethereum 2.0 is implementing sharding to distribute the network load among multiple chains.
● Maintains decentralization by ensuring that each shard remains secure and verified by the network.
● Proof-of-Stake (PoS) and its variations (e.g., Delegated PoS, Nominated PoS) reduce the computational power
required for validation while maintaining decentralization.
● Proof-of-Space and Time (PoST), used by Chia, ensures decentralization without excessive energy
consumption.
● Hybrid PoW-PoS models (e.g., Kadena) allow for efficient scaling while retaining decentralization benefits.
● Adaptive block sizes allow for dynamic adjustments based on network demand.
● Shorter block times improve throughput but require more efficient validation mechanisms.
26
Layer-2 Solutions (Off-Chain Scaling)
State Channels (e.g., Lightning Network, Raiden Network)
● Participants conduct multiple transactions off-chain and only settle final results on-chain.
● Reduces congestion and increases transaction throughput without compromising decentralization.
● Optimistic Rollups: Aggregate multiple transactions and submit a single proof to the main blockchain.
● Sidechains (e.g., Polygon) operate parallel to the main chain but periodically anchor to the main
blockchain for security.
● Plasma Chains function as child chains that process transactions before submitting a final state to the
parent chain.
Alternative Architectures
● Directed Acyclic Graphs (DAGs) (used in projects like IOTA and Nano) allow multiple transactions to
be confirmed simultaneously, increasing scalability.
● Subnets & Parachains (used in Polkadot and Avalanche) distribute transaction load across multiple
interoperable chains.
27
28
29
Hashing and Digital Signature in Blockchain &
30
Generic terms used in Blockchain
Three-phase consensus protocol
PBFT consensus consists of three phases: Pre-Prepare, Prepare, and Commit. Together, they form the core of the PBFT
consensus algorithm:
Pre-Prepare: Primary node is responsible for verifying the requests and generating corresponding pre-prepare messages.
Then, the Primary node will broadcast pre-prepare messages to all Replica nodes. After receiving the messages, Replica
nodes will verify the legitimacy of those pre-prepare messages and then broadcast a corresponding prepare message.
Prepare: Gathering prepare messages. After a certain node gathers 2f+1 prepare messages, it will announce that it is ready
Commit: Gathering commit messages. After a certain node gathers 2f+1 commit messages, it will process the native
requests cached locally and make corresponding changes to the system state.
31
Algorithm
NEW ROUND
PRE-PREPARED
● Validators wait for 2F+1 valid PREPARE messages, and then enter the PREPARED state.
● Validators now broadcast COMMIT messages upon entering PREPARED state.
PREPARED
● Validators wait for 2F+1 commit messages and then enter COMMITTED state.
COMMITTED
● Validators append the 2F+1 commit messages received into the block, and add the block into the blockchain.
● Validators now move a FINAL COMMITTED state when the block is inserted in the chain
FINAL COMMITTED
• A new round is initiated with a new proposer election.
32
Two important properties of distributed systems are Liveness and Safety.
Liveness
Liveness is the term used in the context of distributed systems when the system continues to operate. It means that the
system will not stall and will function even if some errors occur. In the case of blockchain, Liveness means that the
system will continue to add new blocks to the chain and at no point of time the system will stop working.
Safety
Safety is the term used in the context of distributed systems when the system converges to a single decision. In a
distributed system nodes may diverge into two decisions or split further, Safety of the distributed system ensures that
the network will end up with a single decision across all honest nodes even if there exist faulty nodes.
https://medium.com/coinmonks/implementing-pbft-in-blockchain-12368c6c9548
33
Hashing and Digital Signature in Blockchain &
34
Generic terms used in Blockchain
In bitcoin(proof of work), block proposer is the fastest miner,
whereas, in proof of stake, block proposer is the richest miner.
In PBFT, the block creator may not be any special miner, but the
proposed block which is committed to the chain would be the most
agreed block.
Thereby serving the same purpose that PoW and PoS do, i.e. adding a
new block to the chain.
35
Hashing and Digital Signature in Blockchain &
36
Generic terms used in Blockchain