Byzantine Generals Problem & FLP Impossibility Addendum Sep. - - PowerPoint PPT Presentation

byzantine generals problem flp impossibility
SMART_READER_LITE
LIVE PREVIEW

Byzantine Generals Problem & FLP Impossibility Addendum Sep. - - PowerPoint PPT Presentation

Byzantine Generals Problem & FLP Impossibility Addendum Sep. 4th, 2019 Byzantine Fault Tolerance Given 6 Generals: 4 Loyal General, 2 Traitor Why is a solution for this impossible? 1 1 G Each loyal general receives 3 0 correct


slide-1
SLIDE 1

Byzantine Generals Problem & FLP Impossibility

Addendum

  • Sep. 4th, 2019
slide-2
SLIDE 2

Byzantine Fault Tolerance

  • Given 6 Generals: 4 Loyal General, 2 Traitor
  • Why is a solution for this impossible?

G

Each loyal general receives 3 correct values and 2 wrong values => No problem 1 1 1 1

slide-3
SLIDE 3

Byzantine Fault Tolerance

  • Given 6 Generals: 4 Loyal General, 2 Traitor
  • Problem occurs when a traitor needs to send messages
  • Other traitors can mirror the general

G

Two of the loyal generals receive 3 times the value 0

slide-4
SLIDE 4

Byzantine Fault Tolerance

  • Given 6 Generals: 4 Loyal General, 2 Traitor
  • Problem occurs when a traitor needs to send messages
  • Other traitors can mirror the general

G 1 1

Two of the loyal generals receive 3 times the value 0 1 1 1 1 1 1 Two of the loyal generals receive 3 times the value 1

G

1 1

  • 1
slide-5
SLIDE 5

Byzantine Fault Tolerance

  • Given 6 Generals: 4 Loyal General, 2 Traitor
  • Problem occurs when a traitor needs to send messages
  • Other traitors can mirror the general

G 1 1

Two of the loyal generals receive 3 times the value 0 1 1 1 1 1 1 Two of the loyal generals receive 3 times the value 1

G

0 0 Not all loyal generals use the same value v(i) for a traitorous general 1 1 1 1 1 1 1 1 1 1

slide-6
SLIDE 6

Take away “FLP Result”

Fault tolerance termination (also called liveness, aka “we make progress”) Consensus (also called “safety”, or “agreement”,

  • aka. “we all do the same”)

pick 2

slide-7
SLIDE 7

Take away “FLP Result”

Fault tolerance termination (also called liveness, aka “we make progress”) Consensus (also called “safety”, or “agreement”,

  • aka. “we all do the same”)

pick 2

Blockchains that switch to the longest chain trade consensus for probabilistic finality Basic blockchains where participants simply build

  • n top of the existing

block do not care about contenders

slide-8
SLIDE 8

Cryptography Essentials and Data Structures

Sep 4, 2019

slide-9
SLIDE 9

Today’s goal

  • At the end of the next lecture, we will present the first homework:
  • Build a simple blockchain
  • Verify ownership
  • Verify inclusion of data
  • For this, we need certain cryptographic tool and
  • Hash function
  • Cryptographic Signatures
  • Merkle-Trees
  • Block chains
slide-10
SLIDE 10

Hash

  • Any arbitrary data (text, images, videos, etc.) can be represented as a

sequence of 0 and 1, written as

  • A hash is a function

that maps arbitrary input to a certain value of bits

  • Can be used to verify data integrity or as data structure
  • A

= dataElement

{0,1}n ℋ : {0,1}n → {0,1}m m [ℋ(dataElement)]

“San Jose is a large city surrounded by rolling hills in Silicon Valley, a major technology hub in California's Bay Area.”

slide-11
SLIDE 11

Hash

  • Examples:
  • Modulo

(amount of 1’s mod n)

  • MD5
  • MD5("The quick brown fox jumps over the lazy dog")

= 0x9e107d9d372bb6826bd81d3542a419d6

ℋ : {0,1}n → {0,1}m

slide-12
SLIDE 12

Cryptographic Hash

  • Requirements:

easy to compute

  • finding (pre-image) so that

impossible*

  • Such functions are called
  • One-way functions
  • trapdoor functions

ℋ(x) x ℋ(x) = y

