consensus - faculty.fuqua.duke.educharvey/teaching/697_2019/6_conse… · overview what is...

64
Campbell R. Harvey Joey Santoro Christopher Sides Consensus Innovation and Cryptoventures 1

Upload: others

Post on 30-Sep-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Campbell R. HarveyJoey Santoro

Christopher Sides

Consensus

Innovation and Cryptoventures

1

Page 2: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

2

Page 3: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Overview● What is consensus and why is it needed for blockchain

systems?● Background: Byzantine Generals Problem● Public: Proof-of-Work (PoW) and Proof-of-Stake (PoS)

o Don’t need to know anyone● Permissioned: Federated Byzantine Agreement

o Barrier to entry to be validator but once in don’t need to be known by all peers

● Private o Everyone knows everyone 3

Page 4: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

What is Consensus?Consensus is an agreement among a group of people on an idea, statement, or plan of action

• Majority: 51% • Supermajority: 66% (sometimes higher) • Unanimous: 100% • Weighted: not all votes weighed equally or

multiple votes per agent

4

Page 5: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

What is Consensus?● Consensus is typically only relevant when there is no

distinguished leadero A jury must reach a consensus on a court verdict (unanimous) o The senate must reach a consensus on new bills being passed

(majority or supermajority)● Particularly important when there is significant

disagreement or potential for untrustworthy parties in the discussions around the decision

5

Page 6: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

What is Consensus in Blockchain?The agreement of system components (nodes) on the [next] state of the system, or the transition between the current state and the next state● The nodes must agree on a set of valid transactions

representing the change from the current state of the system to the next state of the system

● Consensus must be achieved automatically (without human oversight)

6

Page 7: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

What is Consensus in Blockchain?● Consensus is irreversible: posted transactions are final● Blockchain consensus is a subset of distributed system

consensus○ Distributed System: A number of independent computers

linked by a network● Must be resistant to malicious or false actors

“Consensus is the process by which all nodes agree on the same ledger”

7

Page 8: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Blockchain Consensus: NodesCommon types are:• Mining Node: These nodes have the most invested in

the system, and as a result have the most power. These nodes actually compute and propose new blocks to the chain according to the system rules. They are the receivers of block rewards, which often include mining fees.

8

Page 9: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Blockchain Consensus: NodesCommon types are:• Full Node: These nodes are an intermediate step

between mining nodes and light nodes. They store the full copy of the blockchain, and verify all blocks to ensure valid transactions. They are often not paid for their contribution to the blockchain system.

9

Page 10: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Blockchain Consensus: NodesCommon types are:• Light Node: These nodes usually only store a partial

copy of the blockchain, or simply address balances. They can often verify transactions, but usually do not participate in consensus. They are almost never paid for their contribution to the blockchain system, and mostly act as an access point for broadcasting transactions

10

Page 11: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Why is Consensus Needed?• Consensus is a very difficult problem when parties are not trusted• The network must maintain integrity in order to maintain value• Past transactions must be trusted for the network to function• Thus, the ability to verify transactions without trust is needed• This problem is solved with various forms of consensus• The consensus problem can often be rephrased as the ability to

trust the result of a transaction or block, without trusting the parties involved in the transaction, or the party that verified it

11

Page 12: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Byzantine Generals Problem (BGP)● A general and his armies have laid siege

to a city● The city is very strong, and has thus far

resisted their attacks● They must all decide to retreat or attack,

and a time to do either● An uncoordinated attack or retreat will

result in unacceptable losses

13

Page 13: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Byzantine Generals Problem (BGP)● The general(s) and officers must

communicate through messengers○ The officers may communicate among

themselves using messengers as well● Any party involved may be a traitor:

○ The general himself may be a traitor○ The officers controlling his armies may be

traitorous○ The messengers can be traitorous, and can

also be abducted by enemy forces

14

Page 14: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

BGP Outcomes

Victory!Acceptable Retreat

15

Page 15: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

BGP OutcomesDefeat!

(Traitorous Messengers)

Defeat!(Traitorous Officers)

Defeat!(Traitorous General)

16

Page 16: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Byzantine Fault Tolerance (BFT)

● A system is considered to be Byzantine Fault Tolerant (BFT) if it is resistant to the dilemmas of the Byzantine Generals Problem

● A Byzantine Fault is defined as a failure mode of the system, either failing to function or functioning incorrectly, caused by an inability to reach or error in consensus among the system

17

Page 17: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Byzantine Fault Tolerance (BFT)

