0% found this document useful (0 votes)
50 views40 pages

Slide 8 Consensus Mechanisms

The document discusses various consensus mechanisms used in blockchains including proof of work, proof of stake, delegated proof of stake, and Byzantine fault tolerance. It provides details on how proof of stake works in Ethereum including the steps to become a validator and participate in block validation and creation.

Uploaded by

aniket23012001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views40 pages

Slide 8 Consensus Mechanisms

The document discusses various consensus mechanisms used in blockchains including proof of work, proof of stake, delegated proof of stake, and Byzantine fault tolerance. It provides details on how proof of stake works in Ethereum including the steps to become a validator and participate in block validation and creation.

Uploaded by

aniket23012001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Consensus Mechanisms

CS8030: Blockchain Technology and Applications


Today
Consensus Mechanisms
◦ Proof of Work ( discussed earlier)
◦ Proof of Stake
◦ Proof of Authority
◦ Other variants

2
Consensus
A group of friends wants to spend time
together.
Two opinions - watching a movie or
going to a local sight seeing place.
Ultimately, they decide to watch a
movie, some very happy, some remain
indifferent between the two choices.
Decision is based on a consensus.

3
Consensus
A general agreement on a decision amongst all participants
in a group.
All participants accept and support the decision.

Mechanism
An established process with defined rules to achieve specific
goals.

4
Consensus Mechanism in Blockchains
A fault-tolerant mechanism that is used in a blockchain network to
achieve the necessary agreement on a single state of the network
among distributed processes in a decentralized way.
It facilitates verification and validation of information being added to
the blockchain ledger.
The mechanism ensures that only authentic transactions are
recorded on the blockchain.

5
Objectives
Unified agreement
Preventing double spending
Aligning incentives
Fair and transparent
Fault tolerant

6
Consensus Mechanisms
Various consensus algorithms exist for different blockchains.
The first consensus mechanism called ‘Proof of Work” (PoW) was introduced
by Satoshi Nakamoto when he created bitcoin.
PoW is the most common and robust consensus mechanism for blockchain
technology. Also known as mining algorithm.
It is computationally expensive \ memory hard.
PoW is not energy efficient.
PoW also suffers from centrality issues, only those with very high computing power
can be miners.

7
Have a look at a Bitcoin mining centre in USA!

8
Proof of Stake
Proof of Stake (PoS) is based on a node’s stake in the system, typically
measured in terms of the wealth, the amount of currency a node holds.
Nodes ( users) validate their stake by demonstrating ownership of some
cryptocurrency on the network by temporarily locking an amount.
Keeping the currency on stake also helps secure the network – one can
lose the staked currency in case of malfunction – intentionally or
unintentional.
Energy efficient and more decentralized as compared to PoW.

9
Proof of Stake

10
Ethereum Proof of Stake

11
Step 1
To become eligible as a validator, a user first deposits 32 ETH into the deposit
contract.

Deposit contract

Deposits 32 ETH

12
Step 2
Then the user installs Execution client

Consensus client

Validator client

This puts the user /node in an activation queue to join the group of validators.

13
Next Stage
Once the node becomes a validator, it receives new blocks for
validation.
It verifies all the transactions and checks their correctness.
Then it validates the block by attesting the block, it is called voting in
favour of the block. This is communicated to the network.

14
15
16
17
Transactions and Block Creation
A user proposes a transaction and signs using their private key.
The amount of base fee + tip is also specified by the user in the
transaction proposal.
The tip is paid as an incentive to a validators.
The base fee is utilized in transaction verification and validation.
The transaction is submitted to an execution client (of a node) which
verifies its validity – that the user has sufficient amount of ETH to fulfill
the transaction and that the key is authentic.

18
Transactions and Block Creation …
All valid transactions are pushed to the local mempool ( memory pool of
unconfirmed transactions ) by the execution client, and are broadcast to
other nodes using the gossip protocol.
In each slot, the block creator node selected randomly collects
transactions from the local mempool and bundles them using their
execution client.
The execution client executes them locally to generate a state change.
Once the execution payload ( the block under process) is generated, the
same is handled by the consensus client of the node.
19
Transactions and Block Creation …
All valid transactions are pushed to the local mempool ( memory pool of
unconfirmed transactions ) by the execution client, and are broadcast to
other nodes using the gossip protocol.
In each slot, the block creator node selected randomly collects
transactions from the local mempool and bundles them using their
execution client.
The execution client executes them locally to generate a state change.
Once the execution payload ( the block under process ) is generated,
the same is handled by the consensus client of the node.
20
Transactions and Block Creation …
The block under construction is called a beacon block.
The beacon block contains information about rewards, penalties,
slashings, attestations etc that enable the network to agree on the
sequence of blocks at the head of the chain.

21
22
Transaction Finality
The time it takes to finalize that a transaction on the blockchain can not
be altered or reversed is known as transaction finality.
A transaction that is recorded in the most recent block may be
vulnerable.
The attacks may try to exploit these vulnerabilities.
Therefore, the first block of each epoch is used as a “checkpoint”
(around 6.4 minutes).
If the blocks after the previous checkpoints are validated by atleast 2/3rd
of the total validators, the current checkpoint is called a ‘justified’ block.

