Bitcoin MOOC Lecture 1
Bitcoin MOOC Lecture 1
special guest:
Joseph Bonneau Ed Felten Arvind Narayanan
Andrew Miller
This lecture
Crypto background
hash functions
digital signatures
… and applications
Intro to cryptocurrencies
basic digital cash
Lecture 1.1:
H(x) = H(y)
y
Collisions do exist ...
possible outputs
possible inputs
H(“heads”)
easy to find x!
H(“tails”)
Hash property 2: 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: 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.
Application: Search puzzle
Given a “puzzle ID” id (from high min-entropy distrib.),
and a target set Y:
Try to find a “solution” x such that
H(id | x) ∈ Y.
c c c
IV Hash
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
Digital Signatures
What we want from signatures
challenger attacker
m0
sign(sk, m0)
m1
sign(sk, m1)
...
M, sig
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
transID: 73 type:PayCoins
consumed coinIDs:
68(1), 42(0), 72(3)
Valid if:
coins created -- consumed coins valid,
-- not already consumed,
num value recipient
-- total value out = total value in, and
0 3.2 0x... -- signed by owners of all consumed coins
1 1.4 0x...
2 7.1 0x...
signatures
Immutable coins
Crucial question: