Unit-III
Essentials of Blockchain
By: C. D. Suthar (GES-II)
Lecturer, IT,
Government Polytechnic,
Himatnagar
Consensus mechanisms in Blockchain
Source: https://www.investopedia.com/terms/c/consensus-mechanism-cryptocurrency.asp
Consensus mechanisms in Blockchain
• 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.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
• A consensus algorithm is a process through which all the peers of the
Blockchain network reach a common agreement about the present
state of the distributed ledger.
• consensus algorithms achieve reliability in the Blockchain network
and establish trust between unknown peers in a distributed
computing environment.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-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.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
Various consensus algorithms/mechanisms:
1. Proof of Work (PoW):
• This consensus algorithm is used to select a miner for the next block generation.
• Bitcoin uses this PoW consensus algorithm.
• The central idea behind this algorithm is to solve a complex mathematical puzzle
and easily give out a solution.
• This mathematical puzzle requires a lot of computational power and thus, the
node who solves the puzzle as soon as possible gets to mine the next block.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
• Proof-of-Work (PoW) in the blockchain is a consensus mechanism
that allows miners to add a new block to the network based on
calculations made to find the perfect hash. Network participants
verify the transactions added by the new block.
• The work(ers) Proof-of-work blockchains are supported through a
network of decentralized computers called nodes.
• These nodes are also called miners because they spend computing
power and resources in return for the network’s underlying
cryptocurrency.
• Miners win the reward when they guess a hash that falls below the
threshold provided by the network. Once a miner finds the valid block
hash, it broadcasts this information to other miners who can quickly
validate and add the new block to their blockchain copies.
• The successful miner receives the block rewards and associated
transaction fees.
Advantages of Proof-of-Work
• A hard-to-find solution. Still, easy verification.
• PoW does not need initial stakes of coins before mining. One can start with
0 coins and it will only be positive.
• Ease of implementation compared to other blockchain consensus
mechanisms.
• It is fault tolerant. It means that the failure of one component will not shut
down the entire blockchain network.
• Give miners the opportunity to earn by adding a block.
• PoW is the oldest, most trusted, and most popular consensus protocol
Limitations of Proof-of-Work
• A lot of energy is wasted because only one miner can finally add their
block.
• It requires a lot of computing power and, therefore, massive
consumption of resources and energy.
• 51% risk of network attack. A controlling person can get 51% to
control the network.
• Spread environmental hazards with attachment machines.
• Pow is a time and energy wipe-out process.
• It required a lot of hardware costs.
Consensus mechanisms
2. Proof of Stake (PoS):
• This is the most common alternative to PoW.
• Ethereum has shifted from PoW to PoS consensus.
• In this type of consensus algorithm, instead of investing in
expensive hardware to solve a complex puzzle, validators
invest in the coins of the system by locking up some of their
coins as stakes.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
• Validators will validate blocks by placing a bet on them if they
discover a block that they think can be added to the chain.
• Based on the actual blocks added in the Blockchain, all the validators
get a reward proportionate to their bets, and their stake increase
accordingly.
• In the end, a validator is chosen to generate a new block based on its
economic stake in the network.
• Thus, PoS encourages validators through an incentive mechanism to
reach to an agreement.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
3. Delegated Proof Of Stake (DPoS):
• This type of consensus mechanism depends on the
basis of the delegation of votes.
• The users delegate their votes to other users.
• Whichever user then mines the block will distribute
the rewards to the users who delegated to that
particular vote.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
4. Proof of Burn (PoB):
• 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.
• The more coins they burn, the better their chances of being selected
to mine the next block.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
5. Proof of Capacity:
• Validators are supposed to invest their hard drive space instead
of investing in expensive hardware or burning coins.
• The more hard drive space validators have, the better their
chances of getting selected for mining the next block and earning
the block reward.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Consensus mechanisms
6. Proof of Elapsed Time:
• Every validator on the network gets a fair chance to create their own
block.
• All the nodes do so by waiting for a random amount of time, adding
proof of their wait in the block.
• The winner is the validator which has the least timer value in the
proof part.
• There are additional checks in the algorithm to stop nodes from
always winning the election, and stop nodes from generating the
lowest timer value.
Source: https://www.geeksforgeeks.org/consensus-algorithms-in-blockchain/
Difference: PoS vs PoW
Proof of Stake Proof of Work
Block creators are called validators Block creators are called miners
Participants must own coins or tokens to Participants must buy equipment and
become validators energy to become a miner
Energy efficient Not energy efficient
Robust security due to expensive upfront
Security through community control
requirement
Validators receive transaction fees as
Miners receive block rewards and fees
rewards
Source: https://www.investopedia.com/terms/p/proof-stake-pos.asp
Alternative of proof of work
Proof-Of Stake
• In PoW, miners exchange energy for cryptocurrency, which
causes PoW mining to use as much energy as some small
countries.
• Ethereum's transition from PoW to PoS reduced the
blockchain's energy consumption by 99.84%.
Proof of Stake
• In PoS, there doesn't need to be as much computational
work done.
• The owners offer their coins as collateral—staking—for the
chance to validate blocks and earn rewards.
• Ex. Ethereum
• Working of PoS, discussed earlier.
Proof of Stake
Features of PoS
• Fixed coins in existence
• Transaction fee as reward to minters/forgers
• Impracticality of the 51% attack
Proof of Stake
Advantages of PoS:
• Energy-efficient
• Decentralization
• Security: A person attempting to attack a network will have to own
51% of the stakes(pretty expensive)
Disadvantages of PoS:
• Large stake validators
• New technology
Block rewards
• A block reward is an incentive that miners get when they
approve a transaction. It is a cryptocurrency that users
usually get when they ‘mine’ a block.
• Cryptocurrency miners receive an amount in cryptocurrency
(called a block reward) as an incentive to verify transactions
and validate blocks.
Block rewards
Block rewards
Importance of Block reward
• Enhancement of decentralization: Users can use the currency if only
the cryptocurrency is circulated and this is possible by block rewards.
Therefore, its generation and control allow the creation of a
decentralized economic system.
• Using the new coins: Block Rewards are also used if the system wants
to issue new currency in the market.
Block rewards
Advantages
• To secure the network
• Financial Benefit
• More investments
Disadvantages
• Varying Rewards: The incentives vary from project to project.
• Increase in costs: For mining special hardware is required.
Block rewards
• Suppose a user wants to make a transaction.
• A block for that transaction is created.
• The block is sent to all the users.
• The users validate the transaction.
• Upon successful transaction, the users involved in the decision-
making get incentives.
• Protocols help in the distribution of incentives.
• Upon successful verification, the database is updated and the
transaction is complete.
Mining difficulty
• Mining difficulty is a measure of how difficult it is to mine a block in a
proof-of-work blockchain.
• A high cryptocurrency difficulty means it takes additional computing
power to verify transactions entered on a blockchain—a process
called mining.
Mining difficulty
• This competitive process means that those who have faster systems
stand a better chance of generating a hash that meets the difficulty
target.
• Difficulty adjustments were introduced to try to keep mining fair and
maintain a steady pace.
• In Bitcoin, The difficulty is adjusted every 2016 blocks (every 2 weeks
approximately) so that the average time between each block remains
10 minutes.
Source: https://www.bitpanda.com/academy/en/lessons/what-does-mining-difficulty-mean/
Mining difficulty
• Mining difficulty measures how difficult it is to solve the complex
cryptographic puzzles used in the mining process.
• The difficulty of mining new units increases or decreases over time,
depending on the number of miners in the network
• Increases in difficulty are necessary in order to maintain the target
block time.
Confirmation and finality
• A confirmation represents the acceptance of a new block
(containing several transactions) by the blockchain network.
• Once a miner has successfully added a new block to the
blockchain, one 'confirmation' has occurred.
Source: https://www.bitcoin.com/get-started/what-is-a-confirmation/
Finality in Blockchain
• Finality in blockchain means reaching a point where a
transaction is permanent and irreversible.
• Once a transaction achieves finality, it’s locked in and cannot
be altered or undone.
• This is crucial in maintaining trust in blockchain systems, as it
guarantees that transactions are secure and records remain
immutable.
Source: https://www.ledger.com/academy/glossary/finality/
Finality in Blockchain
• Different blockchains achieve this through different consensus
mechanisms, such as proof-of-work (PoW) and proof-of-stake (PoS).
Types of Block Finality
• Probabilistic finality : Transactions or blocks become final as more
and more blocks or transactions are confirmed. For example, a Bitcoin
transaction becomes practically immutable and irreversible after 6
confirmations (60 minutes).
Source: https://www.ledger.com/academy/glossary/finality/
Finality in Blockchain
• Deterministic/ Instant finality: when a transaction achieves near-
instant finality, i.e., the transaction becomes irreversible immediately
after it is confirmed and recorded on the blockchain.
• Economic Finality : A transaction is considered to have achieved
economic finality when reversing it becomes economically unviable. If
Validators on Proof-of-Stake approve a fake or malicious transaction,
they risk losing their stake, rendering such transactions economically
unviable.
Source: https://www.bnbchain.org/en/blog/what-is-finality-in-blockchain?ref=bnbchain.ghost.io
Forks in Blockchain
• Many times, the nodes in the network can’t come in a unanimous
consensus regarding the future state of the blockchain.
• This event leads to forks, meaning that point in which the ideal
‘single’ chain of blocks is split into two or more chains which are all
valid.
Source: https://www.geeksforgeeks.org/blockchain-forks/
• Forks in blockchain means copying the code and modifying it to
create a new software or product.
Source: https://www.geeksforgeeks.org/blockchain-forks/
Source: https://www.geeksforgeeks.org/blockchain-forks/
• Types of Forks
• CODEBASE FORK: In codebase blockchain fork you can copy
the entire code of a particular software.
• LIVE BLOCKCHAIN FORK: Live Blockchain fork means a
running blockchain is been divided further into two parts or two
ways.
• 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.
Source: https://www.geeksforgeeks.org/blockchain-forks/
• 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.
• 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.
Source: https://www.geeksforgeeks.org/blockchain-forks/
Source: https://www.geeksforgeeks.org/blockchain-forks/
Sybill Attacks
• Sybil Attack is a type of attack seen in peer-to-peer networks in
which a node in the network operates multiple identities actively
at the same time and undermines the authority/power in
reputation systems.
• The main aim of this attack is to gain the majority of influence in
the network to carry out illegal actions in the system.
Source: https://www.geeksforgeeks.org/sybil-attack/
Sybill Attacks
• A single entity(a computer) has the capability to create
and operate multiple identities(user accounts, IP
address based accounts).
• To outside observers, these multiple fake identities
appear to be real unique identities.
Source: https://www.geeksforgeeks.org/sybil-attack/
Sybill Attacks
Examples:
• The 51% attack in Blockchain networks.
• Multiple fake reviews on Amazon and other e-commerce
platforms by only one identity(such mass computing power is
available(unethically) for hire from countries like Bangladesh.
Source: https://www.geeksforgeeks.org/sybil-attack/
Sybill Attacks
Source: https://www.geeksforgeeks.org/sybil-attack/
Sybill Attacks
The model used in the Sybil Attack
• Entities = c(correct) entities + f(faulty) entities
correct – entities that follow the protocols and rules setup in the network
honestly(whose honesty is verified).
faulty – entities whose behavior are arbitrary and can’t be predicted. They
don’t honestly follow the protocols and rules in the network.
• A communication cloud: A very general cloud through which messages
between different entities travel.
• pipe: to connect an entity with the communication cloud
Source: https://www.geeksforgeeks.org/sybil-attack/
Sybill Attacks
Ways to prevent sybil attack
• Cost to create an identity
• Validation of identities before joining the network
Source: https://www.geeksforgeeks.org/sybil-attack/
51% attack
Source: https://www.investopedia.com/terms/1/51-attack.asp
51% attack
• A 51% attack is an attack on a cryptocurrency blockchain by a
group of miners who control more than 50% of the
network's mining hash rate.
• Owning 51% of the nodes on the network theoretically gives
the controlling parties the power to alter the blockchain.
Source: https://www.investopedia.com/terms/1/51-attack.asp
51% attack
• The attackers would be able to prevent new transactions from gaining
confirmations, allowing them to halt payments between some or all
users.
• They would also be able to reverse non-confirmed transactions that
were completed while they were in control.
• Reversing transactions could allow them to double-spend coins, one
of the issues mechanisms like proof-of-work were created to prevent.
Source: https://www.investopedia.com/terms/1/51-attack.asp
51% attack
• 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.
Source: https://www.investopedia.com/terms/1/51-attack.asp
51% attack
• Changing historical blocks—transactions locked in before the start of
the attack— would be extremely difficult even in the event of a 51%
attack.
• Although a successful attack on Bitcoin or Ethereum is unlikely,
smaller networks are frequent targets for 51% attacks.
Source: https://www.investopedia.com/terms/1/51-attack.asp