0% found this document useful (0 votes)
28 views21 pages

Digital Notes - 3

The document discusses various consensus algorithms used in blockchain technology, focusing on their functions, advantages, and challenges. It covers Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and Proof of Importance (PoI), highlighting their mechanisms and implications for security, decentralization, and energy efficiency. The document emphasizes the importance of consensus protocols in achieving reliability and trust in decentralized networks without a central authority.

Uploaded by

Mehul Thuletiya
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)
28 views21 pages

Digital Notes - 3

The document discusses various consensus algorithms used in blockchain technology, focusing on their functions, advantages, and challenges. It covers Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and Proof of Importance (PoI), highlighting their mechanisms and implications for security, decentralization, and energy efficiency. The document emphasizes the importance of consensus protocols in achieving reliability and trust in decentralized networks without a central authority.

Uploaded by

Mehul Thuletiya
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/ 21

Blockchain Unit-3 Sem-7

Distributed Consensus:
Content Summary: Distributed systems, Consensus decision- making, Blockchain
Consensus, Blockchain Nodes: Light nodes, Full Nodes, Mining Nodes, Byzantine
Generals Problem, Byzantine Fault Tolerance, Practical and Federated BFT, Consensus
Algorithms: Proof of Work, Proof of Stake, Proof of Work v Stake, Delegated Proof of
Stake, Proof of Importance, Proof of Elapsed Time, Proof of Capacity, Proof of Authority,
RAFT, 51% Attack, Forking, Hard and Soft Forking: Case Studies

 Consensus Algorithms in Blockchain


 We know that Blockchain is a distributed decentralized network that provides
immutability, privacy, security, and transparency. There is no central authority
present to validate and verify the transactions, yet every transaction in the
Blockchain is considered to be completely secured and verified.

 This is possible only because of the presence of the consensus protocol which is a
core part of any Blockchain network. A consensus algorithm is a procedure through
which all the peers of the Blockchain network reach a common agreement about
the present state of the distributed ledger.

 In this way, consensus algorithms achieve reliability in the Blockchain network and
establish trust between unknown peers in a distributed computing environment.
Essentially, the consensus protocol makes sure that every new block that is added to
the Blockchain is the one and only version of the truth that is agreed upon by all the
nodes in the Blockchain.

 The Blockchain consensus protocol consists of some specific objectives such as


coming to an agreement, collaboration, cooperation, equal rights to every node, and
mandatory participation of each node in the consensus process. Thus, a consensus
algorithm aims at finding a common agreement that is a win for the entire network.
Now, we will discuss various consensus algorithms and how they work.

1
Blockchain Unit-3 Sem-7

Blockchain – Proof of Work (PoW)

 Proof of Work consensus is the mechanism of choice for the majority of


cryptocurrencies currently in circulation. The algorithm is used to verify the
transaction and create a new block in the blockchain.
 The idea for Proof of Work (PoW) was first published in 1993 by Cynthia Dwork
and Moni Naor and was later applied by Satoshi Nakamoto in the Bitcoin paper in
2008.
 The term “proof of work” was first used by Markus Jakobsson and Ari Juels in a
publication in 1999.
 Cryptocurrencies like Litecoin, and Bitcoin, Bitcoin cash are currently using
PoW. Ethereum was using PoW mechanism, but now shifted to Proof of Stake
(PoS).

 Purpose of PoW: -

 The purpose of a consensus mechanism is to bring all the nodes in agreement, that
is, trust one another, in an environment where the nodes don’t trust each other.
 All the transactions in the new block are then validated and the new block is then added
to the blockchain.
 The block will get added to the chain which has the longest block height.
 Miners (special computers on the network) perform computation work in solving a
complex mathematical problem to add the block to the network, hence named,
Proof-of-Work.
 With time, the mathematical problem becomes more complex.

 Features of PoW: -
 There are mainly two features that have contributed to the wide popularity of this
consensus protocol and they are:
o It is hard to find a solution to a mathematical problem.
o It is easy to verify the correctness of that solution.

 How Does PoW Work?


 The PoW consensus algorithm involves verifying a transaction through the mining
process. This section focuses on discussing the mining process and resource
consumption during the mining process.

 Mining:

 The Proof of Work consensus algorithm involves solving a computationally challenging


puzzle in order to create new blocks in the Bitcoin blockchain. The process is known as
‘mining’, and the nodes in the network that engages in mining are known as
‘miners. The incentive for mining transactions lies in economic payoffs, where
competing miners are rewarded with 6.25 bitcoins and a small transaction fee. This
reward will get reduced by half its current value with time.

2
Blockchain Unit-3 Sem-7

 Challenges With PoW

 The Proof-of-Work consensus mechanism has some issues which are as follows:
 The 51% risk: If a controlling entity owns 51% or more than 51% of nodes in the
network, the entity can corrupt the blockchain by gaining the majority of the network.
 Time-consuming: Miners have to check over many nonce values to find the right
solution to the puzzle that must be solved to mine the block, which is a time-consuming
process.
 Resource consumption: Miners consume high amounts of computing power in order to