● Most consensus algorithms used in blockchain technologies are Byzantine Fault Tolerant○ Some algorithms assume dishonest nodes take certain

actions, or send certain messages, and thus are not BFT○ Sometimes how a system implements the consensus

algorithm determines its fault tolerance

20

Page 18: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Byzantine Fault Tolerance (BFT)

● Goal of blockchain consensus algorithms is to be BFT● Most algorithms are (PoW, PoS, etc.)● Some algorithms include extra assumptions breaking

BFT● Often allowing for speedups● Speed vs. security

21

Page 19: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Work (PoW)● A given node collects transactions that are broadcast to

the entire network and stores them in a block○ Before including transactions in the block, the node verifies

that the transactions are valid Invalid transactions result in a block being rejected by the other nodes)

○ The transactions are typically assembled in a type of Merkle tree

○ The transactions pay a fee to the mining node to be included the transaction, higher fees are included first

22

Page 20: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Work (PoW)● The mining node begins solving an extremely difficult

cryptographic hashing problem, with the transactions being part of the input to the problem○ This is essentially a guessing game with a very low chance of

guessing correctly○ Once the correct answer is known, it is very easy for other

people to check that it works○ Part of the motivation for solving the problem is that the

miner can give themselves a reward23

Page 21: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Work (PoW)● The mining node that has found the correct solution

broadcasts it to the rest of the network, and begins the next block with another complex cryptographic hashing problem○ The longest blockchain (weighted by work) is always taken to be the

correct chain, and thus the other miners will also begin the new problem: the length of each block is determined by how much work it took to create

○ The other nodes can quickly check that the transactions included in the block are valid, and that the broadcast solution is actually a solution to the problem

● Repeat24

Page 22: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

PoW Strengths ● Proven reliability/Predictable block times/Robust ● Does not rely on any other node being trustworthy● Only known vulnerability is the so-called ‘51% attack’

○ One miner or group of miners is able to take over the resources driving the chain forward

○ However, expenditure of large computing and energy cost to take 51% would be lost if crypto collapsed

● Uncensorable and publicly broadcast● Public transactions can be seen as a drawback in some cases

25

Page 23: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

PoW Drawbacks● Enormous waste of resources

○ Bitcoin mining uses much energy as Argentina● ASIC hardware give advanced miners and

mining pools a substantial advantage over the average miner○ Massive start up costs can result in centralization of pools

and resources○ A regular computer has essentially no hope of ever mining a

block

26

Page 24: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

PoW Drawbacks● Mining pools are able to slightly game the

system by delaying the release of a found block and gaining a slight head start on next one

● Scalability issues ○ Lower transaction throughput ○ Lowering the block time (problem difficulty) is potentially

less secure● Miners often sell the coins immediately, removing any

loyalty to the chain they are mining

27

Page 25: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Current PoW Systems

● Bitcoin ($61b)● Ethereum ($11b,Casper)● Litecoin ($2.1b)● Bitcoin Cash ($2.1b)● Many, many more

Many systems launch with a Proof-of-Work-like consensus mechanism, but later transition to a different, less resource intensive approach, often with proprietary features 28

Page 26: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

https://crypviz.io/wp-content/uploads/2017/11/proof-of-stake.png

29

Page 27: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Stake (PoS)● The chosen miners still do some form of guess-

and-check to create the block:○ They try various combinations of features of their

address and wallet, and previous block variables○ The number of combinations possible is based on

their stake, hence why larger stakeholders have higher chances of successfully mining the block

○ These combinations are quickly exhausted, making PoS significantly less computationally intensive

30

Page 28: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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)○ Some implementations demand that miners put

their coins into escrow that is lost if they break the rules

31

Page 29: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Stake (PoS)● The block is validated as usual by the rest of

the network before they continue to the next block

● 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

32

Page 30: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

33

Page 31: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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 $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)

34

Page 32: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

PoS Drawbacks● Theoretically encourages centralization:

○ Higher stake means higher rewards, keeping the ‘rich’ richer● ‘Nothing at stake attack’

○ Since forwarding the blockchain costs effectively nothing (compared to PoW), nodes are actually encouraged to work on every possible fork at once, as doing so increases the chance that they receive part of the reward in the event that the forked chain becomes longer

○ Results in consensus being difficult to reach, or unreachable

https://www.youtube.com/watch?v=pzIl3vmEytY35

Page 33: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

PoS Drawbacks● Proof of Stake is often claimed to be not as secure as

Proof of Work○ There are many implementations of various ‘claimed’

security, and most of these just need to stand the test of time to be considered more secure