*in a reasonable amount of time

slide-13
SLIDE 13

Cryptographic Hash

  • Examples

Name Year Output size considered safe? MD2 1989 128 bits no MD5 1992 128 bits no RadioGatún 2006 unlimited first 304 bits SHA3 2015 224/256/384/512 yes

slide-14
SLIDE 14
  • Output value shall be as unpredictable as possible
  • changing the input by 1 bit should change each output

bit with a probability of 50%

  • Hash("The quick brown fox jumps over the lazy dog")
  • 0x 730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525
  • Hash("The quick brown fox jumps over the lazy dog.")
  • 0x 619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4c

Cryptographic Hash

slide-15
SLIDE 15

Sponge-based Hash approaches

  • State of the art, e.g. SHA3
  • Absorb data, Squeeze out result
  • One pass over the data is needed, usable for data streams
slide-16
SLIDE 16

Hashes as building blocks

  • Use the one-way property of hash functions
  • Encryption (later)
  • Proof of list membership
  • Show that an element was part of a record
slide-17
SLIDE 17

List Membership Proof

  • Proof that a record was part of a collection
  • How to put stuff on the blockchain
  • Prove existence by pointing to the item within the record

If an item does not

  • ccur in our records, it doesn’t

exist

slide-18
SLIDE 18

List Membership Proof

  • Proof that a record was part of a collection
  • How to put stuff on the blockchain
  • Examples
  • Assume we store every day list of every person born.
  • How this be used as birth certificate?
  • A set of transactions happened in a block
  • How can I proof a specific transaction?
  • I published a great idea (as a patent/on the internet, etc.)
  • How can I prove that it was published
slide-19
SLIDE 19

Naive Membership Proof

  • Proof that a record was part of a collection
  • Approach:
  • Assemble the (ordered) list of all entries
  • store for every day the hash of that list.

Date Hash of list 1 April 1990 0x A4356DE2… 2 April 1990 0x 5BB823A… 3 April 1990 0x 40A03C1… 4 April 1990 0x 563FE22…

slide-20
SLIDE 20

Naive Membership Proof

  • Proof of Membership:
  • publish list of all entries
  • Point to entry in question

1 April 1990 2 April 1990 … …

slide-21
SLIDE 21

Naive Membership Proof

  • Proof of Membership:
  • publish list of all entries
  • Point to entry in question
  • Serves the purpose
  • Everybody can verify that
  • The record in question is in the list
  • The hash of the entire list corresponds to the publicly

known value

  • Not very efficient
  • The space needed to store/transmit a proof is the size of all

entries together

  • Computation complexity is one Hash of a (large) list
slide-22
SLIDE 22

List Membership Proof

Can we do better?

slide-23
SLIDE 23

Merkle-Tree

ABC DEF GHI JKL MNO PQR

h1 = ℋ(

)

ABC h2 = ℋ(

)

DEF h3 = ℋ(

)

GHI h4 = ℋ(

)

JKL h5 = ℋ(

)

MNO h6 = ℋ(

)

PQR

h1,2 = ℋ(h1|h2) h3,4 = ℋ(h3|h4) h5,6 = ℋ(h5|h6)

