emmanuelleanceaume lesson2 ...people.rennes.inria.fr/eric.fabre/module mad/lesson2.pdf ·...

94
MADS Emmanuelle Anceaume Lesson 2: Bitcoin and its Distributed Ledger Technology (cont’d) http://people.irisa.fr/Emmanuelle.Anceaume/ 1 / 87

Upload: others

Post on 26-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

MADS

Emmanuelle Anceaume

Lesson 2: Bitcoin and its Distributed Ledger Technology(cont’d)

http://people.irisa.fr/Emmanuelle.Anceaume/

1 / 87

Page 2: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain : a sequence of blocks

The blockchain is the data structure that implements thedistributed ledgerEach block contains transactions

The size of the block is limited to 1MBIn average (and today) there are 1, 700 transactions per block(no more than 4, 000)

The number of blocks (today) is almost 500, 000 blocksThe first block (block 0) of the blockchain is the genesis block

2 / 87

Page 3: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain : a sequence of blocks

A block = the header and the bodythe header = allows the unique identification of a blockthe body = contains all the transactions of the block

3 / 87

Page 4: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain : a sequence of blocks

4 / 87

Page 5: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain : local view implementation

Any locally valid transaction is embedded within a blockIntegrity proof : Merkle tree of the transactions in the blockResilience to sybil attacks : Hashcash Proof-of-WorkChaining with proof of integrity (fingerprint of the previousblock)

5 / 87

Page 6: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

6 / 87

Page 7: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Merkle root

7 / 87

Page 8: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Proof-of-Work

8 / 87

Page 9: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=0, difficulty=000

9 / 87

Page 10: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=0, difficulty=000, 1HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

10 / 87

Page 11: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=1, difficulty=000, 4HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27

11 / 87

Page 12: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=2, difficulty=000, 2HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320

12 / 87

Page 13: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=3, difficulty=000, 3HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320HelloWorld!3 : 9c5d769416aa0ca894abf22bd17bd30fbb6959291423ae1903a9f86a1fe7ce78....

13 / 87

Page 14: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=94, difficulty=000, 5HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320HelloWorld!3 : 9c5d769416aa0ca894abf22bd17bd30fbb6959291423ae1903a9f86a1fe7ce78....HelloWorld!94 : 7090a0e5d88cff635e42ea33fcd6091a058e9cdd58ab8cd5c21c1c70421e35c6

14 / 87

Page 15: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=95, difficulty=000, 2HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320HelloWorld!3 : 9c5d769416aa0ca894abf22bd17bd30fbb6959291423ae1903a9f86a1fe7ce78....HelloWorld!94 : 7090a0e5d88cff635e42ea33fcd6091a058e9cdd58ab8cd5c21c1c70421e35c6HelloWorld!95 : b74f3b2cf1061895f880a99d1d0249a8cedf223d3ed061150548aa6212c88d43

15 / 87

Page 16: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=96, difficulty=000, 4HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320HelloWorld!3 : 9c5d769416aa0ca894abf22bd17bd30fbb6959291423ae1903a9f86a1fe7ce78....HelloWorld!94 : 7090a0e5d88cff635e42ea33fcd6091a058e9cdd58ab8cd5c21c1c70421e35c6HelloWorld!95 : b74f3b2cf1061895f880a99d1d0249a8cedf223d3ed061150548aa6212c88d43HelloWorld!96 : 447ca2fa886965af084808d22116edde4383cbaa16fd1fbcf3db61421b9990b9

16 / 87

Page 17: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Hashcash Proof-of-Work

