Module 1
Module 1
Component Weightage
CAT1 15
CAT2 15
DA 30
TERM End Exam 40
---------
Total 100
3
CSE1066 Block Chain and Crypto Currency Technologies LTPJC 30003
Pre-requisite: Nil
2. Franco, P. (2014). Understanding Bitcoin: Cryptography, engineering and economics. John Wiley and
Sons.
Mode of Evaluation: CAT/ Assignment / Quiz / FAT / Project /Seminar
5
Expected Outcome
Course Objectives
To understand the mechanism of Blockchain and Cryptocurrency.
To understand the functionality of current implementation of blockchain technology
To understand the required cryptographic background.
To explore the applications of Blockchain to cryptocurrencies and
The first property that we need from a cryptographic hash function is that
it’s collision‐resistant
A collision occurs when two distinct inputs produce the same output.
A hash function H(.) is collision‐resistant if nobody can find a collision
Collision‐resistance: A hash function H is said to be collision resistant if it
is infeasible to find two values, x and y , such that x ≠ y , yet H(x) = H(y) .
11
If we randomly choose just 2130 + 1 inputs, it turns out there’s a 99.8% chance that
long time to do
For a hash function with a 256‐bit output, you would have to compute the hash function
2256 + 1 times in the worst case, and about 2128 times on average
If a computer calculates 10,000 hashes per second, it would take more than one octillion
com := commit( msg, nonce ) The commit function takes a message and
secret random value, called a nonce, as input and returns a commitment.
verify( com, msg, nonce ) The verify function takes a commitment, nonce,
and message as input. It returns true if com == commit( msg , nonce ) and
false otherwise
The following two security properties should hold:
Hiding : Given com , it is infeasible to find msg
Binding : It is infeasible to find two pairs (msg, nonce) and (msg’, nonce’)
such that msg ≠ msg’ and commit( msg, nonce ) == commit( msg’, nonce’ )
Every time you commit to a value, it is important that you choose a new
random value nonce . In cryptography, the term nonce is used to refer to a
value that can only be used once
18
Commitment API
(com,key):= commit(msg)
match:= verify(com,key,msg)
To seal message in envelope:
Intuition: If someone wants to target the hash function to come out to some
particular output value y , that if there’s part of the input that is chosen in a
suitably randomized way, it’s very difficult to find another value that hits
exactly that target.
21
Application Search Puzzle
Intuition :
If H has an n‐bit output, then it can take any of 2n values
Solving the puzzle requires finding an input so that the output falls within
the set Y, which is typically much smaller than the set of all outputs
The size of Y determines how hard the puzzle is ; if Y is the set of all n‐bit
strings the puzzle is trivial, whereas if Y has only 1 element the puzzle is
maximally hard
The fact that the puzzle id has high min‐entropy ensures that there are no
shortcuts
On the contrary, if a particular value of the ID were likely, then someone
could cheat, say by pre‐computing a solution to the puzzle with that ID.
23
Even though the Merkle tree hold many items, it is important to remember
root hash
Can verify membership in O(log n) time/space
Digital Signature
Need of Digital Signature 35
Clara would simply have to create a message and append an authentication code
using the key that Ben and Clara share.
Ben can deny sending the message. Because it is possible for Clara to forge a
message, there is no way to prove that Ben did in fact send the message.
Both scenarios are of legitimate concern. Ex: Electronic Fund transfer, Stock
broker transaction
36
Digital Signature Properties
In situations where there is not complete trust between each other (sender
and receiver), something more than authentication is needed; an elegant
solution is the digital signature
Properties of digital signature:
It must verify the author and the date and time of the signature and
verifiable by third parties in case of disputes
It must authenticate the contents at the time of the signature
Digital Signature Requirements 37
The signature must be a bit pattern that depends on the message being signed.
The signature must use some information only known to the sender to prevent
Verify
If I sign a message with sk , my secret key, and someone later tries to
validate that signature over that same message using my public key, pk ,
the signature must validate correctly
Unforegeability
an adversary who knows your public key and gets to see your signatures
on some other messages can’t forge your signature on some message for
which he has not seen your signature
40
Unforgeability Game
41
A signature scheme is unforgeable if and only if, no matter what algorithm the
adversary is using, his chance of successfully forging a message is extremely
small
42
Practical Concerns
Many signature algorithms are randomized (in particular the one used in
Bitcoin) and we therefore need a good source of randomness
The importance of this really can’t be underestimated as bad randomness
will make algorithm insecure
It is better to use a cryptographic hash function with a 256‐bit output, then
we can effectively sign a message of any length as long as our signature
scheme can sign 256‐bit messages
It’s safe to use the hash of the message as a message digest in this manner
since the hash function is collision resistant
43
Elliptic Curve Digital Signature Algorithm (ECDSA)
If you see sig such that verify(pk,msg,sig) = = true, think of it as pk says, [“msg”]
In practice, you may use the hash of pk as your identity since public keys are large
In order to verify that a message comes from your identity, one will have to check
(1) that pk indeed hashes to your identity, and (2) the message verifies under public
key pk .
45
Decentralized Key Management
To create a coin, Goofy generates a unique coin ID that he’s never generated before
and constructs the string “CreateCoin [ uniqueCoinID ]”
He then computes the digital signature of this string with his secret signing key
Anyone can verify that the coin contains Goofy’s valid signature of a CreateCoin
statement, and is therefore a valid coin
50
51
Double Spending Attacks
Goofy can create new coins by simply signing a statement that he’s making
a new coin with a unique coin ID
Whoever owns a coin can pass it on to someone else by signing a
statement that saying, “Pass on this coin to X” (where X is specified as a
public key)
Anyone can verify the validity of a coin by following the chain of hash
pointers back to its creation by Goofy, verifying all of the signatures along
the way
53
54
Scoorge Coin
Since Scoorge add this value of coin and recipient in to the history, hence it
is valid
58
Immutable Coins 59
Coins in this system are immutable — they are never changed, subdivided,
or combined
Each coin is created, once, in one transaction and later consumed in some
other transaction
But we can get the same effect as being able to subdivide or combine coins
by using transactions
Example, to subdivide a coin, Alice create a new transaction that consumes
that one coin, and then produces two new coins of the same total value;
those two new coins could be assigned back to her
60
Problem on Scoorge Coin