0% found this document useful (0 votes)
12 views

Consensus Algorithm

Consensus algorithms in blockchain are essential for maintaining network integrity, security, and decentralization by enabling nodes to agree on a shared state. Various consensus mechanisms exist, including Proof of Work, Proof of Stake, and Byzantine Fault Tolerance, each with its own advantages and challenges. These algorithms ensure valid transactions, promote transparency, and improve efficiency while preventing malicious activities like double-spending.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Consensus Algorithm

Consensus algorithms in blockchain are essential for maintaining network integrity, security, and decentralization by enabling nodes to agree on a shared state. Various consensus mechanisms exist, including Proof of Work, Proof of Stake, and Byzantine Fault Tolerance, each with its own advantages and challenges. These algorithms ensure valid transactions, promote transparency, and improve efficiency while preventing malicious activities like double-spending.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Consensus

Consensus in Blockchain
• Consensus algorithms are a set of rules or protocols that enable
nodes in a blockchain network to agree on a shared state of the
network.
• A consensus algorithm is responsible for maintaining the integrity of
the blockchain by ensuring that no single node or group of nodes can
manipulate the network.
Need for Consensus
• Provide security by preventing malicious actors from taking control of the network,
ensuring valid transactions and smooth network operation.
• Pelp achieve decentralization by ensuring all nodes come to a consensus on transaction
validity, preventing centralization.
• Promote transparency by making all transactions visible on the blockchain, making it easy
to track and prevent fraudulent activities.
• Improve efficiency by allowing nodes to quickly agree on transaction validity and add
new blocks to the blockchain in a timely manner.
Types
• Proof of Work (PoW)
• Proof of Stake (PoS)
• Delegated Proof of Stake (DPoS)
• Leased Proof of Stake (DPoS)
• Proof of Authority (PoA)
• Byzantine Fault Tolerance (BFT)
• Practical Byzantine Fault Tolerance (PBFT)
• Directed Acyclic Graph (DAG)
• Proof of Capacity (PoC)
• Proof of Burn (PoB)
• Proof of Identity (PoI)
• Proof of Activity (PoA)
• Proof of Elapsed Time (PoET)
• Proof of Importance(PoI)

Proof of Work (PoW)

• Used to validate transactions and add new blocks to the chain.


• introduced by Satoshi Nakamoto, as a way to secure the network and
prevent double-spending.
• PoW algorithm requires miners to solve complex mathematical
problems, known as hashes, in order to validate transactions and add
new blocks to the chain.
• hash function used in PoW algorithms is designed to be
computationally difficult to solve: - requires a significant amount of
computational power to solve the problem and add a block to the
chain.
• Miners compete with each other to solve the problem, and the first
one to solve it is rewarded with newly minted cryptocurrency.
• Secure – Prevents 51% attack
Selfish Mining
• The selfish miner competes and successfully mines a block.
• Rather than broadcasting this block to the network, they keep it private, creating
an accidental fork – a series of blocks running parallel to the blockchain.
• While honest miners toil on the main chain, the selfish miner continues to mine
blocks on their secret fork.
• The aim is to have a longer private chain. Once this is achieved, they disclose their
secret fork.
• The network always recognizes the longest chain as the most valid.
• If the selfish miner’s chain is longer, it gets adopted, and the honest miners’ blocks
are discarded, causing them to lose their rewards.
Is it possible? Yes but difficult.
• the attacker needs a significant amount of computational power to make their
private chain the longest.
• the Bitcoin community, being watchful and ideologically driven, would
likely resist efforts to undermine the network.
51% Attack
• 51% attack is an attack on a blockchain network where a single entity gains
control of more than half (51%) of its staking or computational power.
• How does it work?
• Accumulate Power
• Partitioning
• Fast-Paced Mining
• Reintegration and Dominance
• Potential Threats
• Double-Spending, Denial-of-Service (DoS) Attack, Transaction
Reversal, Damage to Reputation
Real world cases
• Bitcoin Gold (BTG): 2018, double-spend approximately $18 million worth of
BTG.
• Ethereum Classic (ETC): 2020, double-spend approximately $5.6 million worth
of ETC.
• Vertcoin (VTC): 2018, double-spent 603 VTCs, equivalent to roughly $100,000.
Proof of Stake (PoS)

