Top Banner
Scalable Consensus Algorithms in Distributed Ledger Technologies Habib Yajam Secure Communication Lab, University of Tehran 1
66

Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

May 27, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Scalable Consensus Algorithmsin

Distributed Ledger TechnologiesHabib Yajam

Secure Communication Lab,

University of Tehran

1

Page 2: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Outline

• Blockchains, what are them? Why we need them? And when?

• A Brief History of Bitcoin.

• Consensus Algorithms, Definition and Properties.

• Categorizing Consensus Algorithms.

• Hot Topics for Research.

2

Page 3: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

BlockchainsWhat are them? Why we need them? And when?

3

Page 4: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

When do we need a Blockchain?

4

Is a Shared Common Database

needed?

Are Multiple Parties involved?

Do Parties have conflicting interests?

Traditional Database

Blockchain(DLT)

yes

yes

yes

no

no

noCan everyone see

the database?

Can everyone maintain the

database integrity?

Permissioned Private Ledger

(Bankchain)

Permissioned Public Ledger

(Ripple)

Permissionless Public Ledger

(Bitcoin)

yes

yes

no

no

Page 5: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Blockchain Use Cases

• P2P Payments

• Video Games

• Back Office Settlement

• Supply Chain Management

• Copyright Management

• Reliable Log Keeping

• Digital Identity Management

• Decentralized Voting

5

Page 6: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

What are the Ingredients?

• P2P Network

• Consensus Algorithm

• Ledger Database

6

Page 7: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

P2P Network

7

Page 8: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Transaction Flow in Bitcoin

8

mempool

Page 9: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Blockchain

9

Page 10: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Generating a Valid Block (Mining)

10

Has

hFu

nct

ion

4198659816850181691986501

< 𝑡𝑎𝑟𝑔𝑒𝑡Change nonce

Publish to Network

no

yes

Page 11: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Generating a Valid Block (Mining)

11

Has

hFu

nct

ion

1712039707102730871029375

< 𝑡𝑎𝑟𝑔𝑒𝑡Change nonce

Publish to Network

no

yes

Page 12: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Generating a Valid Block (Mining)

12

Has

hFu

nct

ion

0000961965911298498619761

< 𝑡𝑎𝑟𝑔𝑒𝑡Change nonce

Publish to Network

no

yes

Page 13: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

13

Page 14: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

14

Page 15: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

15

Page 16: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

16

Page 17: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

17

Page 18: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Nakamoto Consensus

18

Page 19: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Forks

19

Normal State Fork in Blockchain

Page 20: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Double Spending Attack

20

Page 21: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Double Spending Attack

21

Page 22: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Double Spending Attack

22

Page 23: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Double Spending Attack

23

Page 24: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Double Spending Attack

24

Page 25: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

BitcoinA Brief History

25

Page 26: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2009)

• 01/03: (Block 1) The genesis block established by Satoshi Nakamoto. marking the creation of the cryptocurrency.

• 01/09: (Block 2) Bitcoin v0.1 was released and mining began.

Page 27: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2009)

• 01/11: (Block 78) the first block mined by an individual other than Satoshi. It was Hal Finney.

• 01/12: (Block 170) The first transaction occurred between Satoshi and Hal Finney.

27

Page 28: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2009)

• 10/05: (Block ~24400) first bitcoin exchange price was determined by Libertarian Advocating Website “New Liberty Standard” (~0.0008$)

• 12/10: (Block 32256) The difficulty adjusts for the first time, rising from 1 to 1.18.

Page 29: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2010)

• 02/06: (Block ~57600) dwdollar’s Bitcoin Market first bitcoin exchange was started. Used PayPal as the method of exchange.

• 05/22: (Block 57043) First purchase of a tangible good using bitcoin. (0.0025$)

Page 30: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2010)

• 07/02: (Block ~65600) Bitcoin v0.3 was released.

• 07/17: (Block ~67040) Mt.Gox, Second Bitcoin Exchange and most well-known exchange at the time was established.

• 07/18: (Block ~67180) First time GPU Mining by pseudonymous person named ArtForz. Later he Acquired 25% of bitcoin network hashing power using a private GPU program.

Page 31: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2010)

• 12/13: (Block ~97300) Satoshi’s Last Login on BitcoinTalk. He later said he has “moved on to other things”. That was the last the world heard of the secretive Bitcoin creator.

• 12/16: (Block 97834) First Pool-mined Bitcoin Block by Slush Pool.

31

Page 32: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin History (2011)

• 02/01: (~Block 105000) Silk road an online black market and the first modern darknet market, best known as a platform for selling illegal drugs opens.

• 02/09: (~Block 107000) Dollar Parity happens on Mt.Gox.

32

Page 33: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Price History

33

Page 34: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin P2P network

34

Page 35: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Number of Nodes

35

Page 36: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Orphan Rate

36

Page 37: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Mining

37

Page 38: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Mining

38

Page 39: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Mining

39

Page 40: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Mining

40

Page 41: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Bitcoin Mining Hashrate Distribution

41

Page 42: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Other Cryptocurrencies

• Litecoin 2011 (PoW Scrypt) [Currency]

• Ripple 2012 (BPFT) [Currency]

• Dash 2014 (PoW X11 + PoS) [Privacy]

• Ethereum 2015 (PoW → PoS) [DApps]

• Zcash 2016 (PoW Equihash) [Privacy]

• IOTA 2017 (PoW Curl) [Currency]

