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

Lecture 07-Consensus Algorithms

Uploaded by

Hira Qayyum
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lecture 07-Consensus Algorithms

Uploaded by

Hira Qayyum
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

Lecture 07 - Consensus Algorithms

Lecture 07
Consensus Algorithms
Lecture 07 - Consensus Algorithms

Do not distribute ...


• These slides are not always prepared by me.
• Most of the content comes from the reference book
– Bitcoin and Cryptocurrency Technologies: A Comprehensive Introduction
– Arvind Narayanan, Joseph Bonneau,
– Edward Felten, Andrew Miller, Steven Goldfeder

• Content on Ethereum 2.0 comes from


https://ethos.dev/beacon-chain/
Lecture 07 - Consensus Algorithms

Proof-of-Stake (PoS)
• The right to mine blocks is given out randomly, but
proportionally, based on ‘stake’
• Stake is defined as some form their share or
involvement in the network
• Often the amount of the currency owned
• Example: If you owned 10% of all of the given coin, you
could expect to win the right to mine 10% of all blocks
Lecture 07 - Consensus Algorithms

Proof-of-Stake (PoS)
• The miners are incentivized to only provide valid
blocks, as they have great incentive to keep the
network functioning correctly
• Their stake or holdings will be worthless if the network
fails to function
Lecture 07 - Consensus Algorithms

Proof-of-Stake (PoS)
• There are many variations on Proof of Stake (often
named something slightly different), and the
mechanisms by which rewards are distributed,
validators are selected, and stake is determined

• Some implementations demand that miners put their


coins into escrow that is lost if they break the rules
Lecture 07 - Consensus Algorithms

PoS Strengths
• No useless mining: there is no unnecessary use of
resources to further power the blockchain
• Little to no hardware advantage
– ASIC mining pools do not have a significant
advantage over a powerful home computer
• Those ‘guarding’ the value of the coins have the most to
lose if the network is compromised
– The incentives to be honest are aligned with
individuals motives

6
Lecture 07 - Consensus Algorithms

PoS Strengths
• The 51% attacks becomes essentially infeasible
– An attacked would need to accumulate 51% of all the coins on
the network to accomplish this
– Currently for Ethereum this is more than $6 Billion, which
would be lost if the attack were successful

• Proof of Stake has the potentially to be magnitudes


more efficient than PoW, making it significantly more
scalable
– Very high transaction throughput is possible with PoS
(transactions per second)

7
Lecture 07 - Consensus Algorithms

PoS Drawbacks
• Theoretically encourages centralization:
• Higher stake means higher rewards, keeping the ‘rich’ richer

• Not as much "battle" tested as PoW


Lecture 07 - Consensus Algorithms

Current PoS Systems

 Ethereum (not yet)


 Cardano
 Waves
 Peercoin
 Nxt

9
Lecture 07 - Consensus Algorithms

Delegated-Proof-of-Stake
• Developed by Dan Larimer in 2013
• This consensus model is aimed at modeling a digital
democracy
• Token holders (stakeholders) can vote for witnesses
– The number of votes they can cast is proportional to their token
holdings

10
Lecture 07 - Consensus Algorithms

Delegated-Proof-of-Stake

https://www.sketchplanations.com/post/148150419096/direct-and-representative-democracy-in-direct
Lecture 07 - Consensus Algorithms

Delegated-Proof-of-Stake
• Witnesses are the block creators, and are paid
transaction fees when they create a new block
• Witnesses can be voted out at any time, and thus will
lose their income if they do not create new blocks, or
create blocks that are not trustworthy

12
Lecture 07 - Consensus Algorithms

Delegated-Proof-of-Stake
• In some cases, witnesses are rotated on a
regular basis to give more people opportunity to
participate
• Current projects include Bitshares, Steem, EOS,
Lisk and Ark
Lecture 07 - Consensus Algorithms

Ethereum 2.0

https://ethos.dev/beacon-chain/
Lecture 07 - Consensus Algorithms

Crosslinks
• They link Shards to the Beacon Chain
• As there are 64 shards, each beacon block can contain
up to 64 crosslinks.

• A beacon block might only have one crosslink, if at that