find the solution to the hard mathematical puzzle. It leads to a waste of precious
resources (money, energy, space, hardware). It is expected that 0.3% of the world’s
electricity will be spent to verify transactions by the end of 2028.
 Not instantaneous transaction: Transaction confirmation takes about 10–60 minutes.
So, it is not an instantaneous transaction; because it takes some time to mine the
transaction and add it to the blockchain thus committing the transaction.

Proof of Stake (PoS) in Blockchain

 Why Proof-of-Stake:
o Before proof of stake, the most popular way to achieve distributed consensus was
through Proof-of-Work (implemented in Bitcoin).
o But Proof-of-Work is quite energy (electrical energy in mining a bitcoin) intensive.
So, a proof-of-work based consensus mechanism increases an entity’s chances of
mining a new block if it has more computation resources.
o A part from the upper two points, there are other weaknesses of a PoW based
consensus mechanism. In such a scenario, a Proof-of-Stake based mechanism holds
merit.

 What is Proof-of-Stake:
o As understandable from the name, nodes on a network stake an amount
of cryptocurrency to become candidates to validate the new block and earn the fee
from it. Then, an algorithm chooses from the pool of candidates the node which will
validate the new block. This selection algorithm combines the quantity of stake
(amount of cryptocurrency) with other factors (like coin-age based selection,
randomization process) to make the selection fair to everyone on the network.

 Coin-age based selection:


The algorithm tracks the time every validator candidate node stays a validator. The
older the node becomes, the higher the chances of it becoming the new validator.
 Random Block selection:
The validator is chosen with a combination of ‘lowest hash value’ and ‘highest stake’.
The node having the best weighted-combination of these becomes the new validator.

3
Blockchain Unit-3 Sem-7

 A typical PoS based mechanism workflow:


o Nodes make transactions. The PoS algorithm puts all these transactions in a pool.
o All the nodes contending to become validator for the next block raise a stake. This stake
is combined with other factors like ‘coin-age’ or ‘randomized block selection’ to select
the validator.
o The validator verifies all the transactions and publishes the block. His stake still remains
locked and the forging reward is also not granted yet. This is so that the nodes on the
network can ‘OK’ the new block.
o If the block is ‘OK’-ed, the validator gets the stake back and the reward too. If the
algorithm is using a coin-age based mechanism to select validators, the validator for the
current block’s has its coin-age reset to 0. This puts him in a low-priority for the next
validator election.
o If the block is not verified by other nodes on the network, the validator loses its stake and
is marked as ‘bad’ by the algorithm. The process again starts from step 1 to forge the
new block.

 Features:

 Fixed coins in existence:


o There is only a finite number of coins that always circulate in the network. There is no
existence of bringing new coins into existence (as in by mining in case of bitcoin and
other PoW based systems). Note that the network starts with a finite number of coins or
‘initially starts with PoW, then shifts to PoS’ in some cases.

 Transaction fee as reward to minters/forgers:


o Every transaction is charged some amount of fee. This is accumulated and given to the
entity who forges the new block. Note that if the forged block is found fraudulent, the
transaction fee is not rewarded. Moreover, the stake of the validator is also lost (which
is also known as slashing).

 Impracticality of the 51% attack:


o To conduct a 51% attack, the attacker will have to own 51% of the total cryptocurrency
in the network which is quite expensive. This deems doing the attack too tedious,
expensive and not so profitable. There will occur problems when amassing such a share
of total cryptocurrency as there might not be so much currency to buy, also that buying
more and more coins/value will become more expensive. Also validating wrong
transactions will cause the validator to lose its stake, thereby being reward-negative.

 Advantages of PoS:

 Energy-efficient:
o As all the nodes are not competing against each other to attach a new block to the
blockchain, energy is saved. Also, no problem has to be solved (as in case of Proof-of-
Work system) thus saving the energy.

 Decentralization:
o In blockchains like Bitcoin (Proof of Work system to achieve distributed consensus), an

4
Blockchain Unit-3 Sem-7

extra incentive of exponential rewards is in place to join a mining pool leading to a more
centralized nature of blockchain. In the case of a Proof-of-Stake based system (like
Peercoin), rewards are proportional(linear) to the amount of stake. So, it provides
absolutely no extra edge to join a mining pool; thus, promoting decentralization.

 Security:
o A person attempting to attack a network will have to own 51% of the stakes (pretty
expensive). This leads to a secure network.

 Weakness of a PoS mechanism:

 Large stake validators:


o If a group of validator candidates combine and own a significant share of total
cryptocurrency, they will have more chances of becoming validators. Increased
chances lead to increased selections, which lead to more and more forging reward
earning, which lead to owning a huge currency share. This can cause the network to
become centralized over time.

 New technology:
PoS is still relatively new. Research is ongoing to find flaws, fix them and making it
viable for a live network with actual currency transactions.

 The ‘Nothing at Stake’ problem:


This problem describes the little to no disadvantage to the nodes in case they support
multiple blockchains in the event of a blockchain split (blockchain forking). In the
worst-case scenario, every fork will lead to multiple blockchains and validators will
work and the nodes in the network will never achieve consensus.

Delegated Proof of Stake (DPoS) is a consensus algorithm which is an


