Lecture 07-Consensus Algorithms
Lecture 07-Consensus Algorithms
Lecture 07
Consensus Algorithms
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
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
7
Lecture 07 - Consensus Algorithms
PoS Drawbacks
• Theoretically encourages centralization:
• Higher stake means higher rewards, keeping the ‘rich’ richer
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.
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”.
Ethereum 2.0
https://ethos.dev/beacon-chain/
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.
35
Lecture 07 - Consensus Algorithms
36
Lecture 07 - Consensus Algorithms
• 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
38
Lecture 07 - Consensus Algorithms
• 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
42
Lecture 07 - Consensus Algorithms