h12,34 = ℋ(h1,2|h3,4) h56,78 = ℋ(h5,6 h

h1234,5678 = ℋ(h12,34|h56,78)

slide-24
SLIDE 24

Merkle Tree

  • Compute the binary hash tree
  • Start with hashing all entries (as leafs)
  • Build the tree from the leafs to the root
  • The value of each node is the hash of the 2 children

def buildMerkleTree(listOfElement, posLeft, posRight): # if we are at a leaf if (posLeft == posRight): return HASH(listOfElement[posLeft]) centerElement = (posLeft+posRight)/2 leftHash = buildMerkleTree(listOfElement, posLeft, centerElement) rightHash = buildMerkleTree(listOfElement, centerElement+1, posRight) return HASH(leftHash + rightHash)

slide-25
SLIDE 25

Merkle Tree

ABC DEF GHI JKL MNO PQR STU VWX 902fbdd 822dd49 81fe8a9 c0abbff 9500c76 cda131d ec62361 697821b 956878910d85 822d73d3f596 ec0e9d8e9448 80e3665aeab5 9241c2f596b7bf2d2 8bfe92e5f8ac627777 0b768f11c4302d1354

slide-26
SLIDE 26

Merkle Tree

  • Consider the paths in the tree from the root to a leaf

ABC DEF GHI JKL MNO PQR STU VWX 902fbdd 822dd49 81fe8a9 c0abbff 9500c76 cda131d ec62361 697821b 956878910d85 822d73d3f596 ec0e9d8e9448 80e3665aeab5 9241c2f596b7bf2d2 8bfe92e5f8ac627777 0b768f11c4302d1354

slide-27
SLIDE 27

Merkle Tree

  • Prover publishes the following proof:
  • Consider the Merkle Tree with root “0b768f11c4302d1354”
  • The root can be constructed via

0b768f11c4302d1354 = h(9241c2f596b7bf2 + 8bfe92e5f8ac627777)

  • The left child can be constructed via

9241c2f596b7bf2d2d = h(956878910d853ef + 822d73d3f596c05538)

  • The right child can be constructed via

822d73d3f596c05538 = h(81fe8a9f162d7d7 + c0abbff7cfaca6720f)

  • The left child can be constructed via

81fe8a9f162d7d7 = h(“GHI”)

slide-28
SLIDE 28

Merkle Tree

  • Given a good hash function, nobody can find a pre-image of a hash
  • A statement such as can be constructed via

9241c2f596b7bf2d2d = h(956878910d853ef + 822d73d3f596c05538)

can only be recorded during the creation process, but not inferred at a later point.

  • Correct paths (proofs of membership) cannot be faked
  • Invalid paths can easily be detected
  • Efficiency:
  • Proof size is 2*sizeOf(Hash) at each node, path length is log(n)

much better than naive way

O(log n) O(n)

slide-29
SLIDE 29

Merkle Tree Proof Security

  • Merkle Trees are computationally as secure as the hash

function

  • for older hash functions (e.g. MD5) it is possible to find

collisions

  • I can publish an valid proof that my data is in the

record, even though it is not

  • modern hash functions (e.g. SHA3) are still fine
slide-30
SLIDE 30

Block chain

slide-31
SLIDE 31

Blockchain

  • A block chain build upon the idea that

the preimage of a hash cannot be computed.

  • A data-holding blockchain needs at

least 2 entries

  • History in a blockchain can be

traced backward through a link to the hash of the previous block

  • Data can be “put on the

blockchain” by saving the root hash

  • f a Merkle-Tree

4b3e14a82aa76bd45 f4a6abaef7e8c06038 f7cfaca6720f66b1ad 0f66b118113fde0d5 caea329c95c8fe288a b36beccadac2a246a d2b1df0c4f7b4a5d23 66b18113fde0d5245

slide-32
SLIDE 32

Cryptographic Signatures

Alice pk sk

  • secret key, data

that only Alice knows

sk

  • public key, data that

everybody knows

pk

slide-33
SLIDE 33

Cryptographic Signatures

Alice pk sk Bob

share public key

pk

slide-34
SLIDE 34

Cryptographic Signatures

Alice Bob

sk 0xA43B3E87… s=sign(m,sk) message m pk signature s

slide-35
SLIDE 35

Cryptographic Signatures

Alice Bob

sk 0xA43B3E87… s=sign(m,sk) message m send message send signature signature s

slide-36
SLIDE 36

Cryptographic Signatures

Alice Bob

sk 0xA43B3E87… s=sign(m,sk) message m pk send message send signature verify(m,s,pk) signature s

slide-37
SLIDE 37

Use of signature

  • Python

from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from Crypto import Random plaintext = "This is a text by me" rng = Random.new().read RSAkey = RSA.generate(1024, rng) # This may take a while... hash = SHA256.new(plaintext).digest() signature = RSAkey.sign(hash, rng) #RSAkey.verify(hash, signature) # This sig will check out #RSAkey.verify(hash[:-1], signature) # This sig will fail

Python Cryptography Toolkit, https://www.dlitz.net/software/pycrypto/doc/

slide-38
SLIDE 38

Summary

  • Background for the homework:
  • Build a simple blockchain
  • Verify ownership
  • Verify inclusion of data
  • Cryptographic tools
  • Hash function
  • Cryptographic Signatures
  • Merkle-Trees
  • Block chains