advancement of the fundamental concepts of Proof of Stake. Delegated Proof of
Stake (DPoS) consensus algorithm was developed by Daniel Larimer, founder of
BitShares, Steemit and EOS in 2014.
o In Proof of Stake consensus system, each person who stakes a token can participate
to the “mintage” process which means that they get a chance to select layer two
nodes which further validates block and be rewarded for adding blocks
to blockchain.
o DPoS system is maintained by an election system for choosing nodes which verify
blocks. These nodes are called “witnesses” or “block producers”.

 Here is how DPoS consensus works:


o Voting:
In DPoS consensus users can either directly vote or give their voting power to
another entity to vote on their behalf. Selected witness is responsible for creating
blocks by verifying transactions. If they verify and sign all transactions in a block,
they receive a reward, which is usually shared with those who have voted for
witness.
o If a witness fails to verify all transactions in the given time, block is missed, all
transactions are left unverified and no reward is distributed to that witness. The

5
Blockchain Unit-3 Sem-7

reward is added up to reward of the next witness which verifies that block.
o Such transactions are collected by the next witness, and such a block is
called stolen.
o Votes are proportionate to size of each voter’s stake. A user need not have a large
stake to enter the top tier of witnesses. Rather, votes from users with large stakes
can result in users with relatively small stakes being elevated to the top tier of
witnesses.

 Advantages:
o DPoS blockchains have good protection from double-spending.
o DPoS is more democratic and financially inclusive due to lesser staking amount
required by a user/node.
o DPoS provides more decentralization as more people take part in the consensus due
to low entry threshold.
o DPoS doesn’t require lots of power to run network, which makes it more
sustainable.
o Transactions in DPoS is not dependent on computing power required to run
network, hence it is more scalable.
o DPoS separates election of block producers from block production itself which
opens door for more creative models to solve both problems in isolation.
o DPoS method provides foundation for implementing interesting governance models
in blockchain applications. In a sense, it forms a kind of democracy.

 Disadvantages:
o Effective operation and decision making of network requires delegators to be well
informed and appoint honest witnesses.
o Limited number of witnesses can lead to centralization of network.
o DPoS blockchain is susceptible to problems of weighted voting. Users with smaller
stake can refuse from taking part in voting after considering that their vote is
insignificant.

Proof of Authority consensus


o In blockchain platforms, consensus mechanisms can be divided into permissionless
(e.g. Ethereum, Bitcoin) and permissioned (e.g. Hyperledger, Ethereum Private).
Unlike permissionless blockchain where anyone can become node, in permissioned
blockchain all nodes are pre-selected. This allows to use consensus types with high
scalability and bandwidth. One of these consensus types is Proof-of-Authority
(PoA) consensus which provides high performance and fault tolerance. Term was
proposed in 2017 by co-founder of Ethereum and Parity Technologies Gavin Wood.

 Working of PoA :
o In PoA, rights to generate new blocks are awarded to nodes that have proven their
authority to do so. These nodes are referred to as “Validators” and they run
software allowing them to put transactions in blocks. Process is automated and does
not require validators to be constantly monitoring their computers but does require
maintaining the computer uncompromised. PoA is suited for both private networks
and public networks, like POA Network, where trust is distributed.

6
Blockchain Unit-3 Sem-7

 Conditions for PoA consensus:


o PoA consensus may vary according to different implementation but generally they
are applied through the following conditions:
o Validators need to confirm their real identities.
o A candidate must be willing to invest money and put his reputation at stake. A
tough process reduces risks of selecting questionable validators and incentivize
long-term commitment to the blockchain.
o Method for selecting validators must be equal to all candidates.
o Identity of validators must be verified to maintain integrity of blockchain. Some
sort of process should be there to select honest validators.

 Advantages of PoA consensus:


o High risk tolerance as long as 51% of the nodes are not acting maliciously.
o Interval of time at which new blocks are generated is predictable. For PoW and PoS
consensuses, this time varies.
o High transaction rate.
o Far more sustainable than algorithms like Proof of Work which require
computational power.

 Limitations:
o PoA is not decentralized but is just an effort to make centralized systems more
efficient.
o PoA validators are visible to anyone. Knowing validators identities could
potentially lead to third-party manipulation.

Proof of Importance (Poi) in Blockchain


 What is Proof of Importance (PoI)?
o Consensus algorithms are a decision-making process for a group, where individuals
of the group construct and support the decision that works best for the rest of them.
It is a win for the network as the consensus not only agrees to the majority votes
but to the one which is most beneficial to all participants in the network. Ever since
the inception of Blockchain and the Proof of Work (PoW) consensus mechanisms
to authenticate a new node or any transaction happening over the blockchain, there
have been many new consensus mechanisms that have been introduced and Proof
of Importance (PoI) is one such mechanism based on Byzantine Fault Tolerance.
o Proof-of-Importance (PoI) is a blockchain consensus mechanism introduced by
NEM and this concept is a further build-up on the Proof of Stake (PoS) algorithm.

 How does Proof of Importance (PoI) Work?