slot, there were no proposed blocks for 63 of the shards.
Lecture 07 - Consensus Algorithms

Slots and Epochs

Every 12 seconds, one beacon (chain) block and 64 shard


blocks are added when the system is running optimally.
Lecture 07 - Consensus Algorithms

Ethereum 2.0
• Validators are actively participating in the consensus of
the Ethereum 2.0 protocol.
• Ethereum 2.0 validators are Proof of Stake “virtual
miners”.

• A block proposer is a validator that has been


pseudorandomly selected to build a block. The not
selected ones are attesters
• An attestation is a validator’s vote, weighted by the
validator’s balance.
Lecture 07 - Consensus Algorithms

Ethereum 2.0

https://ethos.dev/beacon-chain/
Lecture 07 - Consensus Algorithms

How to become a validator?

• In Ethereum 2.0, users stake ETH to activate and control validators.


• Stakers can stake all their ETH by activitating Validators.

• Each validator has a maximum balance of 32 ETH and For every 32


ETH staked, one validator is activated.
Lecture 07 - Consensus Algorithms

RANDAO
• At every epoch, a pseudorandom process RANDAO selects
proposers for each slot, and shuffles validators to committees.
• A committee is a group of validators. For security, each slot has
committees of at least 128 validators.
Lecture 07 - Consensus Algorithms

Summary
• Ethereum consensus algorithm is an
example of PoS?
Lecture 07 - Consensus Algorithms

Proof-of-Importance
• Introduced by NEM, and aims to solve problems
with PoW and PoS
– Discourages coin hoarding, and ASIC hardware gives
you no advantage

22
Lecture 07 - Consensus Algorithms

Proof-of-Importance
• Nodes are assigned an ‘Importance Score’ based on 3
factors, and selected to harvest (mine) blocks
proportional to this score (similar to PoS selection)
– Stake: Coins vest power over time, and more coins leads to
higher importance (similar to PoS)
– Partners: The algorithm considers who and how many people
you have made transactions with, encouraging using the
network as a payment
– Recent Transactions: Large, recent, and frequent transactions
have a large impact on Importance Score

23
Lecture 07 - Consensus Algorithms

Proof-of-Importance
• What is the main motivation here?
• The structure encourages and rewards people for using
the blockchain functionally (as currency), as opposed to
using it just as a way to generate income

24
Lecture 07 - Consensus Algorithms

Proof-of-Authority
• Authentication nodes (mining nodes) require
reliable and thorough identity confirmation
– This kind of blockchain is known as a permissioned
blockchain

25
Lecture 07 - Consensus Algorithms

Proof-of-Authority
• The identity of the node is at stake, in addition to
the holdings (currency) which they are staking
– Identity can serve as a more powerful motivator for
honest behavior than financial consequences

26
Lecture 07 - Consensus Algorithms

Proof-of-Authority
• In the case of a malicious actor, not only is their stake
forfeit (and in some cases all of their holdings), but also
their identity: their reputation is tarnished
• Addresses the Sybil attacker issue (without getting into
faking government identification)

27
Lecture 07 - Consensus Algorithms

Proof-of-Elapsed-Time
• It requires a permissioned blockchain:
– Participants identify themselves to the network, and
the network can decide to let them participate

28
Lecture 07 - Consensus Algorithms

Proof-of-Elapsed-Time
• At a high level, this consensus algorithm is essentially a
random lottery between all participating nodes deciding
who gets to mine the next block
– Participating nodes use a trusted timer to wait a randomly
assigned time
– The first node to finish waiting it’s given time is able to mine the
next block
– The block is verified by the other participants, and new times are
assigned (drawn)

29
Lecture 07 - Consensus Algorithms

Proof-of-Elapsed-Time
• Relies on trusted code: Intel Software Guard Extensions
(SGX) - keeps the lottery fair
• Not suitable algorithm for public, untrusted blockchains,
but demonstrates another flavor of consensus algorithms
possible when conditions are applied to the consensus
problem

30
Lecture 07 - Consensus Algorithms

Intel SGX
• A specialized hardware component can create an
attestation that some particular trusted code was set up
correctly in a protected environment. e.g. An external
party can use the attestation to verify that the right code
is running the right way.

