Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

CONSENS IN

BLOCKCHAIN

Curs 3
THE IMPORTANCE OF
CONSENSUS
WHAT IS CONSENSUS?
• Consensus, means the method used to come to an
agreement. So, consensus in a blockchain is how the
blockchain nodes “come to agreement” over the blockchain
transactions that will be written to the blockchain ledger.
• A consensus algorithm is a process used to achieve an
agreement, for example, for a transaction on a distributed
network.
THE TRADE-
The trade-off is between transaction security and
OFF
performance in most scenarios. Performance in
blockchains is measured in transaction throughput,
which is also known as transactions per second
(TPS).

For example, the nature of Ethereum is trustless and


is addressed by using the well-known proof-of-work
algorithm. The Ethash consensus algorithm used in
Ethereum makes attacks both prohibitively
expensive and unlikely to occur. However, Ethereum
is slow compared to other database technologies.
TWO TYPES OF CONSENSUS

Voting- Lottery-
based based
VOTING-BASED CONSENSUS

• Voting-based consensus should be chosen based on the following:


• Finality (In a blockchain, this can mean that each node will have the same output for each input)—
Voting-based algorithms are considered beneficial since they provide what is considered low-
latency finality. This is accomplished by a majority of nodes validating a transaction or block.
• Strict rules—Rules are strictly enforced, especially in a PoW consensus method as used in
Ethereum.
LOTTERY-BASED CONSENSUS

• Lottery-based consensus should be chosen based on the following:


• Fairness—The function should distribute leader election across the broadest possible population of
participants.
• Investment—The cost of controlling the leader election process should be proportional to the value
gained from it.
• Verification—It should be relatively simple for all participants to verify that the leader was
legitimately selected.
BYZANTINE GENERALS
PROBLEM
THE BYZANTINE • The Byzantine Generals Problem comes from the
world of traditional computer science.
GENERALS • In this scenario, the involved parties must come to an
PROBLEM agreement for a strategy in order to avoid a complete
failure of operations.
• It could also be that some nodes in the network could
be corrupt and effectively spreading unreliable
requests or information.
COMMON BLOCKCHAIN CONSENSUS METHODS
CONSENSUS METHOD USED IN PRIMARY PROS PRIMARY CONS
Proof of work BTH, ETH, LTC Widely tested Slow and resource intensive
Proof of stake Peercoin, ETH Casper Energy efficient Nothing at stake
Proof of elapsed time Hyperledger Sawtooth Participation cost Specialized hardware
Delegated proof of stake Steemit, EOS, LISK Fast and efficient Witnesses/not centralized
Delegated Byzantine fault
NEO Fast and scalable Root chain control
tolerance
Practical Byzantine fault Efficient, sharding transaction
Hyperledger Fabric Centralized
tolerance finality
Federated Byzantine fault Low cost and high throughput
Ripple, Stellar Centralized
tolerance transactions
Istanbul Byzantine fault Low cost, high throughput
Quorum Centralized
tolerance transactions
Raft Quorum, IPFS, Clusters Faster block times Permissioned only
Directed acrylic graph Iota, Hashgraph Fast, energy efficient finality Oracle requirements
PROOF-OF-WORK CONSENSUS

• Bitcoin was the first practical and successful cryptocurrency platform, and it introduced the proof-
of-work (PoW) consensus method as part of the platform. The proof-of-work protocol involves block
miners solving complex cryptographic puzzles.
• Basically, PoW demonstrates that a participant has done some work and gets a reward for solving a
problem.
• PoW consensus in Bitcoin: a block including relevant parts of the transaction is hashed, and a
random number is added to it so that the resulting hash is below a certain value, which is called the
difficulty level. This difficulty level is what the miners use to gauge the level of compute power and
resources needed to mine Bitcoin, for example, and if it would be profitable.
POW PROS
PoW offers the following pros:
• It is a historically proven consensus method that is widely used for cryptocurrency and is a stable
platform.
• It's secure because of the high cost and low probability of a 51 percent attack. (A 51 percent attack is
where the pool of mining nodes is taken over by a group of miners controlling more than 50 percent
of the network's mining hash rate.) This type of attack is unlikely because of the immense hash
power and the requirement for the number of nodes to control.
POW CONS
• PoW has the following cons:
• Transaction processing is slow compared to other consensus approaches. For example, in Bitcoin it
can take several hours to get a transaction confirmation.
• The 51 percent attack concern is still real, meaning that 51 percent or more than 51 percent of nodes
in the network can be exploited.
• Mining is a time-consuming process because of the work that has to be done to produce blocks.
• Mining is an expensive process from both an economic and environmental perspective. For example,
Bitcoin mining uses so much power it is frequently banned by municipal power companies.
• https://www.youtube.com/watch?v=3EUAcxhuoU4&t=164s
PROOF-OF-STAKE CONSENSUS
• Proof of stake was created in 2011, and the first cryptocurrency to implement it was Peercoin in 2012.
• It was created as a way of avoiding the well-known economic and environmental issues with PoW,
such as intense energy consumption and cost of mining.
• Proof of stake approach: the creator of the next block is determined by a randomized system that is
logically dictated by how much of an investment a user is holding or how long they have been
holding that particular currency. This is a different approach from the “computational power” in
PoW, for example, where the probability of creating a block and receiving the associated rewards is
proportional to a user holding the underlining token or cryptocurrency on the network.
PROOF OF STAKE