o Proof of Importance is the mechanism that is used to determine which nodes in the
network are eligible to add a block to the blockchain, by a process that is known as
‘harvesting’ or ‘vesting’ by NEM which stands for New Economy Movement
which is a blockchain.
o In exchange for harvesting a block, nodes are able to collect the transaction fees
within that block which the validator gets as a reward.
o In order to be even eligible for the calculation or ‘harvest’, the NEM protocol
requires that an account holder have at least 10,000 vested XEM (XEM is the

7
Blockchain Unit-3 Sem-7

cryptocurrency that powers the NEM blockchain which is rapidly gaining


popularity recently) in its account and the accounts having high score will have a
higher chance of getting selected to harvest a block.
o NEM identifies an account’s overall support of the network or score by considering
the following three important characteristics: –

o Vesting: Also known as ‘Harvesting’ is the most integral part of this consensus
mechanism. First, any node should have at least 10,000 XEM coins before they can
start harvesting or vesting. The consensus mechanism counts the number of coins
present in your account for a set number of days (mostly 30 days) for calculating
the Proof of Importance score of the node. Therefore, the higher the number of
XEM coins higher will be the node’s score.

o Transaction partnership: Proof of importance rewards the users who make


transactions with other NEM accounts on the network and will acknowledge both
accounts as partners. The network theory calculation looks at transaction behaviour
to assign each node an importance score and stop the user from having any pseudo
partnership.

o Number and size of transactions: Each transaction above a minimum size has an
impact on the Importance score and increases the chances of harvesting a block to
collect rewards. Larger and more frequent transactions will improve the PoI score
on the NEM network and the score is based on the transaction node makes in the
period of 30 days.

Proof of Elapsed Time (PoET) in Blockchain


o Proof of Elapsed Time (PoET) is a network consensus algorithm that prevents high
resource utilization and energy consumption. It implements a fair lottery system to
keep the process more efficient.

 What is Proof of Elapsed Time (PoET)?


o Blockchain technology is a distributed ledger used to record any transactions that
happen over the network and since Bitcoin’s inception and the introduction of
the Proof of Work (PoW) consensus model as the mechanism for a blockchain
network’s legitimacy. After numerous other consensus mechanisms have been
experimented with and introduced, the Proof of Elapsed Time (PoET) concept is
one such mechanism which was invented in early 2016 by Intel Corporation and is
one of the fairest blockchain consensus algorithms that enables permissioned
blockchain networks to determine who creates the next block.
o Intel in collaboration with other organizations such as the Linux Project and IBM
sponsored the Hyperledger Sawtooth project, this open-source project uses the
PoET consensus mechanism. Hyperledger Sawtooth is a distributed ledger that is
both scalable and adaptable for many uses at the enterprise like supply chain and
logistics. This mechanism is based on Byzantine Fault Tolerance and aims to
reduce the energy consumption associated with proof of work’s mining process.

8
Blockchain Unit-3 Sem-7

 3 Factors Need to Be in Favor for PoEt to Work:


o Ensure that the node gets the random waiting time instead.
o Check if the nodes are not choosing the shortest wait time on purpose.
o Verify if a node has completed the given waiting time or not.

 How Does PoET Work?


o The PoET mechanism replaces the need for mining intensive rights required in
Proof of Work with a randomized timer system. The PoET consensus mechanism
distributes the chances of winning across the largest possible number of network
participants and every node is likely to be selected by a fair lottery system.
o Every node in the blockchain network will generate a random wait time and then
sleeps for that specified duration.
o Now the first one to wake up, that is, the first node in the network to have its timer
expire after completing its specified waiting time wins the block round and it now
becomes the block leader which produces the new block and signs the new block
with its private key address before adding it to the blockchain network.
o After this necessary information is broadcasted to the whole peer network and the
same process then repeats for the discovery of the next block.
o In this consensus mechanism the problem is” how to determine the leader of a
round of consensus” and whoever solves the computationally intensive
cryptographic puzzle of each block round is selected as the leader for the round. For
the node to participate in consensus, it downloads the trusted code which requires
code attestation by Intel Software Guard Extension (SGX). SGX functions as a
Trusted Execution Environment (TEE), which allows selecting, trusted code to run
independently of the application that it runs in.
o The PoET consensus mechanism is divided into 2 phases:

o 1. Selection Process: This process involves the following activities:


o Every node in the network will share its certificate by Intel Software Guard
Extension (SGX) which ensures the validity of the node to generate a new block in
the network. After this, the node is eligible to get a timer object.
o The numbers are assigned to each node as a timer object by Intel’s RAND i.e.
random number generator. RAND generates difficult-to-detect random numbers.
o The time object given to each participating node activates.

9
Blockchain Unit-3 Sem-7

o 2. Generation Process: This process involves the following activities:


o After the timer object expires, and the node wakes up then the node is eligible to
forge a new block to the network.
o The active node generates the hash of its block of transactions and submits it for
acceptance.
o The update gets flooded to the network.
o Therefore, this ends the iteration of mining a new block in a permissioned
blockchain network using the PoET consensus algorithm.

 Benefits of PoET:
