Byzantine Generals Problem & FLP Impossibility
Addendum
- Sep. 4th, 2019
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
Addendum
G
Each loyal general receives 3 correct values and 2 wrong values => No problem 1 1 1 1
G
Two of the loyal generals receive 3 times the value 0
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
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
Fault tolerance termination (also called liveness, aka “we make progress”) Consensus (also called “safety”, or “agreement”,
Fault tolerance termination (also called liveness, aka “we make progress”) Consensus (also called “safety”, or “agreement”,
Blockchains that switch to the longest chain trade consensus for probabilistic finality Basic blockchains where participants simply build
block do not care about contenders
Sep 4, 2019
sequence of 0 and 1, written as
that maps arbitrary input to a certain value of bits
= 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.”
(amount of 1’s mod n)
= 0x9e107d9d372bb6826bd81d3542a419d6
ℋ : {0,1}n → {0,1}m
easy to compute
impossible*
ℋ(x) x ℋ(x) = y
*in a reasonable amount of time
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
bit with a probability of 50%
If an item does not
exist
Date Hash of list 1 April 1990 0x A4356DE2… 2 April 1990 0x 5BB823A… 3 April 1990 0x 40A03C1… 4 April 1990 0x 563FE22…
…
1 April 1990 2 April 1990 … …
known value
entries together
Can we do better?
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)
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)
ABC DEF GHI JKL MNO PQR STU VWX 902fbdd 822dd49 81fe8a9 c0abbff 9500c76 cda131d ec62361 697821b 956878910d85 822d73d3f596 ec0e9d8e9448 80e3665aeab5 9241c2f596b7bf2d2 8bfe92e5f8ac627777 0b768f11c4302d1354
ABC DEF GHI JKL MNO PQR STU VWX 902fbdd 822dd49 81fe8a9 c0abbff 9500c76 cda131d ec62361 697821b 956878910d85 822d73d3f596 ec0e9d8e9448 80e3665aeab5 9241c2f596b7bf2d2 8bfe92e5f8ac627777 0b768f11c4302d1354
0b768f11c4302d1354 = h(9241c2f596b7bf2 + 8bfe92e5f8ac627777)
9241c2f596b7bf2d2d = h(956878910d853ef + 822d73d3f596c05538)
822d73d3f596c05538 = h(81fe8a9f162d7d7 + c0abbff7cfaca6720f)
81fe8a9f162d7d7 = h(“GHI”)
9241c2f596b7bf2d2d = h(956878910d853ef + 822d73d3f596c05538)
can only be recorded during the creation process, but not inferred at a later point.
much better than naive way
O(log n) O(n)
function
collisions
record, even though it is not
the preimage of a hash cannot be computed.
least 2 entries
traced backward through a link to the hash of the previous block
blockchain” by saving the root hash
4b3e14a82aa76bd45 f4a6abaef7e8c06038 f7cfaca6720f66b1ad 0f66b118113fde0d5 caea329c95c8fe288a b36beccadac2a246a d2b1df0c4f7b4a5d23 66b18113fde0d5245
Alice pk sk
that only Alice knows
sk
everybody knows
pk
Alice pk sk Bob
share public key
pk
Alice Bob
sk 0xA43B3E87… s=sign(m,sk) message m pk signature s
Alice Bob
sk 0xA43B3E87… s=sign(m,sk) message m send message send signature signature s
Alice Bob
sk 0xA43B3E87… s=sign(m,sk) message m pk send message send signature verify(m,s,pk) signature s
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/