string=HelloWorld !, nonce=97, difficulty=000, 6HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106aHelloWorld!1 : b5690c48c2d0a09481186aaa99e4e090901ff2ac4d572e6706dfd30eefc22a27HelloWorld!2 : 5b6fd9c27fcb54ca23404d9428f081b7c9280ba6370e33a6a20b16f40ce76320HelloWorld!3 : 9c5d769416aa0ca894abf22bd17bd30fbb6959291423ae1903a9f86a1fe7ce78....HelloWorld!94 : 7090a0e5d88cff635e42ea33fcd6091a058e9cdd58ab8cd5c21c1c70421e35c6HelloWorld!95 : b74f3b2cf1061895f880a99d1d0249a8cedf223d3ed061150548aa6212c88d43HelloWorld!96 : 447ca2fa886965af084808d22116edde4383cbaa16fd1fbcf3db61421b9990b9HelloWorld!97 : 000ba61ca46d1d317684925a0ef070e30193ff5fa6124aff76f513d96f49349d

17 / 87

Page 18: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Block generation

Bitcoin minting = creating blocksComputationally hard. . .. . . but far from being impossibleResult : easy to checkGoal : find a valid PoW for the current blockchainAverage generation time : 10 minutes

18 / 87

Page 19: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain construction

1

Block !

1

Block !

1

Block !

1

Block !

1

Block !

1

Block !

1

Block !

A B C D E F G

(B0,⊥)

B1

B2

B3

B4

B5

B6

B7

B8

(B0,⊥)

B1

B2

B3

B4

B5

B6

(B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥)

Thanks to Romaric19 / 87

Page 20: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain construction

2 5 3 3 4 1 2

Block ! Block ! Block ! Block ! Block ! Block ! Block !

A B C D E F G

(B0,⊥)

B1

B2

B3

B4

B5

B6

B7

B8

(B0,⊥)

B1

B2

B3

B4

B5

B6

(B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥)

19 / 87

Page 21: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain construction

1

Block !

6

Block !

3

Block !

4

Block !

5

Block !

1

Block !

3

Block !

A B C D E F G

(B0,⊥)

B1

B2

B3

B4

B5

B6

B7

B8

(B0,⊥)

(B1,B)

B2

B3

B4

B5

B6

(B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥) (B0,⊥)

19 / 87

Page 22: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain construction

5 1 3 5 1 4 3

Block ! Block ! Block ! Block ! Block ! Block ! Block !

A B C D E F G

(B0,⊥)

(B1,B)

B2

B3

B4

B5

B6

B7

B8

(B0,⊥)

(B1,B)

B2

B3

B4

B5

B6

(B0,⊥)

(B1,B)

(B0,⊥)

(B1,B)

(B0,⊥)

(B1,B)

(B0,⊥)

(B1,B)

(B0,⊥)

(B1,B)

19 / 87

Page 23: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Blockchain construction

5 4 2 3 2 1 1

Block ! Block ! Block ! Block ! Block ! Block ! Block !

A B C D E F G

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

B6

B7

B8

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

B6

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

19 / 87

Page 24: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Transient inconsistencies

6 3 5 5 4 6 5

Block !

Block ! Block ! Block ! Block !

Block !

Block !

A B C D E F G

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B6,A)

B7

B8

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

B6

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B ′6,F )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

19 / 87

Page 25: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Transient inconsistencies

1 3 6 5 4 2 6

Block ! Block !

Block !

Block ! Block ! Block !

Block !A B C D E F G

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B6,A)

(B7,G )

B8

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B ′6,F )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B ′6,F )

(B ′7,C )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B ′6,F )

(B ′7,C )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B6,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B ′6,F )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,E )

(B6,A)

(B7,G )

19 / 87

Page 26: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

The longest chain is locally kept by every node

6 3 2 5 4 2 4

Block !

Block ! Block ! Block ! Block ! Block ! Block !

A B C D E F G

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