• Unlike Proof of Work (PoW), which requires miners to solve complex


mathematical problems, PoS relies on validators who hold a certain amount of
cryptocurrency(Stake) to validate transactions and add new blocks to the chain.
• The larger the stake, the greater the chance of being selected to add a block to the
chain.
• Validators are incentivized to act honestly because they risk losing their stake if
they validate fraudulent transactions or try to attack the network.
Pros & Cons
• Less energy intensive, more environmentally friendly and less costly to operate.
• it promotes decentralization.

• lead to a rich-get-richer situation, where validators with the largest stake continue
to earn more cryptocurrency, making it more difficult for smaller validators to
participate in the network.
• random selection of validators
• limiting the amount of cryptocurrency that a single validator can hold.
Delegated Proof of Stake (DPoS)
Relies on a smaller group of validators, known as delegates or witnesses, to validate
transactions and add new blocks to the chain.

token holders vote for delegates to represent


them in the validation process
Pros & Cons
• more efficient.
• promotes decentralization while still providing fast transaction processing times
• can lead to a concentration of power in the hands of a small group of delegates.
• limiting the number of delegates that any one entity can control.
LPoS Allows smaller token holders to participate in the validation
process by leasing their tokens to larger validators.
PoA
• Hybrid consensus mechanism that combines Proof of Work (PoW)
and Proof of Stake (PoS) to achieve a more secure and efficient
blockchain network.
• Developed to prevent high energy consumption and centralization
risks of PoW & PoS.
• first uses PoW to generate new blocks, similar to Bitcoin. (only header &
miners address)
• once a new block is generated, the system selects a random group of
validators from the network based on their PoS holdings.
• These validators are then required to sign the new block, providing a second
layer of consensus verification.
Pros & Cons
• less energy-intensive
• more secure and efficient.
• PoW ensures that blocks are difficult to create and helps prevent malicious
attacks.
• PoS encourages long-term network participation and prevents centralization by
distributing rewards based on the amount of stake a participant holds.

• it can still be susceptible to 51% attacks.


• more complex to implement.
PoET
• Prevents high resource utilization and high energy consumption.
• Uses fair lottery system- based on spreading the chances of winning fairly across
the largest possible number of nodes in the network.

• Developed by Intel for use in permissioned blockchain networks.


How it works
• each participant in the network is assigned a random waiting time, similar to a
lottery.
• Participants compete to be the first to finish their wait time, and the first to do so is
granted the right to create the next block.
• This process is called a “leader election.”
• in PoET participants simply wait for their assigned time to elapse.
• PoET need to ensure 2 factors:
• The participant nodes are genuine while selecting a time, time should be selected randomly.
• Winner node indeed has completed the waiting time.

• This waiting period is determined using a trusted execution environment (TEE) provided by Intel’s
hardware, which ensures that the wait time is random and cannot be influenced by participants.
• Software Guard Extensions (SGX)
Pros & Cons
• Less energy consumption
• More secure
• Leader selection is random

• Need Intel’s specialized hardware.


• Not suitable for public Blockchain.
Proof of Burn (PoB)
• No Computational power or storage space.
• PoB requires participants to burn, or destroy, cryptocurrency tokens to prove their
commitment to the network.
• To participate in a PoB system, a user must send a certain amount of
cryptocurrency to an address where it will be permanently destroyed. – Burning
• Once the cryptocurrency is burned, the user is given the right to add new blocks
to the blockchain and receive rewards for doing so.
it can help reduce inflation in a cryptocurrency ecosystem.