o Less power consumption: PoET doesn’t require much electricity consumption,
and the nodes can “go to sleep” and switch to other tasks for the specified time
thereby making the network time and energy efficient.
o Less resource intensive: PoET also provides a great solution to the “Random
Leader Selection Problem” without being resource-intensive or requiring complex
mechanisms. It is easily scalable as it allows the network to reach consensus more
quickly thus allowing faster processing of transactions.
o High transaction rate: PoET can go up to a million transactions per second.
o Equal opportunity: PoET allows for the same opportunity for the network
participants with time object and activation.
o Permissioned: Since it is a permissioned blockchain network, the process of
selecting validators ensures network security against cyberattacks.
o Limitations of PoET:
o Specialized hardware required: Even though it’s cheap there is a requirement for
specialized hardware for incorporating the Proof of Elapsed Time consensus
algorithm as a result, it cannot be used by most people.
o Compatibility issues: PoET highly depends on tools by Intel technology which
might raise compatibility issues with the other tools.

Proof of Burn (PoB): With PoB, instead of investing in expensive hardware


equipment, validators ‘burn’ coins by sending them to an address from where they
are irretrievable. By committing the coins to an unreachable address, validators
earn the privilege to mine on the system based on a random selection process.
Thus, burning coins here means that validators have a long-term commitment in
exchange for their short-term loss. Depending on how the PoB is implemented,
miners may burn the native currency of the Blockchain application or the currency
of an alternative chain, such as bitcoin.

10
Blockchain Unit-3 Sem-7

 The more coins they burn, the better their chances of being selected to mine the
next block. While PoB is an interesting alternative to PoW, the protocol still
wastes resources needlessly. And it is also questioned that mining power simply
goes to those who are willing to burn more money.

Proof of Capacity: In the Proof of Capacity consensus, validators are


supposed to invest their hard drive space instead of investing in expensive
hardware or burning coins. The harder drive space validators have, the better their
chances of getting selected for mining the next block and earning the block
reward.

o There also exist other consensus algorithms like Proof of Activity, Proof of Weight,
Proof of Importance, Leased Proof of Stake, etc. It is therefore important to wisely
choose one as per the business network requirement because Blockchain networks
cannot function properly without the consensus algorithms to verify each and every
transaction that is being committed.

S.No. Proof of Work (PoW) Proof of Stake (PoS)

The probability of validating a new block


The probability of mining a block is
is determined by how large of a stake a
1. determined by how much
person holds (how many coins they
computational work is done by miner.
possess).

A reward is given to first miner to The validator does not receive a block
2. solve cryptographic puzzle of each reward instead they collect network fee
block. as their reward.

To add each block to chain, miners


There is no competition as block creator
must compete to solve difficult
3. is. chosen by an algorithm based on user
puzzles using their computer process
stake.
power

Hackers would need to have 51% of Hackers would need to own 51% of
4. computation power to add malicious all cryptocurrency on network, which is
block. practically impossible.

Proof of work systems are less energy Proof of Stake systems are much more
5. efficient and are less costly but more cost and energy efficient than POW
proven. systems but less proven.

Specialized equipment to optimize Standard server grade unit is more than


6.
processing power. enough.

11
Blockchain Unit-3 Sem-7

Initial investment to buy stake and build


7. Initial investment to buy hardware.
reputation.

Bitcoin is most well-known crypto Some of cryptocurrencies that use


with a Proof-of-Work consensus different variants of proof-of-stake
8. building algorithm which uses most consensus are: EOS (EOS), Tezos
well-known proof-of-work function is (XTZ), Cardano (ADA), Cosmos
called SHA256. (ATOM), Lisk (LSK).

The types of Blockchain Nodes are:

1. Full Nodes

 As they maintain a complete copy of the Blockchain ledger, Full Nodes are the most
essential type of node in the Blockchain network. These nodes are able to
independently verify the entire Blockchain history since they download and store
copies of every transaction and block that occurs on the network. The stability of the
Blockchain network depends on Full Nodes, which constitute the foundation of the
network.
 As part of a peer-to-peer network, Full Nodes communicate with other nodes to
maintain the accuracy and current state of the Blockchain. They validate
transactions and blocks by checking for inconsistencies, such as double-spending or
invalid signatures, before adding them to the Blockchain. Blockchain developers
and organizations that require a high level of security and control over their
Blockchain transactions often run Full Nodes. These nodes are in charge of
validating all blocks and transactions.

2. Light Nodes

 Light Nodes are a more lightweight variation of Full Nodes, sometimes referred to
as SPV (Simplified Payment Verification) nodes. They are designed to operate on
mobile devices such as smartphones and tablets with limited storage and processing
power. Light Nodes do not download the entire Blockchain but rather a small
portion of it that contains information relevant to their transactions.
 To obtain the information, Light Nodes are required to verify their transactions by
communicating with a number of Full Nodes in the network. Light Nodes are faster
and more efficient than Full Nodes, however, because they rely on Full Nodes for
validation, they are also less secure.
 This type of blockchain node is designed for fast, straightforward processing of
transactions and daily activities, and is second in usage popularity only to archival
nodes.
 Light nodes are equipped with only the essential data and rely on Full Nodes to
function, as they do not download the full blockchain.

12
Blockchain Unit-3 Sem-7

3. Miner Nodes

 Miner Nodes are responsible for validating transactions and generating new blocks