23
24
Security after Finalization
To modify/ revert any transaction of a finalized block, an attacker should
be putting at stake at least one-third of the total staked ETH that have
been staked, to modify/ revert any transaction of a finalized block.
◦ The attacker can do it only by voting with one-third of the total stake.

The validator is expected to maintain sufficient hardware and connectivity to


participate in block validation and proposal.
Slashing – If a selected validator does not participate in the consensus process,
or in creation of a new block, they are penalized by destroying their ETH.
This helps in validators stick to their commitments, and also, to refrain from
bad behaviour.
25
Pros and Cons of PoS
Pros
◦ Staking is easy, any node with a normal laptop can participate in the validation process.
◦ Proof-of-stake mechanism provides several check points for greater crypto security
than proof-of-work.
◦ Less issuance of new ETH is required to incentivize network participants.

Cons
◦ Relatively new, not tested like PoW.
◦ More complex to implement than PoW.
◦ Ethereum's proof-of-stake requires three different software components to run on a
node, to participate in the PoS.

26
Delegated Proof of Stake
Validators don’t work to validate blocks by themselves, they hire
delegates to do the validation for them.
There are 21–100 selected delegates (miners) usually.
Unlike PoW and PoS, in DPoS miners can collaborate to develop
blocks.

27
Delegated Proof of Stake
If the delegates miss their blocks on a regular basis or publish invalid
transactions, the validators vote them out and replace them with some
other selected delegate.
With a collaborative effort and a partially centralized process, DPoS
performs faster than any other consensus algorithm.
The selected delegates are changed periodically and are assigned an
order to deliver their blocks.

28
Image Source: Consensus mechanism overview, WisdomTree MARKET INSIGHT, August, 2021

Source: Zhang, S., & Lee, J. H. (2020). Analysis of the main consensus protocols of blockchain. ICT express, 6(2), 93-97. 29
Byzantine Fault Tolerance

30
Two Generals Problem

31
Byzantine Fault Tolerance (BFT)
Coordinated attack – victory
Uncoordinated attack – defeat
Are there some risks ?
Not all generals may be trustworthy;
some may be traitors.
Not all messengers may be trustworthy;
A messenger could be caught by the
enemy and a fake (enemy) messenger
relays a fake message. Image source: Wikipedia
32
Two Generals’ Problem
Since the possibility of the message not getting through is always > 0,
the generals can never reach an agreement with 100% confidence.
Due to multiple risks, there need to be certain processes that can
guarantee:

◦ Authenticity of Message: The message must be easily verified to ensure it is


authentic and hasn’t been compromised.
◦ Unity: There needs to be a collective consensus by all generals to engage in
the battle plan.
◦ Fault-Tolerant: A few traitors cannot compromise the entire processes.
( traitors should not be more than 1/3rd of the total strength).
33
Practical Byzantine Fault Tolerance (PBFT)
Practical Byzantine Fault Tolerance is a consensus algorithm used by Hyperledger.
In PBFT mechanism, each ‘general’ (node) manages an internal state.
After receiving a message, a general uses the message and its internal state to start a
computation process.
This computation process asks each individual general about the opinion on the
message.
After reaching a conclusion, the general shares the decision with other generals in the
system.
A consensus decision is made based on the total number of decisions submitted by all
the generals.
This approach enforces a low overhead on the performance of the replicated service.
34
Image Source: Consensus mechanism overview, WisdomTree MARKET INSIGHT, August, 2021
Proof of Authority
Suitable for permissioned blockchain ( to discuss later).
Proof-of-Authority (PoA) provides high performance and fault tolerance.
Nodes with proven authority are given the task of generating new
blocks. Nodes’s reputation is at stake if they misbehave.
A node must pass a preliminary authentication to gain the authority to
create a block.
Selection of nodes from a pool of nodes vary in different systems that
use proof of authority.
Highly scalable and secure due to authentication of nodes.
36
Other Variants
Proof of Burn
◦ Rather than spending money on expensive computer equipment, a node ‘burns’ coins
by sending them to an address where they are unrecoverable.
◦ You can earn a lifetime privilege to mine on a system based on a random selection
process.
◦ The more number of coins you burn, the chances are high that you will be selected to
mine the next block.
◦ If your stake in the system fails, so eventually, you will want to burn more coins to
increase your odds of being selected for the next block.

Proof of Weight
◦ Weights associated to increase the proof of stake, in terms of other parameters like
reputation etc.
37
Summary
Consensus algorithms used by various blockchain platforms are decided
by the type of applications.
Consensus models are selected based on intended network, the
relationships between participants, and both functional and non-
functional aspects.
Proof of Work, Proof of Stake, Delegated Proof of Stake and Practical
Byzantine Fault Tolerance are some of the extensively used consensus
mechanisms.
Variants are introduced for different cryptocurrencies and other
blockchain platforms.
38
Next Week
1. Transaction ledgers in blockchain networks, Public and private
ledgers.
2. Permissionless and permissioned blockchain
3. Enterprise level blockchains.

39
Reference and Useful Resources
Ethereum Proof of Stake Page
Zhang, S., & Lee, J. H. (2020). Analysis of the main consensus
protocols of blockchain. ICT express, 6(2), 93-97

40

You might also like