Blockchain Lecture#1
Blockchain Lecture#1
Attack:
Applications:
15%
Quizzes
30%
Assignments/Project(Phases)
35%
Final Exam
Lecture 1
Intro to Crypto and Cryptocurrencies
Slide Credit: Joseph Bonneau (team), Princeton University, US
This lecture
Crypto background
hash functions
digital signatures
… and applications
Intro to cryptocurrencies
basic digital cash
Lecture 1.1: Cryptographic
function:
takes any string as input fixed-
size output (we’ll use 256 bits)
efficiently computable Security
properties: collision-free hiding
puzzle-friendly
Hash property 1: Collision-free
Nobody can find x and y such that
x != y and H(x)=H(y)
x
H(x) = H(y)
possible outputs
possible inputs
… but can anyone find them?
How to find a collision
easy to find x!
H(“heads”)
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.
c c c
IV Hash
H( )
(data) will draw hash pointers like this
key idea:
H( )
use
case: tamper-evident log
Just remember the last hashpointer to detect tampering
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
algorithms
sig := sign(sk, message) isValid :=
challenger attacker
m0
sign(sk, m0)
m1
sign(sk, m1)
...
M, sig
M not in { m , m , … }
0 1
verify(pk, M, sig)
Keys as Identities
== an identity
if you see sig such that verify(pk, msg, sig)==true,
think of it as pk says, “[msg]”.
of coordination
These identities are called “addresses” in Bitcoin.
Privacy
Addresses not directly connected to real-world identity.
Cryptocurrencies
GoofyCoin
Goofy can create new coins
New coins belong to me.
signed by pkGoofy
CreateCoin [uniqueCoinID]
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
Pay to pkBob : H( )
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
double-spending attack
signed by pkAlice signed by pkAlice
Pay to pkBob : H( ) Pay to pkChuck : H( )
signed by pkGoofy
Pay to pkAlice : H( )
signed by pkGoofy
CreateCoin [uniqueCoinID]
double-spending attack
transID: 73 type:CreateCoins
coins created
num value recipient
Valid if:
consumed coinIDs: -- consumed coins valid,
68(1), 42(0), 72(3) -- not already consumed,
-- total value out = total value in, and
coins created -- signed by owners of all consumed coins