Bitcoin MOOC Lecture 1
Bitcoin MOOC Lecture 1
Bitcoin MOOC Lecture 1
H(x) = H(y)
y
Collisions do exist ...
possible outputs
possible inputs
H(“heads”)
easy to find x!
H(“tails”)
Hash property 2: Pre-image
resistance (Hiding)
Hiding property:
If r is chosen from a probability distribution that has high
min-entropy, then given H(r | x), it is infeasible to find x.
Security properties:
Hiding: Given com, infeasible to find msg.
Binding: Infeasible to find msg != msg’ such that
verify(commit(msg), msg’) == true
Commitment API
commit(msg) := ( H(key | msg), H(key) )
where key is a random 256-bit value
verify(com, key, msg) := ( H(key | msg) == com )
Security properties:
Hiding: Given H(key | msg), infeasible to find msg.
Binding: Infeasible to find msg != msg’ such that
H(key | msg) == H(key | msg’)
Hash property 3: Second Pre-image
resistance Puzzle-friendly
Puzzle-friendly:
For every possible output value y,
if k is chosen from a distribution with high min-entropy,
then it is infeasible to find x such that H(k | x) = y.
Second Pre-image resistance
● Means given an input and its hash, it should be hard to
find a different input with the same hash.
○ if a hash function h for an input x produces hash value
h(x), then it should be difficult to find any other input
value y such that h(y) = h(x).
c c c
IV Hash
H( )
(data) will draw hash pointers like this
key idea:
H( )
H( )
H( ) H( )
H( ) H( ) H( ) H( )
H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( )
H( ) H( )
(data)
Advantages of Merkle trees
● Tree holds many items but just need to remember the root hash
● Can verify membership in O(log n) time/space
● Variant: sorted Merkle tree where the blocks are ordered at the
bottom can verify non-membership in O(log n) (show items
before, after the missing one)
● Proof of Non-membership: simply by showing a path to the item
that’s just before where the item in question would be and
showing the path to the item that is just after where it would be
More generally ...
Digital Signatures
What we want from signatures
Simple Cryptocurrencies
GoofyCoin
Goofy can create new coins
signed by pkGoofy
CreateCoin [uniqueCoinID]
A coin’s owner can spend it.
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
The recipient can pass on the coin again.
Pay to pkBob : H( )
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
double-spending attack
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
double-spending attack
transID: 73 type:CreateCoins
coins created
num value recipient