● Some implementations are vulnerable to a Sybil attack

36

Page 34: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Current PoS Systems

● Ethereum (after Casper, $11b)● Cardano ($1b)● Waves ($250m)● Peercoin ($12m)● Nxt ($25m)

40

Page 35: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

45

Page 36: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

46

Page 37: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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 (all Dan Larimer founded), Lisk and Ark● Bitshares ($100m)● Steem ($91m)● EOS ($2.2b)● Lisk ($127m)● Ark ($41m)

47

Page 38: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Other Consensus Algorithms● Practical Byzantine Fault Tolerance (pBFT) -

Hyperledger Fabric● Federated Byzantine Fault Tolerance (fBFT) - Stellar● Delegated Byzantine Fault Tolerance - Neo● Proof-of-Importance (PoI) - NEM● Proof-of-Elapsed-Time (PoET) - Hyperledger Sawtooth● Proof-of-Capacity (PoC - aka P-o-Space)● Proof-of-Authority (PoA)● Raft (more classical consensus, not blockchain specific)

48

Page 39: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Practical Byzantine Fault Tolerance (pBFT)● The nodes in this model are in sequence (linear order)

with the first node being the 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 ⅓ + 1) of the same response sent from the backup nodes (the “shard”), at which point the transaction is final

49

https://blockonomi.com/practical-byzantine-fault-tolerance/

Page 40: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

50

Page 41: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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)

51

Page 42: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Practical Byzantine Fault Tolerance (pBFT)

● Zilliqa ($150m)● pBFT in combination with PoW every 100 blocks

52

Page 43: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Practical Byzantine Fault Tolerance (pBFT)

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

53

Page 44: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Federated Byzantine Fault Tolerance (fBFT)● Introduced by Ripple, proven, refined and adopted by

Stellar● Based on the idea of trusting nodes not to collude with

each other

55$12b $1.5b

Page 45: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Federated Byzantine Fault Tolerance (fBFT)

● Each node has a list (or multiple lists) of peer-nodes that it trusts not to collude with each other○ Called Unique-Node-List (UNL) or Quorum List○ These nodes are not trusted to have the right answer or

behavior, only that they won't work together to defraud you: while we might not trust Wile E Coyote or Road-Runner to be honest, we trust that they won’t collude

56

Page 46: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Federated Byzantine Fault Tolerance (fBFT)

● During each round of consensus, the nodes rely on their UNL or Quorum list (in addition to their own calculation) to determine valid transactions

● The start and end of the process follows pBFT, with a leader casting client requests and nodes responding

● A transaction that fails one round of consensus will often succeed in the next

● A significant step to preventing the Sybil attack, but not completely invulnerable

57

Page 47: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Summary● Byzantine Fault Tolerance (BFT)

● Consensus with limited group of people (know each other, like inhabitants of a building voting on repairs)

● Proof of Stake● Vote by percent of ownership variants, PoI (next), DPoS

● Federated Byzantine Agreement (FBA)● Ripple, Stellar. Trust a small group of people in your circle,

consensus in the circle, but each circle has some overlap with others

● Proof of Work (PoW)● All participants anonymous, don’t extend trust, number of

participants unknown58

Page 48: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Summary

59

https://medium.com/@pavelkravchenko/consensus-explained-396fe8dac263

Page 49: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

60

Page 50: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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 staking 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

61

Page 51: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Importance

● 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

● Blocks are verified by the other nodes as usual, and the longest chain is always considered correct

● Delegate Harvesting: You are able to delegate your importance score to another node such that it is able to harvest (mine) the blocks on your behalf, and you claim part of the rewards

62

Page 52: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Elapsed-Time

● Different than other consensus algorithms in that it requires a permissioned blockchain:○ Participants identify themselves to the network, and the

network can decide to let them participate

63

Page 53: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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)64

Page 54: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Elapsed-Time

● Relies on trusted code: Intel Software Guard Extensions (SGX) - keeps the lottery fair

● Used by Hyperledger Sawtooth● Not suitable algorithm for public, untrusted blockchains,

but demonstrates another flavor of consensus algorithms possible when conditions are applied to the consensus problem

65

Page 55: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

66

Page 56: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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

67

Page 57: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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 Burstcoinimplements the algorithm (Algorithm released 2014)○ Network peaked at ~0.4 Exabytes (400,000 Terabytes)

68

Page 58: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Proof-of-Authority

● Very similar to Proof-of-Stake in concept, and implementation of most aspects

● Authentication nodes (mining nodes) require reliable and thorough identity confirmation ○ This kind of blockchain is known as a permissioned blockchain