• Proof of stake is a deterministic way that is essentially based on wealth, defined as stake. A greater
investment in a cryptocurrency stake equates to greater influence.
• Validator consensus
POS PROS

PoS offers the following pros:


• It is energy efficient compared to proof of work since there is no need to mine coins, making it an
environmentally friendly option to cryptocurrencies such as Bitcoin.
• A PoS system has a lower barrier to entry because no mining rigs are required, and it allows more
users to take part in the staking and forging processes.
POS CONS
PoS has the following cons:
• Someone can monopolize the network. With PoS you know that an increased stake in the network
means increased leverage. This can be a concern if someone forges most of the future blocks and
centralizes the rewards.
• Hackers can steal your wealth but also your stake in the network. When someone loses their
“wallet” with the coins, then they also lose their ability to vote in the blockchain network.
PROOF OF ELAPSED TIME
• Proof of elapsed time (PoET) attempts to address the problem of proof of stake where the random election
of participants proposing blocks can occur and also ensures that every participant has a fair chance to
propose a new block and then participate in the voting process.
• PoET was developed by well-known computer chipmaker Intel to be a production-grade protocol capable
of supporting large network use cases. PoET requires a special CPU instruction set called Intel Software
Guard Extensions (SGX).
• Every participant in the network is assigned a random amount of time to wait, and the first participant to
finish its wait time will have the opportunity to commit the next block to the blockchain.
• Each privately trusted enclave signs the potential requests. The results are then validated by other
members so they can confirm that no other nodes have skipped the waiting time.
POET PROS

PoET offers the following pros:


• Trusted environment that is essentially a plug-and-play consensus on Hyperledger Sawtooth
• Lower energy usage than a PoW consensus that has mining costs such as hardware and energy
• Solves the random leader selection problem without being resource intensive or requiring incentives
POET CONS
PoET has the following cons:
• Lack of portability due to reliance on Intel's proprietary hardware and software requirements
• Higher costs than other blockchain platforms due to the proprietary hardware requirement

* the pros and cons could certainly be acceptable for enterprises that are seeking a targeted solution
and not expecting to go outside of that solution.
DELEGATED PROOF OF STAKE
• DPoS uses a real-time voting system and a reputational system to achieve consensus.
• The DPoS blockchain consensus protocol allows the blockchain token holders to leverage their coin
balances to elect delegates that are called witnesses. These witnesses have the opportunity to stake
blocks of new transactions and then will be authorized to add them to the blockchain network.
• The voting power is determined by how large the token holdings are of the specified blockchain
stakeholders. The stakeholders who have more coins or tokens, for example, will have a greater
impact on the network than those with fewer.
DPOS CONS

DPoS has the following cons:


• A 51 percent attack is clearly possible because fewer people are in charge of ensuring the network
stays secure.
• Centralization of control could occur if the delegates with the most tokens gain strength, which in
turn could allow a “cartel” approach to network control.
DPOS PROS

DPoS offers the following pros:


• DPoS consumes significantly less energy than PoW and is considered to be very energy efficient.
• DPos provides incentives to participate in the network and provides delegates with a way to be voted
out if they misbehave on the network.
• DPos scales greater than PoW and PoS and has faster transaction processing due to less overhead.
• There is a fair reward distribution where it is considered a “democratized” reward schema.
PRACTICAL BYZANTINE FAULT TOLERANCE

• Practical Byzantine fault tolerance (PBFT) has been the most widely used permissioned blockchain
platform protocol.
• PBFT consensus decisions are determined based on the total decisions submitted by all the generals
(nodes).
• PBFT works only on a permissioned blockchain and thus does not allow anonymity like in Ethereum.
PBFT PROS

PBFT offers the following two benefits:


• Rapid transaction finality that does not wait for confirmations to log transactions
• Lower power consumption compared to PoW
PBFT CONS
PBFT has the following disadvantages:
• Initially designed for a limited use case because of the high load of network traffic between nodes
• Can be susceptible to attacks where a single party can create or manipulate a large number of
network nodes, compromising the network
PRACTICAL
BYZANTINE FAULT
TOLERANCE
HOW IT WORKS

• Each ‘general’ maintains an internal state (ongoing specific information or status). When a ‘general’
receives a message, they use the message in conjunction with their internal state to run a
computation or operation.
• This computation in turn tells that individual ‘general’ what to think about the message in question.
Then, after reaching his individual decision about the new message, that ‘general’ shares that
decision with all the other ‘generals’ in the system.
• A consensus decision is determined based on the total decisions submitted by all generals.
REFERENCES

• Joseph Holbrook, “Architecting Enterprise Blockchain Solutions”, Wiley, 2020, ISBN: 978-1-
119-55773-9

You might also like