Since tokens are being destroyed rather than created, the overall supply of tokens decreases,
which can help stabilize the value of the cryptocurrency.
Byzantine Fault Tolerance
Byzantine General’s Problem •The messenger might get captured while delivering the
decision.

What if an imposter altered the message received.

How can a general make sure if he received the message
from the expected general?

What if other generals become traitors and they send the
message to attack, but they actually retreat.
Byzantine General’s Problem in real time
Byzantine Fault Tolerance (BFT)
• To ensure the success of the generals’ team, they need an algorithm that could
adhere to the following conditions:
• All the troop generals need to agree on the next action of the plan.
• The generals should be trustworthy and loyal to the system.
• Generals must not get influenced to become network traitors.
• They need to follow the algorithm of the system.
• The group of generals needs to reach a consensus or decision, irrespective of the
traitors’ actions.
• Upto ‘f’general may behave maliciously. So we need 3f+1 generals in total to
tolerate f malicious nodes. (i.e <1/3 may be malicious)

• Byzantine Fault Tolerance (BFT) is a consensus approach that resists a system to get into the Byzantine
Generals’ problem. It also means the system should stay intact even if one of the nodes (or general)
fails. In addition, BFT aims to reduce the effect of malicious byzantine nodes (or general) on the network.
Practical Byzantine Fault Tolerance (PBFT)
• To overcome the Byzantine problems, Barbara Liskov and Miguel Castro
introduced a Practical Byzantine Fault Tolerance (pBFT) consensus
algorithm in 1999
• Ensures a group of computers can agree on something even if some of
them are trying to cheat and disrupt the process.
• How?? – PBFT works by replicated state machine approach.
• Every node has a copy of same state machine and follows same set of instructions.
• When a new value need to be agreed upon a node(leader) proposes a value.
• Every other node(Back-up) with their state machine runs the same instruction and
gets the same value.
• A multi-step voting process will be carried out to ensure majority of the nodes agree
upon the proposed value.
• Every node must respond to the leader node with a response.

Once a sufficient vote is received the state machine is updated with new value and the
process repeats for each new value.
PBFT
Byzantine General’s Problem
• Game theory problem that provides a description of the extent to which decentralized
parties experience difficulties in reaching consensus without any trusted central parties.

• The Byzantine army is divided into many battalions with each division led by a general.
• The generals connect via messenger to agree to a joint plan of action in order to achieve
success.
• Probable that traitors will try to sabotage their plan by intercepting or changing the
messages.

• The purpose of this challenge is for all of the faithful commanders to reach an agreement
without the imposters tampering with their plans.
Online Shopping

Receiver Payment System


Byzantine Agreement Methods
• The Byzantine Agreement is a problem in computer science and distributed systems,
where multiple participants must agree on a single value in the presence of faulty actors
that may behave arbitrarily.

• In other words, the Byzantine Agreement is a consensus algorithm that enables nodes in a
distributed network to reach a consensus despite the presence of faulty nodes that may
behave maliciously or send incorrect information to other nodes.

• The Byzantine Agreement is a crucial component in many important applications such as


blockchain, distributed databases, and replicated systems.

• In these systems, it is important to reach consensus among all nodes, even in the presence
of nodes that may behave incorrectly.
BFT
• Byzantine Fault Tolerance(BFT) is the feature of a distributed network to reach
consensus(agreement on the same value) even when some of the nodes in the network fail
to respond or respond with incorrect information.
• The objective of a BFT mechanism is to safeguard against the system failures by
employing collective decision
BFT
• Byzantine Fault Tolerance is one of the core characteristics of developing trustworthy
blockchain rules or features is tolerance.
• When two-thirds of the network can agree or reach a consensus and the system still
continues to operate properly, it is said to have BFT.
• Blockchain networks’ most popular consensus protocols, such as proof-of-work, proof-of-
stake, and proof-of-authority, all have some BFT characteristics.

You might also like