Unit 3-1
Unit 3-1
• Blockchain is a distributed system that relies upon a consensus mechanism, which ensures the safety
and liveness of the blockchain network.
• Two types, permissioned and public (non-permissioned), the distinction lies in whether the design of
the network is open for anyone to participate (permissionless) or limited only to designated participants
(permissioned)
• The consensus is also classified based on these two paradigms. For example, Bitcoin is a public
blockchain. It runs PoW, sometimes called Nakamoto consensus
• In contrast, many permissioned blockchains tend to run variants of traditional or classical distributed
consensus. Example Ripple (XRP) currency
• Permissionless blockchains tend to be used in applications with a strong financial component or that
require highly decentralized blockchains, such as the following:
Digital asset trading.
Crowdfunding and donations.
Distributed file storage, such as blockchain storage.
Permissioned blockchains have enabled new applications that depend on privacy and security,
including the following:
Supply chain provenance tracking.
Claims settlement.
Identity verification.
The Byzantine generals problem
• The problem of reaching agreement in the presence of faults
• To be successful, the generals must coordinate their plan and decide whether to attack or retreat
• The requirement now becomes that every honest general must somehow agree on the same decision
even in the presence of disloyal generals.
• In the digital world, generals are represented by computers (nodes) and communication links are
messengers carrying messages. Disloyal generals are faulty nodes. we'll see how agreement can be
achieved using consensus algorithms even in the presence of faults.
Fault tolerance
• A fundamental requirement in a consensus mechanism is that it must be fault-tolerant. In other words, it
must be able to tolerate a number of failures in a network and should continue to work even in the
presence of faults.
• Based on the requirement of fault tolerance, consensus algorithms are also called fault-tolerant
algorithms, and there are two types of fault-tolerant algorithms
• The first is Crash fault-tolerance (CFT) and the other is Byzantine fault tolerance (BFT)
• CFT covers only crash faults or, or simpler faults. In contrast, BFT deals with the type of faults that are
arbitrary/random and can even be malicious
Replication
• Replication is a standard approach to make a system fault-tolerant. Replication results in a
synchronized copy of data across all nodes in a network. This technique improves the fault
tolerance and availability of the network.
• This means that even if some of the nodes become faulty, the overall system/network remain
available due to the data being available on multiple nodes.
• There are two main types of replication techniques, Active replication, Passive replication.
• Active replication, which is a type where each replica becomes a copy of the original state
machine replica
• Passive replication, which is a type where there is only a single copy of the state machine in the
system kept by the primary node, and the rest of the nodes/replicas only maintain the state.
• State machine replication, which is a standard technique used to achieve fault tolerance in
distributed systems (relevant concept)
State machine replication
de facto technique, the recognition that is based on 'a fact, used to achieve fault tolerance in a distributed
system
State machine?
• It is a mathematical model that is used to describe a machine that can be in different states.
• A state machine can only have one state at a time. A state machine stores a state of the system and
transitions it to the next state as a result of input received
State machine replication
• State machine replication is implemented under a primary/backup pattern, where a primary node is
responsible for receiving and broadcasting client requests. This broadcast mechanism is called total order
broadcast or atomic broadcast, which ensures that backup or replica nodes receive and execute the same
requests in the same sequence as the primary.
• Consequently, this means that all replicas will eventually have the same state as the primary, thus resulting
in achieving consensus. In other words, this means that total order broadcast and distributed consensus are
equivalent problems; if you solve one, the other is solved too.
Lower bound results and FLP impossibility
• Model: A computational model, represents processes, network conditions, timing assumptions, and how all
these entities interact and work together
• Processes: called message-passing distributed systems
• Timing assumptions: timing assumptions that are made when designing consensus algorithms.
• Synchrony: there is a known upper bound on the communication and processor delays. At a fundamental
level, in a synchronous system, a message sent by a processor to another is received by the receiver in the
same communication round as it is sent
• Asynchrony: there is no upper bound, designed to run on asynchronous networks without any timing
assumptions, unpredictability of message transfer (communication) delays and processing delays
• Partial Synchrony: is when, the systems are synchronous, but there are arbitrary but bounded asynchronous
periods
Classification
• The consensus algorithms can be classified into two broad categories:
• Traditional—voting-based consensus
• Lottery-based—Nakamoto and post-Nakamoto consensus
Two main types of fault-tolerant algorithms, CFT and BFT.
CFT and BFT are two different categories of consensus algorithms used to achieve
agreement among nodes in a distributed network. They address different types of faults
and have distinct levels of fault tolerance.
• Example, PBFT, Other well-known BFT algorithms include the HoneyBadgerBFT and
Tendermint algorithms.
• Both CFT and BFT algorithms have their advantages and trade-offs, and the choice will depend on the
requirements and constraints of the distributed system or blockchain network being deployed
PBFT and IBFT consensus protocols
• PBFT (Practical Byzantine Fault Tolerance) and IBFT (Istanbul Byzantine Fault Tolerance)
are both consensus protocols designed to achieve BFT in distributed systems.
• They address the issue of reaching consensus in the presence of faulty or malicious
nodes
3. Finality: Once a replica receives enough "Commit" messages, it considers the block as
finalized and adds it to its local copy of the blockchain. The block is considered
confirmed by the network at this stage.
4. View Change: If the primary node becomes faulty or unresponsive, the system
initiates a view change to select a new primary node. This ensures the protocol can
continue operating even if the primary node fails.
Benefits of PBFT include its high throughput, low latency, and ability to tolerate up to
(n-1)/3 faulty nodes, where n is the total number of replicas in the network.
However, PBFT is primarily suited for permissioned blockchains and not so much on
public blockchain networks
Key Features and How IBFT Works
• IBFT was first introduced in the Ethereum network as a consensus mechanism for
private Ethereum networks, where all participating nodes are known and trusted.
1.Validators: In IBFT, the participants in the network are called validators. Validators
are known and explicitly defined entities responsible for proposing and validating
blocks.
2.Block Proposal: In each round, one validator is chosen as the block proposer. The
block proposer creates a new block containing a set of transactions to be added
to the blockchain.
3.Round Robin Selection: The selection of the block proposer is done in a round-
robin fashion. Each validator takes turns being the proposer for a specific round,
ensuring fairness in block proposal opportunities.
4.Proposal and Voting: Once the block proposer creates a block, it broadcasts the
block proposal to all other validators. Other validators receive the proposal,
validate it, and if it meets the consensus rules, they vote to approve the block.
5. Majority Vote: For a block to be considered valid and added to the blockchain, it
requires a threshold number of votes from validators. IBFT typically requires 2/3+1 (or
67%+) of validators to vote in favor of the proposed block for it to be accepted.
6. Finality: Once the required number of votes is achieved, the block is considered
finalized and added to the blockchain. The consensus on the block is irrevocable, meaning
it cannot be changed or rolled back without the agreement of the network's majority.
Benefits of IBFT include fast block finality and high throughput, as only a fraction of the
validators need to reach a consensus on each block.
However, it is important to note that IBFT requires a known set of validators and is not
suitable for fully decentralized and permissionless networks like the public Ethereum
network.
IBFT is primarily used in private and consortium blockchains, where participants are
known and trusted entities.
DISTRIBUTED CONSENSUS MECHANISMS/POS AND POW
Consensus mechanisms actually come from game theory. Your system should be
designed such that the nodes get the most benefit if they play by the rules.
• reward for honest behavior and punish for fraudulent activities
• Example of Bitcoin
• the term mining, would mean generating new blocks
Proof Of Work (POW)
• The idea behind the PoW algorithm is that certain work is done for a block of transactions
before it gets proposed to the whole network. The overall goal is to sustain attacks
• Hence, it involves verifying a transaction through the mining process
• Example: Say you have 1 Bitcoin in your crypto wallet. What does that actually mean? It
means that users worldwide have copies of the historical record of transactions using Bitcoin,
and those records are all in agreement about the balance in your account.
• But what if someone wants to submit a fraudulent transaction trying to spend that same
Bitcoin again after they had previously paid it to you?
• This is why miners must check every new transaction, each of which has unique identifying
information, against the historical record to ensure it adds up. And they have a strong
incentive to do this
Proof of Stake
• The Proof of Stake (PoS) algorithm is another consensus algorithm that is quite popular
for distributed consensus, But it isn’t about mining, it is about validating blocks of
transactions
• So, there are no mining rewards due to generation of new blocks, there are only
transaction fees for the miners (more accurately validators)
• In PoS systems, the validators have to bond their stake (mortgage the amount of
cryptocurrency they would like to keep at stake) to be able to participate in validating the
transactions.
• The probability of a validator producing a block is proportional to their stake; the more
the amount at stake, the greater is their chance to validate a new block of transactions.
Proof of Stake
• simple example: let’s say there’s a new change to the blockchain that needs verification.
Ten nodes volunteer to validate it, and they each stake one crypto coin for the privilege.
That means that they each have an equal 10 percent chance of being awarded the work
• Let’s say that one volunteer really wants to win the work. They could up the odds by
staking three coins on the deal. If everyone else kept their stake at one coin, they would
up their chance of winning the work to 25 percent, while everyone else’s chances would
go down to 8.3 percent.
• Since the creator of a block in a PoS system is deterministic (based on the amount at
stake), it works much faster compared with PoW systems
• The PoS systems may provide better protection against malicious attacks
• Also, since it does not require burning a lot of electricity and consuming CPU cycles, it
gets priority over PoW systems where applicable.
S.No. Proof of Work (PoW) Proof of Stake (PoS)
2.
A reward is given to first miner to solve The validator do not receive a block reward instead
cryptographic puzzle of each block. they collect network fee as their reward.
5.
Proof of work systems are less energy efficient and Proof of Stake systems are much more cost and
are less costly but more proven. energy efficient than POW systems but less proven.
6. Specialized equipment to optimize processing power. Standard server grade unit is more than enough.
Sr No Proof of Work (PoW) Proof of Stake (PoS)
Bitcoin is most well known crypto with a Proof- Some of cryptocurrencies that use different
8.
of-Work consensus building algorithm which variants of proof-of-stake consensus are: EOS
uses most well known proof-of-work function (EOS), Tezos (XTZ), Cardano (ADA), Cosmos
is called SHA256. (ATOM), Lisk (LSK).
QB
• State and explain the Byzantine general’s problem.
• What is Fault tolerance and explain the types of fault-tolerant consensus.
• Illustrate the Proof of Work (PoW), Proof of Stake (PoS) algorithm.
• How consensus algorithms are classified? Explain the fundamental requirements of consensus algorithms.
• Explain the term FLP impossibility. How it can be circumvented.
• How to analyze and understand a consensus algorithm. Explain in detail.
• Explain the difference between the PBFT and IBFT protocols.
• Explain the following terms in a model that is useful for describing and analyzing consensus mechanisms.
• i) Model ii) Processes iii) Timing assumptions
• iv) Synchrony v) Asynchrony vi) Partial synchrony