• Cardano 2017 (PoS Provably Secure) [DApps]

42

Page 43: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Consensus AlgorithmsDefinition, Goals and Properties

43

Page 44: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Defining Consensus

• Consensus:Achieving agreement in a multi-agent system.

• If communication/agents are reliable:Consensus is Trivial

• Consensus Algorithms:Achieving agreement in an unreliable environment

44

Page 45: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Defining Consensus

• Unreliability Model: Fault

• Types of Fault:• Crash fault:

node hangs/stops/goes offline

• Byzantine fault:node violates protocol maliciously

45

Page 46: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Defining Consensus

• Properties of Consensus Algorithms:

• Safety (Consistency)

• Liveness (Availability)

• Throughput

• Latency

• Scalability

• Decentralization, Transparency, Order Preserving, …

46

Page 47: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Consistency

• A confirmed transaction in an honest node will eventually be confirmed by all honest nodes.

47

Page 48: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Consistency

Node1

6

8

1

9

Node3

6

8

1

9

Node2

6

8

1

9

Node4

6

8

1

9

48

Page 49: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Consistency

Change “8” to “5”

Node1

6

8

1

9

Node3

6

8

1

9

Node2

6

8

1

9

Node4

6

8

1

9

49

Page 50: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Consistency

Change “8” to “5”

Node1

6

5

1

9

Node3

6

8

1

9

Node2

6

8

1

9

Node4

6

5

1

9

50

Page 51: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Availability

• A valid transaction will eventually be confirmed by an honest node.

51

Page 52: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Availability

Node1

6

8

1

9

Node3

6

8

1

9

Node2

6

8

1

9

Node4

6

8

1

9

Append “7”

52

Page 53: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Availability

Node1

6

8

1

9

7

Node3

6

8

1

9

7

Node2

6

8

1

9

7

Node4

6

8

1

9

7 53

Page 54: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Throughput/Scalability

• Throughput:Number of newly confirmed transactions per unit of time.

• Latency:

• Time it takes for a newly created transaction to get confirmed in an honest node.

• Scalability:In a scalable consensus algorithm, increasing the number of participants does not affect performance.

54

Page 55: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

CategorizingConsensus AlgorithmsVoting-based, Chain-based, DAG-based

55

Page 56: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Categorization of Consensus Alg.

• Vote-based Consensus:• First Prominent Voting-base Protocol by Leslie Lamport 1998

• Example: PBFT, Paxos, Ripple

• Fast ✓

• Not Scalable

56

Page 57: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Categorization of Consensus Alg.

• Chain-based Consensus:• Introduced by Satoshi Nakamoto in 2008

• Example: Bitcoin, Ethereum

• Scalable ✓

• Not Fast

4Txs

3Txs

2Txs

1Txs

4Txs

3Txs

2Txs

1Txs

5Txs

57

Page 58: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Categorization of Consensus Alg.

• DAG-based Consensus:• Introduced by Sergio Demian Lerner in 2015

• Example: IOTA, Nano

• Fast ✓

• Scalable ✓

58

Page 59: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Categorization of Consensus Alg.

• Permissioned

• Permissionless:• Proof-of-Work

• Proof-of-Stake

• Proof-of-Importance

• Proof-of-Activity

• Delegated-Proof-of-Stake

• ...

Scalable+

Permissionless+

Byzantine Fault Tolerant=

New Form of Decentralization

59

Page 60: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Categorization of Consensus Alg.

Voting-based

Chain-based

DAG-based

Ripple, R3 Corda, Stellar, Fabric,

Chain Core, QuorumMultichain, Vechain Hashgraph

Zilliqa, NEO

Bitcoin, Etheruem, NEM, Qtum,

OmiseGo, TRON, EOS, Cardano

IOTA

60

Page 61: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

BitcoinFirst Chain-based

2008

C D

DAGcoinFirst DAG-based

2015

EtheruemFirst Smart Contract

2013

C

V

PAXOSMost Famous Voting-based

1998

V

Apache Zookeeper

2007

Zab

C

PeercoinFirst Proof-of-Stake2012

Year Year Year

1998 2008 2018

2013 2014 2015 2016 20172009 2010 2011 20122004 2005 2006 20072000 2001 2002 20031999

PBFTFamous Byzantine

1999

V

V

RippleFast Payment

2011

2019

D

TangleIOTA

2016

D

PHANTOMAcademic Paper2017

61

Page 62: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Blockchain Scalability Solutions

• Base Layer Solutions:• Decoupling Blockchain

• Bitcoin-NG• Fruitchains• PRISM

• DAG-based Consensus Algorithms• Spectre• Phantom GHOST-DAG

• Hybrid Chain-based Voting-based Algorithms• Byzcoin• Casper: the friendly finality gadget• Thunderella

• Sharding

62

Page 63: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Blockchain Scalability Solutions

• Second Layer Solutions:• Lightening Network

• Plasma Network

63

Page 64: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Research Topics

64

Page 65: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Research Topics

• High-throughput, Low-latency, Scalable Consensus Algorithms.

• Privacy in Blockchains both in Smart-contracts and Payments.

• Multi Party Computations Using Blockchain.

• Blockchain Use Cases in Internet of Things.

65

Page 66: Scalable Consensus Algorithms in Distributed Ledger ...³لسله سمینارهای رمز و امنیت...•12/10:(Block 32256) The difficulty adjusts for the first time, rising

Thank you

66