(B8,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

(B8,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

(B8,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

(B8,A)

(B0,⊥)

(B1,B)

(B2,E )

(B3,C )

(B4,A)

(B5,B)

(B6,A)

(B7,G )

19 / 87

Page 27: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Does Pow solves the consensus problem ?

It is frequently argued that because the set of miners succeed inreaching an agreement on the next block to append to theblockchain, Bitcoin solves the consensus problem in anasynchronous distributed system

In the remaining of the class we will see that in an asynchronoussystem there is no protocol that solves the consensus problem evenif a single node may crash

20 / 87

Page 28: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Asynchronous systemsTerminology

We consider distributed systems where processes cancommunicate and synchronize by exchanging messages(message-passing model).The system is composed of n processes usually denotedΠ = {p1, . . . , pn}.The system is asynchronous because there exists no bound :

neither on the relative speeds of processesnor on the communications speed.

21 / 87

Page 29: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Asynchronous SystemsWhy such a model ?

It is extremely simpleIf a problem can be solved in asynchronous systems, it can besolved in more constrained model (like synchronous systems orpartially synchronous systems)A solution to a problem P in this model can always be useddirectly in a more demanding model M

It will then benefit from the good properties exhibited bymodel MWhile at the same time being robust enough to tolerateviolations of the properties exhibited by model M

22 / 87

Page 30: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

ConsensusInformal specification

In this problem processes are trying to reach a consensus.Each process initially proposes a value v taken from a givenset of value V .At the end of the protocol, all processes agree on a singlevalue, called the decided value, or decision.This value must have been proposed by one of the processes.

23 / 87

Page 31: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

ConsensusSpecification

Each process has an initial value and at the end of the protocol, thefollowing must hold :

Termination : All correct processes must eventually decide avalue.Integrity : At most one decision per process.Agreement : All processes that decide (correct or not) mustdecide the same value.Validity : The value decided by a process must have beeninitially proposed. Distributed

24 / 87

Page 32: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

A simple consensus algorithm

1 propose(vi ) // algorithm run by process p_i2 {3 local_state = vi4 send (i , vi ) to all processes5 wait until n − 1 different messages of the

form (j , vj ) have been received6 di ← δ((1, v1), . . . , (n, vn) ∪ (i , vi ))7 return decide(di )8 }

25 / 87

Page 33: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

FLP impossibility result [FLP85]

Theorem (FLP impossibility result)

There exists no deterministic algorithm that solves the binaryconsensus problem in the presence of even if a single faulty process a

a. M. Fischer, N. Lynch, and M. Paterson. « Impossibility of distributedconsensus with one faulty process ». Journal of the ACM, 32(2) : 374-382, 1985

Binary consensus : processes have solely two possible input values« 0 » and « 1 »

26 / 87

Page 34: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Asynchronous Broadcast System

An asynchronous broadcast system consists of a set of processes1, . . . , n and a broadcast channel.

Each process pi has a one-bit input register xpi , and outputregister ypi with values in {0, 1, b}The state of process pi comprises the value of xpi , the value ofypi (and its program counter, and its internal storage...)Initial state of pi : xpi = 0 or xpi = 1 and ypi = b

Decision states : ypi = 0 or ypi = 1Transition function

deterministiccannot change the decision value (ypi is writable only once)

27 / 87

Page 35: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Processes communicate by exchanging messages

Processes communicate by sending messagesA message is a pair (p,m) where p is the recipient of m and mis some message value.The message system maintains a message buffer of messagesthat have been sent but not yet deliveredIt provides two operations

send(p,m) : places (p,m) in the message bufferreceive(p) :

delete some message (p,m) from the buffer and returns m topwe say that (p,m) is deliveredor return null and leave the buffer unchanged

28 / 87

Page 36: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Processes communicate by exchanging messages

Thus the message system acts in a non deterministic wayreceive(p) can return null even though a message (p,m)belongs to the bufferhowever if queried infinitely many times, every message (p,m)is eventually delivered

29 / 87

Page 37: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Configuration

A configuration (or global state) of the system consists of theinternal state of each process and the content of the messagebuffer

C = (s,B) with s = (s1, s2, . . . , sn)

An initial configuration is a configuration in which each processstarts at an initial state and the message buffer is empty

30 / 87

Page 38: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Step

A step takes one configuration to another and consists of an atomicset of actions by a single process p

Let C = (s,B) be a configurationp performs receive(p) on the message buffer in B of Cp delivers a value m ∈ {M, null}based on its local state in C and m, p enters a new state andsends a finite number of messagesC .e denotes the resulting configuration. We say that e can beapplied to C

31 / 87

Page 39: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Step

Since processes are deterministicthe step is completely determined by C and e = (p,m)

in the following the step e is also called an event (so an eventcan be though as the receipt of m by p)

32 / 87

Page 40: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Schedule

A schedule from a configuration C is a finite or infinitesequence σ of events that can be applied in turn from C .This sequence of steps is called a run.If σ is finite then the resulting configuration is denoted byC .σ. We say that it is reachable from C . A configurationreachable from an initial configuration is said accessible.In the following we only consider accessible configurations

33 / 87

Page 41: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Decision value

A configuration C has decision value v if some process p is ina decision state (i.e. yp = 0 or yp = 1)

34 / 87

Page 42: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Correct consensus protocol P

A consensus protocol is partially correct isIt does not exist an accessible configuration which has morethan one decision valueFor each value v ∈ {0, 1}, some accessible configuration hasdecision value v

A process is non faulty in a run provided it takes an infinite numberof steps. It is faulty otherwiseA run is admissible provided that at most one process is faulty andall messages have been deliveredA run is a deciding run provided that some process reaches adecision in that runA consensus protocol is correct despite a single fault if is partiallycorrect and every admissible run is a deciding run

35 / 87

Page 43: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Main result

TheoremNo consensus protocol is correct in spite of one fault

36 / 87

Page 44: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

All the following slides have been made in collaboration withFrédéric Tronel (Centrale-Supélèc).

37 / 87

Page 45: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Valence of configurations

The core of FLP argument is a strategy allowing the adversary(who controls the scheduling) to steer the execution away from anyconfiguration in which the processes reach agreement.

The strategy relies on the notion bivalence.

38 / 87

Page 46: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Valence of configurations

Let C be any configuration. Let V be the set of decision values ofconfigurations reachable from C

1 If V = {0} then C is said to be univalent or 0-valent2 If V = {1} then C is said to be univalent or 1-valent3 If V = 0, 1 then C is said to be bivalent

An execution σ is 0-valent if 0 is the only value that can ever bedecided by any process in σ.

An execution σ is bivalent if 0 appears in a decide state and 1appears in a decide state

39 / 87

Page 47: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Strategy of the adversary

Any configuration where some process decides is not bivalent.So if the adversary can keep the protocol in a bivalentconfiguration forever, then it can prevent the processes fromever deciding.

Strategy :1 Make the protocol start in a bivalent configuration C0 (we

must prove that such a configuration always exists)2 Choose only bivalent successor configurations (we must prove

that it is always possible)

40 / 87

Page 48: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Bivalent initializations

LemmaAny consensus protocol that tolerates at least one faulty processhas at least one bivalent configuration.

What does it means ?The final decision cannot be determined from just the inputsIf there are not failures, then it is simple to build a consensusalgorithm that have only univalent configurations

41 / 87

Page 49: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

42 / 87

Page 50: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

43 / 87

Page 51: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

44 / 87

Page 52: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

45 / 87

Page 53: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

46 / 87

Page 54: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

!

decide 0

process p does not take a stepsall processes must eventually decide

(1-failure tolerant protocol)

Since !"is 0-valent the decision state is 0

47 / 87

Page 55: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

There exists at least one bivalent configuration

Proof : By contradiction.Suppose that all the initial configurations are univalent.

!

decide0

both runs are identical except for the initial value of pi.

Thus all the remaining processesmust behave the same way and thus the decision state must be 0.

This is a contradiction since the execution is 1-valent

decide1

process pi does not take a stepsall processes must eventually decide

(1-failure tolerant protocol)

Since !"is 0-valent the decision state is 0

!

48 / 87

Page 56: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Bivalent extension

Bivalent extension Lemma

Let C be a bivalent configuration of the protocol, and lete = (p,m) be an event that is applicable to C .

Let C be the set of configurations reachable from C without doinge and without failing any process.

Let D be the set of configurations of the form C ′.e where C ′ ∈ C.

Then D contains a bivalent configuration.

Note that step e is always applicable in C sincee is applicable to CC is the set of configurations reachable from Cand messages can be delayed arbitrarily long

49 / 87

Page 57: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Proof of the bivalent extension lemma

The proof is by contradiction1 We assume that D contains only univalent configurations2 We prove that D contains both 0-valent and 1-valent

configurations D0 and D1

3 We prove that C contains two configurations C0 and C1 thatresp. lead to D0 and D1 by applying step e

4 We derive a contradiction

50 / 87

Page 58: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Proof of the bivalent extension lemma

We start from a bivalent configuration C (C exists by the firstlemma)

C

{0,1}

51 / 87

Page 59: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

There must exist a 0-valent configuration E0 reachable from C(recall that C is bivalent)

C{0,1}

E00-valent

52 / 87

Page 60: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

There must exist a 1-valent configuration E1 reachable from C(recall that C is bivalent)

C{0,1}

E00-valent

E11-valent

53 / 87

Page 61: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

Case 1 : If Ei belongs to C (that is step e is not applied along σi )then e can be applied to Ei

C{0,1}

E00-valent

E11-valent

e"∉"#0 e"∉"#1

C

e e

54 / 87

Page 62: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

Let Di be the configuration reached from Ei by application of stepe. Di is i-valent since Di belongs to D and by assumption Dcontains only univalent configurations.

C{0,1}

E00-valent

E11-valent

e"∉"#0 e"∉"#1

C

e e

D0 D1

D

0-valent 1-valent

55 / 87

Page 63: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

case 2 : Ei does not belong to C (that is step e has been appliedalong σi ).

C

{0,1}

E00-valent

E11-valent

e"∈"#0 e"∈"#1

56 / 87

Page 64: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

Thus there is a configuration Ci ∈ C such that step e is applied toCi and Di = Ci .e, with DiD.

C

{0,1}

E00-valent

E11-valent

e

C0

D0

C1

C

e

D1D

57 / 87

Page 65: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

By assumption D contains only univalent configurations. Thus Di isunivalent and since Di lead to Ei which is i-valent, Di is i-valent.

C

{0,1}

E00-valent

E11-valent

e

C0

D0

C1

C

e

D1D

0-valent 1-valent

58 / 87

Page 66: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

D contains both 0-valent and 1-valent configurations

So far we have shown that D contains both 0-valent and 1-valentconfigurations.

Definition :Configurations C0 and C1 are neighbor if one results from theother by application of a single step.

We want to prove that C contains two neighbor configurations C0and C1 that lead to D0 and D1 in D

59 / 87

Page 67: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

What do we want to prove ?

60 / 87

Page 68: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Let C be a bivalent configuration, and C0 reachable from C thatleads to D0 a 0-valent configuration of D by applying step e

CC0

e =(m,p)

D00-valent

61 / 87

Page 69: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Since step e is applicable from C then one can apply this step allalong the path from C to C0

CC0

e =(m,p)

D0

0-valent

e e e e e

62 / 87

Page 70: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

All these configurations belong to D. Hence they are all univalent.Some of them can be 0-valent as is D0

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent

63 / 87

Page 71: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

If one of them is 1-valent, we are done. We have found the hook wewere looking for.

CC0

e =(m,p)

D00-valent

C'0 C'1

e e e e e

D'0 D'1

0-valent 0-valent 1-valent

e'

64 / 87

Page 72: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Otherwise all of them of 0-valent.

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

65 / 87

Page 73: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Then consider C1 a configuration in C reachable from C that leadsto D1 a 1-valent configuration in D by applying step e

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

e

66 / 87

Page 74: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Since step e is applicable from C then one can apply this step allalong the path from C to C1

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

eee e e e

67 / 87

Page 75: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

All these configurations belong to D. Hence they are all univalent.Some of them can be 1-valent as is D1

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

eee e e e

1-valent

68 / 87

Page 76: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

If one of them is 0-valent, we are done. We have found the hook wewere looking for.

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C'0 C'1 C1

D1

1-valent

ee

D'1

e e e e

D'0

1-valent0-valent

e'

69 / 87

Page 77: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Otherwise all of them of 1-valent.

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

eee e e e

1-valent1-valent1-valent

70 / 87

Page 78: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

The hook we are looking for is located at configuration C . Let usapply step e to C

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

eee e e e

1-valent1-valent1-valent

e

71 / 87

Page 79: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Either this configuration of D is 0-valent, and thus we can identifythe hook we were looking for

CC0

e =(m,p)

D0

0-valent

e e e e e

0-valent 0-valent 0-valent

C1

D1

1-valent

eee

D1

e e e

1-valent1-valent1-valent

D0

e

0-valent

e'

72 / 87

Page 80: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Two neighbor configurations C0 and C1 in C exist

Or this configuration of D is 1-valent, and thus we can identify thehook we were looking for

CC0

e =(m,p)

D0

0-valent

C'0

e e e e e

D'0

0-valent 0-valent 0-valent

C1

D1

1-valent

eee e e e

1-valent1-valent1-valent

D'1

e

1-valent

e'

73 / 87

Page 81: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Where have we been so far ?

74 / 87

Page 82: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Where have we been so far ?

We are almost done. We need to consider two cases :1 either p 6= p′

2 or p = p′

75 / 87

Page 83: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p 6= p′

Since p is different from p′ then steps e and e ′ do not interactSteps e ′ can be applied to configuration D0Thus D0.e

′ = D1 which closes the diamondWe get a contradiction since a 0-valent configuration cannot leadto a 1-valent configuration.

76 / 87

Page 84: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

77 / 87

Page 85: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Let σ be an execution that can be applied to C0 such that1 All the processes decide2 Except p that does not make any step in σ (the protocol

tolerates one crash thus it must allow n − 1 processes todecide)Let A = C0.σ be such a decision configurationBy the validity property of the consensus protocol,configuration A must be univalent

78 / 87

Page 86: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Since p takes no step in σ, σ can be applied to D0 and to D1

79 / 87

Page 87: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Leading to a 0-valent configuration E0 and 1-valent configurationE1

80 / 87

Page 88: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Now the adversary allows p to make its step e from configurationA. This leads to configuration E0 = A.e by applying the sameargument as before.

81 / 87

Page 89: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Thus configuration A must be 0-valent

82 / 87

Page 90: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Both e ′ and e can be applied to configuration A and leads toE1 = A.e ′.e.

83 / 87

Page 91: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

p = p′

Thus A must be 1-valent. But A is 0-valent. A contradiction

84 / 87

Page 92: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

What we have shown

There exists at least one initial configuration which is bivalent.We start our infinite execution from this configuration C

By applying the bivalent extension lemma, we can alwaysextend a finite execution made up of bivalent configurationswith another execution also made up of bivalent configurationswith the step of a given process.We can repeat this step with each process infinitely oftenBut no process will ever decide.

85 / 87

Page 93: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

FLP impossibility result

This theorem is so far the most fundamental one for the fieldof fault-tolerant distributed computingThis work has received the Edsger W. Dijkstra Prize inDistributed Computing prize in 2001.

86 / 87

Page 94: EmmanuelleAnceaume Lesson2 ...people.rennes.inria.fr/Eric.Fabre/Module MAD/lesson2.pdf · HashcashProof-of-Work string=HelloWorld!,nonce=96,difficulty=000, 4 HelloWorld!0 : 3f6fc92516327a1cc4d3dca5ab2b27aeedf2d459a77fa06fd3c6b19fb609106a

Any questions ?