on the Blockchain. These nodes execute complex calculations to solve mathematical
problems, allowing them to create new blocks and receive rewards in the form of
cryptocurrency. Miner Nodes require specialized hardware and software to perform
mining calculations. They are often run by major mining pools or individuals with
the financial ability to invest in the necessary equipment. Miner Nodes are critical
components of the Blockchain network, ensuring that new transactions are
processed and added to the Blockchain in a timely and secure manner.

What is Byzantine General’s Problem?

 In 1982, The Byzantine General’s Problem was invented by Leslie Lamport, Robert
Shostak, and Marshall Pease. Byzantine Generals Problem is an impossibility result
which means that the solution to this problem has not been found yet as well as
helps us to understand the importance of blockchain. It is basically a 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 in this classic problem called
the Byzantine General’s problem, with each division led by a general.
 The generals connect via messenger in order to agree to a joint plan of action in
which all battalions coordinate and attack from all sides in order to achieve success.
 It is probable that traitors will try to sabotage (destroy) their plan by intercepting or
changing the messages.
 As a result, the purpose of this challenge is for all of the faithful commanders to
reach an agreement without the imposters tampering with their plans.

Byzantine Fault Tolerance (BFT)

 The Byzantine Fault Tolerance was developed as inspiration in order to address the
Byzantine General’s Problem. The Byzantine General’s Problem, a logical thought
experiment where multiple generals must attack a city, is where the idea for BFT
originated.
 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.
 In order to create a decentralized network, the BFT is essential.
 The consensus method determines the precise network structure. For instance, BFT
has a leader as well as peers who can and cannot validate.
 In order to maintain the sequence of the Blockchain SC transactions and the
consistency of the global state through local transaction replay, consensus messages
must pass between the relevant peers.

13
Blockchain Unit-3 Sem-7

 More inventive approaches to designing BFT systems will be found and put into
practice as more individuals and companies investigate distributed and decentralized
systems. Systems that use BFT are also employed in sectors outside of blockchains,
such as nuclear power, space exploration, and aviation.

 Byzantine General’s Problem in a Distributed System


 In order to address this issue, honest nodes (such as computers or other physical
devices) must be able to establish an agreement in the presence of dishonest nodes.
 In the Byzantine agreement issue, an arbitrary processor initializes a single value
that must be agreed upon, and all nonfaulty processes must agree on that value.
Every processor has its own beginning value in the consensus issue, and all
nonfaulty processors must agree on a single common value.
 The Byzantine army’s position can be seen in computer networks.
 The divisions can be viewed as computer nodes in the network, and the commanders
as programs running a ledger that records transactions and events in the order that
they occur. The ledgers are the same for all systems, and if any of them is changed,
the other ledgers are updated as well if the changes are shown to be true, so all
distributed ledgers should be in agreement.

practical Byzantine Fault Tolerance(pBFT)

 Practical Byzantine Fault Tolerance is a consensus algorithm introduced in the late


90s by Barbara Liskov and Miguel Castro. pBFT was designed to work efficiently
in asynchronous (no upper bound on when the response to the request will be
received) systems. It is optimized for low overhead time. Its goal was to solve many
problems associated with already available Byzantine Fault Tolerance solutions.
Application areas include distributed computing and blockchain.

14
Blockchain Unit-3 Sem-7

 How pBFT works?

pBFT tries to provide a practical Byzantine state machine replication that can work
even when malicious nodes are operating in the system.
Nodes in a pBFT enabled distributed system are sequentially ordered with one node
being the primary (or the leader node) and others referred to as secondary (or the
backup nodes). Note here that any eligible node in the system can become the
primary by transitioning from secondary to primary (typically, in the case of a
primary node failure). The goal is that all honest nodes help in reaching a consensus
regarding the state of the system using the majority rule.
A practical Byzantine Fault Tolerant system can function on the condition that the
maximum number of malicious nodes must not be greater than or equal to one-third
of all the nodes in the system. As the number of nodes increase, the system becomes
more secure.

What is the Raft protocol

 Reliable, Replicated, Redundant, And Fault-tolerant.


 Raft is a consensus algorithm that is designed to be easy to understand. It’s equivalent
to Paxos in fault-tolerance and performance. The difference is that it’s decomposed
into relatively independent subproblems, and it cleanly addresses all major pieces
needed for practical systems. We hope Raft will make consensus available to a wider
audience, and that this wider audience will be able to develop a variety of higher
quality consensus-based systems than are available today.

15
Blockchain Unit-3 Sem-7

 Raft consensus algorithm explained


 To begin with, Raft states that each node in a replicated state machine (server cluster)
can stay in any of the three states, namely, leader, candidate, follower. The image
below will provide the necessary visual aid.

 Under normal conditions, a node can stay in any one of the above three states. Only a
leader can interact with the client; any request to the follower node is redirected to the
leader node. A candidate can ask for votes to become the leader. A follower only
responds to candidate(s) or the leader. To maintain these server status(es), the Raft
algorithm divides time into small terms of arbitrary length. Each term is identified by
a monotonically increasing number, called term number.

 Term number