69

Page 59: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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○ Compare getting a criminal record versus paying a speeding

ticket

70

Page 60: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

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 issue with PoS in which incentives may not be equal (equal stake = equal incentive)○ $10,000 isn’t worth that much to a billionaire, but is a lot to a

college student○ Also addresses the Sybil attacker issue with PoS (without getting

into faking government identification)71

Page 61: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Raft (Classical Consensus)● Not applicable for blockchain technologies● Consensus is resolved by an elected leader

○ The leader is responsible for state verification (most up to date system state) and replication

● The leader sends out a heartbeat to all participating nodes in the network○ The follower nodes expect this signal ~3-10 times a second

● The leader leads until it either fails or disconnects from the network

● The leaders resolutions to the question at hand (the problem that needs consensus) are verified by the other nodes independently, and they are responsible for electing a new leader if need be○ The follower nodes do not frequently communicate with each other

● https://raft.github.io/ 72

Page 62: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Sources● https://medium.com/loom-network/understanding-blockchain-fundamentals-part-1-

byzantine-fault-tolerance-245f46fe8419● https://www.tibco.com/blog/2018/04/04/enterprise-blockchain-consensus-algorithms/● https://mastanbtc.github.io/blockchainnotes/consensustypes/● https://cdn-images-1.medium.com/max/1600/0*-xCD-El4LZ48dji1.png● https://medium.com/all-things-ledger/the-byzantine-generals-problem-168553f31480● https://mastanbtc.github.io/blockchainnotes/consensustypes/● https://www.tibco.com/blog/2018/04/04/enterprise-blockchain-consensus-algorithms/● https://cointelegraph.com/news/why-blockchain-needs-proof-of-authority-instead-of-

proof-of-stake● https://medium.com/poa-network/proof-of-authority-consensus-model-with-identity-

at-stake-d5bd15463256● https://wiki.parity.io/Proof-of-Authority-Chains● https://en.wikipedia.org/wiki/Proof-of-authority● http://architecture-docs.readthedocs.io/execution_model/consensus_protocol.html● https://etherbasics.com/the-basics/phases-of-ethereum/ 73

Page 63: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Sources● https://medium.com/@robertgreenfieldiv/explaining-proof-of-stake-f1eae6feb26f● https://www.youtube.com/watch?v=Nlmv4fg4NQk● https://en.wikipedia.org/wiki/Proof-of-stake● https://multicoin.capital/2018/03/02/delegated-proof-stake-features-tradeoffs/● https://bitshares.org/technology/delegated-proof-of-stake-consensus/● https://blog.acolyer.org/2015/05/18/practical-byzantine-fault-tolerance/● https://blockonomi.com/practical-byzantine-fault-tolerance/● https://www.stellar.org/papers/stellar-consensus-protocol.pdf● https://cryptoinsider.21mil.com/byzantine-fault-tolerance-blockchain-systems/● https://developers.ripple.com/consensus.html● https://towardsdatascience.com/federated-byzantine-agreement-24ec57bf36e0● https://medium.freecodecamp.org/in-search-of-an-understandable-consensus-

algorithm-a-summary-4bc294c97e0d● https://ethereum.github.io/blog/2015/08/01/introducing-casper-friendly-ghost/

74

Page 64: Consensus - faculty.fuqua.duke.educharvey/Teaching/697_2019/6_Conse… · Overview What is consensus and why is it needed for blockchain systems? Background: Byzantine Generals Problem

Sources● https://nem.io/xem/harvesting-and-poi/● https://www.smithandcrown.com/definition/proof-of-importance/● https://cointelegraph.com/news/proof-of-importance-nem-is-going-to-add-

reputations-to-the-blockchain● https://nem.io/wp-content/themes/nem/files/NEM_techRef.pdf● https://sawtooth.hyperledger.org/docs/core/nightly/0-8/introduction.html● https://medium.com/kokster/understanding-hyperledger-sawtooth-proof-of-elapsed-

time-e0c303577ec1● https://en.wikipedia.org/wiki/Proof-of-space● https://coincentral.com/what-is-proof-of-capacity/● https://www.burst-coin.org/proof-of-capacity● https://www.investopedia.com/terms/p/proof-capacity-cryptocurrency.asp● https://bitcoin.stackexchange.com/questions/50922/whats-a-sybil-attack● http://www.toptenreviews.com/software/articles/what-is-a-sybil-attack/● https://ethereum.github.io/blog/2015/12/28/understanding-serenity-part-2-casper/

75