• Trusted code runs in an environment that is private to the


rest of the application. e.g. The rest of the application
can’t inspect or interfere with the memory space of the
trusted code.
Lecture 07 - Consensus Algorithms

PoET’s trusted code – Join


• A new participant downloads the trusted code for the
blockchain.

• Participant sends a SGX attestation to the rest of the


network as part of a join request.
Lecture 07 - Consensus Algorithms

PoET’s trusted code –


Participate
• Participant obtains a signed timer object from the trusted code.
• Participant waits for the time specified by the timer object.

• Participant obtains a certificate (signed by the trusted code’s private


key) that the timer has completed. Participant sends this certificate
to the rest of the network along with the new block for the
blockchain.
Lecture 07 - Consensus Algorithms

PoET’s trusted code –


Participate
• The protocol also involves other protections on top of
SGX. For example, the network measures how often a
given participant wins the lottery in order to detect
participants with a compromised SGX system. Bad
actors can then be blacklisted.
Lecture 07 - Consensus Algorithms

Practical Byzantine Fault Tolerance


(pBFT)
• One node is designated as leader
• When a user of the network (client) sends a transaction,
the leader casts (redirects) the request to all of the other
active nodes in the sequence (called backup nodes)
• The client awaits a certain number (#nodes x 2/3 + 1) of
the same response sent from the backup nodes, at
which point the transaction is final

35
Lecture 07 - Consensus Algorithms

Practical Byzantine Fault Tolerance


(pBFT)
• The leader can be replaced each round with the nodes
voting on the next leader, or can even be replaced in the
middle of a round if the leader fails to cast the clients
requests or is deemed as faulty by a super majority of
the participating nodes
• Resistant to ⅓ faulty or untrustworthy nodes:
– With at most ⅓ of the nodes being faulty, the system will be both
live and trustworthy

36
Lecture 07 - Consensus Algorithms

Practical Byzantine Fault Tolerance


(pBFT)
• Advantages:
– There is no need for block confirmations, all transactions are
final once the client receives the responses
– Significantly more energy efficient that PoW

• Disadvantages:
– Only works efficiently with a small number of participating
backup nodes
– Also runs into issues with single parties faking multiple nodes
(Sybil attack)

37
Lecture 07 - Consensus Algorithms

Practical Byzantine Fault Tolerance


(pBFT)

• Zilliqa pBFT in combination with PoW every 100 blocks

38
Lecture 07 - Consensus Algorithms

Practical Byzantine Fault Tolerance


(pBFT)

• Hyperledger Fabric
● Open source collaborative project hosted by Linux
Foundation
● Permissioned version of pBFT

39
Lecture 07 - Consensus Algorithms

Proof-of-Capacity
• Nodes ‘map’ or ‘plot’ their storage (hard-drive)
with a very slow hashing algorithm (Shabal)
– This is essentially pre-storing the solutions to blocks
in their hard drive
• Each block, the person with the lowest hash
(quickest) solution wins the right to mine the
block

40
Lecture 07 - Consensus Algorithms

Proof-of-Capacity
• The larger the storage allocated for the map, the
more likely that node wins the block
– As the hashing is very slow, it’s infeasible to attempt
to compute new solutions in real time
• As the solutions are stored, minimal computation
is needed for each new block

41
Lecture 07 - Consensus Algorithms

Proof-of-Capacity
• Advantages: very power efficient, equipment lasts a long
time, equipment readily available
• Disadvantages: potential for specialized storage arms
race (PoW arms race for hashing power)
– Hard drive space used for mining is useless

• Has seen very little adoption: Only Burstcoin implements


the algorithm (Algorithm released 2014)
– Network peaked at ~0.4 Exabytes (400,000 Terabytes)

42
Lecture 07 - Consensus Algorithms

Do not distribute ...


• These slides are not always prepared by me.
• Most of the content comes from the reference book
– Bitcoin and Cryptocurrency Technologies: A Comprehensive Introduction
– Arvind Narayanan, Joseph Bonneau,
– Edward Felten, Andrew Miller, Steven Goldfeder

You might also like