This term number is maintained by every node and is passed while communications
between nodes. Every term starts with an election to determine the new leader. The
candidates ask for votes from other server nodes(followers) to gather majority. If the
majority is gathered, the candidate becomes the leader for the current term. If no
majority is established, the situation is called a split vote and the term ends with no
leader. Hence, a term can have at most one leader.

 Purpose of maintaining term number


Following tasks are executed by observing the term number of each node:

 Servers update their term number if their term number is less than the term numbers
of other servers in the cluster. This means that when a new term starts, the term
numbers are tallied with the leader or the candidate and are updated to match with the
latest one (Leader’s)Candidate or Leader demotes to the Follower state if their term
number is out of date (less than others). If at any point of time, any other server has a
higher term number, it can become the Leader immediately.
 As we said earlier that the term number of the servers are also communicated, if a
request is achieved with a stale term number, the said request is rejected. This
basically means that a server node will not accept requests from server with lower
term number

16
Blockchain Unit-3 Sem-7

 Raft algorithm uses two types of Remote Procedure Calls (RPCs) to carry out
the functions:

1. Request Votes RPC is sent by the Candidate nodes to gather votes during an election
2. Append Entries is used by the Leader node for replicating the log entries and also as
a heartbeat mechanism to check if a server is still up. If heartbeat is responded back
to, the server is up else, the server is down. Be noted that the heartbeats do not contain
any log entries.

 What are its advantages/Features

 The Raft protocol is designed to be easily understandable considering that the most
popular way to achieve consensus on distributed systems was the Paxos algorithm,
which was very hard to understand and implement. Anyone with basic knowledge and
common sense can understand major parts of the protocol and the research paper
published by Diego Ongaro and John Ousterhout
 It is comparatively easy to implement than other alternatives, primarily the Paxos,
because of a more targeted use case segment, assumptions about the distributed
system. Many open-source implementations of the Raft are available on the internet.
Some are in Go, C++, Java
 The Raft protocol has been decomposed into smaller subproblems which can be
tackled relatively independently for better understanding, implementation, debugging,
optimizing performance for a more specific use case
 The distributed system following the Raft consensus protocol will remain operational
even when minority of the servers fail. For example, if we have a 5 server node
cluster, if 2 nodes fail, the system can still operate.
 The leader election mechanism employed in the Raft is so designed that one node will
always gain the majority of votes within a maximum of 2 terms.
 The Raft employs RPC (remote procedure calls) to request votes and sync up the
cluster (using Append Entries). So, the load of the calls does not fall on the leader
node in the cluster.
 Raft was designed recently, so it employs modern concepts which were not yet
understood at the time of the formulation of the Paxos and similar protocols. Any
node in the cluster can become the leader. So, it has a certain degree of fairness.

 Limitations: -

 Raft is strictly single Leader protocol. Too much traffic can choke the system. Some
variants of Paxos algorithm exist that address this bottleneck.
 There are a lot of assumptions considered to be acting, like non-occurrence of
Byzantine failures, which sort of reduces the real life applicability.
 Raft is a more specialized approach towards a subset of problems which arise in
achieving consensus.

17
Blockchain Unit-3 Sem-7

51% Attack: -

 A blockchain is a distributed ledger—essentially a database—those records


transactions and information about them. The blockchain's network reaches a
majority consensus about transactions through a validation process. The blocks
where the data is stored are sealed. The blocks are linked together via cryptographic
techniques where previous block information is recorded in each block. This makes
the blocks nearly impossible to alter once they are confirmed enough times.
 The 51% attack is an attack on the blockchain, where a group controls more than
50% of the hashing power—the computing that solves the cryptographic puzzle—of
the network. This group then introduces an altered blockchain to the network at a
very specific point in the blockchain, which is theoretically accepted by the network
because the attackers would own most of it.
 Changing historical blocks—transactions locked in before the start of the attack—
would be extremely difficult even in the event of a 51% attack. The further back the
transactions are, the more difficult it is to change them. It would be impossible to
change transactions before a checkpoint, where transactions become permanent in
Bitcoin's blockchain.

 Attacks Are Prohibitively Expensive

 A 51% attack is a very difficult and challenging task on a blockchain network with a
large participation rate. In most cases, the group of attackers would need to be able to
control the necessary 51% and have created an alternate blockchain that can be
inserted at exactly the right moment. Then, they would need to out-hash the main
network. The cost of doing this is one of the most significant factors that prevent a
51% attack.
 For example, one of the most advanced application-specific integrated circuit (ASIC)
miners is the WhatsMiner M63S. It costs more than $10,000 (new) and has
a hash rate of 406 tera hashes per second (TH/s).
 A single or smaller group of miners would not be able to alter and mine the Bitcoin
blockchain with only a few of these machines. It would take thousands of these
ASICs to get ahead of the Bitcoin network. Smaller networks could be out-hashed
using these mining rigs, but the benefits of doing so wouldn't outweigh the costs of
funding the attack and setting it up.

18
Blockchain Unit-3 Sem-7

FORKS IN BLOCKCHAIN:

 In simple terms, Forks in blockchain means copying the code and modifying it to
create a new software or product. In open-source projects Forks are very common and
used widely. So, cryptocurrencies like Ethereum and Bitcoin are decentralized and
open software so that anyone can contribute.
 As they are open-sources they rely on their communities to make the software more
secure and reliable. Also, open source with the help of fork can make user interface
more interactive and look good, helping in gaining more users worldwide. In open
source the code is visible to everyone, anyone can modify, edit, access there is no
copyright claims for such actions.
 For example: Tor browser is an open-source software, Linux one of the most widely
use Operating system is an open-source system, in similar way Bitcoin and Ethereum
protocol are also open sourced.

 Let’s us see the different types of FORKS one by one:

19
Blockchain Unit-3 Sem-7

 TYPES OF FORKS:
1. CODEBASE FORK:

 In codebase blockchain fork you can copy the entire code of a particular software.
 Let us take BITCOIN as an example, so suppose you copied the whole blockchain
code and modified it according to your need, say that you decreased the block
creation time, made some crucial changes and created a faster software than
BITCOIN and publish / launch it has a new whole software named against you, by
completing the whole white paper work process. So in these way a new
BLOCKCHAIN will be created from an empty blank ledger. It’s a fact that many of
these ALT COINS which are now running on the blockchain are been made in this
way only by using the codebase fork i.e. they have made little up and down changes
in the code of BITCOIN and created their whole new ALT COIN.
2. LIVE BLOCKCHAIN FORK
 Live Blockchain fork means a running blockchain is been divided further into two
parts or two ways. So, in live blockchain at a specific page the software is same and
from that specific point the chain is divided into two parts. So, in context to this fork
the Live Blockchain Fork can occur because of two reasons:
 ACCIDENTAL FORK / TEMPORARY FORK:

 When multiple miners mine a new block at nearly the same time, the entire network
may not agree on the choice of the new block. Some can accept the block mined by
one party, leading to a different chain of blocks from that point onward while others
can agree on the other alternatives (of blocks) available. Such a situation arises
because it takes some finite time for the information to propagate in the entire
blockchain network and hence conflicted opinions can exist regarding the
chronological order of events. In this fork, two or more blocks have the same block
height.
 Temporary forks resolve themselves eventually when one of the chains dies out (gets
orphaned) because majority of the full nodes choose the other chain to add new
blocks to and sync with.

 INTENTIONAL FORK:

 In intentional fork the rules of the blockchain are been changed, knowing the code of
the software and by modifying it intentionally. This gives rise to two types of forks
which can occur based on the backwards-compatibility of the blockchain protocol
and the time instant at which a new block is mined. So Intentional fork can be of two
types:

 SOFT FORK: When the blockchain protocol is altered in a backwards-compatible


way. In soft fork you tend to add new rules such that they do not clash with the old
rules. That means there is no connection between the old rules and new rules. Rules in
soft fork are tightened. When there is a change in the software that runs on the nodes
(better called as ‘full nodes’) to function as a network participant, the change is such
that the new blocks mined on the basis of new rules (in the Blockchain protocol) are
also considered valid by the old version of the software.

20
Blockchain Unit-3 Sem-7

 This feature is also called as backwards-compatibility.


 Example (SOFT FORK): The Bitcoin network’s SegWit update added a new class of
addresses (Bech32). However, this didn’t invalidate the existing P2SH addresses. A
full node with a P2SH type address could do a valid transaction with a node of
Bech32 type address.

 HARD FORK: When the blockchain protocol is altered in a non-backwards-


compatible way. Hard fork is opposite of soft fork, here the rules are loosened. When
there is a change in the software that runs on the full nodes to function as a network
participant, the change is such that the new blocks mined on the basis of new rules (in
the Blockchain protocol) are not considered valid by the old version of the software.
When hard forks occur, new currency come into existence (with valid original
currency) like in the case of Ethereum (original: Ethereum, new: Ethereum Classic)
and Bitcoin (original: Bitcoin, new: Bitcoin cash).
 Equivalent quantity of currency is distributed to the full nodes who choose to upgrade
their software so that no material loss occurs. Such hard forks are often contentious
(generating conflicts in the community). The final decision to join a particular chain
rest with the full node. If chosen to join the new chain, the software has to be
upgraded to make newer transactions valid while the nodes who do not choose to
upgrade their software continue working the same.
 Example (HARD FORK): The new Casper update in the Ethereum Blockchain in
which the consensus protocol will change from a type of Proof of Work (PoW) to a
type of Proof of Stake (PoS). The nodes which install the Casper update will use the
new consensus protocol. Full nodes that do not choose to install the Casper update
will become incompatible with the full nodes that do.

 Reasons for the occurrence of a blockchain fork:

 Add new functionality: The Blockchain code is upgraded regularly. Since most
public blockchains are open source, it is developed by people from around the world.
The improvements, issues are created, resolved and new versions are released when
the time is suitable.

 Fix security issues: Blockchain (and cryptocurrency on top of it) is a relatively new
technology as compared to the traditional currency (notes, coins, cheque), research is
still underway to fully understand it. So, versions are bumped and updates are
released to fix the security issues that arise in the way.

 Reverse transactions: The community can actually void all the transaction of a
specific period if they are found to be breached and malicious.

21

You might also like