lecture 2: bitcoin and cryptocurrency ras dwivediintroduction to blockchain lecture 2: bitcoin and...

181
Introduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 1 / 43

Upload: others

Post on 04-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Introduction to BlockchainLecture 2: Bitcoin and Cryptocurrency

Ras Dwivedi

Indian Institute of Technology Kanpur

May 22, 2018

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 1 / 43

Page 2: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Outline

1 Recap

2 Hash Functions

3 Digital Signature

4 Cryptocurrency

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 2 / 43

Page 3: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Outline

1 Recap

2 Hash Functions

3 Digital Signature

4 Cryptocurrency

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 3 / 43

Page 4: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 5: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adleman

choose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 6: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, q

calculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 7: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pq

calculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 8: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)

choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 9: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1

calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 10: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ

−→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 11: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 12: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo n

encryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 13: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod n

decryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 14: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 15: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

RSA

proposed by Rivest,Shamir,Adlemanchoose two large distinct prime number p, qcalculate n = pqcalculate φ = lcm(p − 1, q − 1)choose e such that gcd(e, φ) = 1calculate d such that d = e−1modφ −→ e × d = 1 mod φ

Idea: me×d = med = m modulo nencryption: c = me mod ndecryption: p = cd mod n

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 4 / 43

Page 16: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the document

nobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 17: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the document

simple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 18: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not work

IDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 19: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSA

for document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 20: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuine

d is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 21: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 22: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and if m = se mod n, signature is genuined is called Alice’s secret key and e is called Alice’s Public key

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 5 / 43

Page 23: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 24: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!

given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 25: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculated

given document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 26: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.

Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 27: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 28: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocument

slowWhat could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 29: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 30: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Is the Scheme secure?

No!given (n, e) private key of Alice cannot be calculatedgiven document m, s = md could not be guessed.Problem: forging given m1,m2 as two document, and s1, s2 as theirdigital signature, one can find the valid signature of m1.m2 as s1.s2

Also the length of the signature is proportional to the size of thedocumentslow

What could we do now?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 6 / 43

Page 31: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

SHA: Secure Hash Functions

An Ideal Hash function is one which has following propertiesgiven f (x) it is impossible to guess x

given x1 its is impossible to find x2 such that f (x1) = f (x2)it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 7 / 43

Page 32: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

SHA: Secure Hash Functions

An Ideal Hash function is one which has following propertiesgiven f (x) it is impossible to guess xgiven x1 its is impossible to find x2 such that f (x1) = f (x2)

it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 7 / 43

Page 33: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

SHA: Secure Hash Functions

An Ideal Hash function is one which has following propertiesgiven f (x) it is impossible to guess xgiven x1 its is impossible to find x2 such that f (x1) = f (x2)it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 7 / 43

Page 34: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Merkle Demgrad Construction

Need of Padding message m?

m is prefix of PAD(m)if |m1| = |m2| then |PAD(m1)| = |PAD(m2)|if |m1| 6= |m2| then the last block of PAD(m1) 6= PAD(m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 8 / 43

Page 35: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Merkle Demgrad Construction

Need of Padding message m?m is prefix of PAD(m)

if |m1| = |m2| then |PAD(m1)| = |PAD(m2)|if |m1| 6= |m2| then the last block of PAD(m1) 6= PAD(m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 8 / 43

Page 36: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Merkle Demgrad Construction

Need of Padding message m?m is prefix of PAD(m)if |m1| = |m2| then |PAD(m1)| = |PAD(m2)|

if |m1| 6= |m2| then the last block of PAD(m1) 6= PAD(m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 8 / 43

Page 37: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Merkle Demgrad Construction

Need of Padding message m?m is prefix of PAD(m)if |m1| = |m2| then |PAD(m1)| = |PAD(m2)|if |m1| 6= |m2| then the last block of PAD(m1) 6= PAD(m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 8 / 43

Page 38: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Recap

Merkle Demgrad Construction

Need of Padding message m?m is prefix of PAD(m)if |m1| = |m2| then |PAD(m1)| = |PAD(m2)|if |m1| 6= |m2| then the last block of PAD(m1) 6= PAD(m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 8 / 43

Page 39: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Outline

1 Recap

2 Hash Functions

3 Digital Signature

4 Cryptocurrency

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 9 / 43

Page 40: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Hash Function:

Figure: Hash FunctionRas Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 10 / 43

Page 41: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”Can I change document later?Can I have two document with same Hash?Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 42: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”

Can I change document later?Can I have two document with same Hash?Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 43: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”Can I change document later?

Can I have two document with same Hash?Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 44: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”Can I change document later?Can I have two document with same Hash?

Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 45: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”Can I change document later?Can I have two document with same Hash?Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 46: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Hash Functions

Document integrity

If I have a document ”m” and I publish its hash ”H(m)”Can I change document later?Can I have two document with same Hash?Can I verify a document with incorrect Hash

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 11 / 43

Page 47: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Outline

1 Recap

2 Hash Functions

3 Digital Signature

4 Cryptocurrency

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 12 / 43

Page 48: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the document

nobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuined problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 49: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the document

simple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuined problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 50: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not work

IDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuined problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 51: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSA

for document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuined problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 52: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuine

d problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 53: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital signature Attempt 1

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentsimple pasting a copy of signature do not workIDEA: USE RSAfor document m Alice uses s = md as her digital signature. To verify,verifier calculates se and ifm = se mod n, signature is genuined problem: given s(m1) and s(m2) one could calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 13 / 43

Page 54: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the document

IDEA: publish hash of document m as h = H(m)IDEA: USE RSAfor document m Alice uses s = hd as her digital signature.To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuined given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 55: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentIDEA: publish hash of document m as h = H(m)

IDEA: USE RSAfor document m Alice uses s = hd as her digital signature.To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuined given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 56: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentIDEA: publish hash of document m as h = H(m)IDEA: USE RSA

for document m Alice uses s = hd as her digital signature.To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuined given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 57: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentIDEA: publish hash of document m as h = H(m)IDEA: USE RSAfor document m Alice uses s = hd as her digital signature.

To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuined given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 58: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentIDEA: publish hash of document m as h = H(m)IDEA: USE RSAfor document m Alice uses s = hd as her digital signature.To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuine

d given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 59: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Digital Signature: Another try

AIM: Convince everybody that Alice have signed the documentnobody should be able to forge the documentIDEA: publish hash of document m as h = H(m)IDEA: USE RSAfor document m Alice uses s = hd as her digital signature.To verify, verifier calculates se and ifH(m) = se mod n, signature isgenuined given s(m1) and s(m2) one can not calculate s(m1.m2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 14 / 43

Page 60: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Summary

Symmetric vs asymmetric encryption system

RSASHA as tool for data integrityDigital signature

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 15 / 43

Page 61: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Summary

Symmetric vs asymmetric encryption systemRSA

SHA as tool for data integrityDigital signature

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 15 / 43

Page 62: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Summary

Symmetric vs asymmetric encryption systemRSASHA as tool for data integrity

Digital signature

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 15 / 43

Page 63: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Summary

Symmetric vs asymmetric encryption systemRSASHA as tool for data integrityDigital signature

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 15 / 43

Page 64: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Digital Signature

Summary

Symmetric vs asymmetric encryption systemRSASHA as tool for data integrityDigital signature

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 15 / 43

Page 65: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Outline

1 Recap

2 Hash Functions

3 Digital Signature

4 Cryptocurrency

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 16 / 43

Page 66: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Trade

Figure: Barter Trade

Problem: Meet of Demand

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 17 / 43

Page 67: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

how to Meet Demand

Medium of Exchange

Gold

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 18 / 43

Page 68: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

how to Meet Demand

Medium of ExchangeGold

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 18 / 43

Page 69: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Meet of Demand

Figure: Coins

Confidence of metal insideProblem: Difficult to carry

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 19 / 43

Page 70: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Meet of Demand

Figure: Coins

Confidence of metal inside

Problem: Difficult to carry

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 19 / 43

Page 71: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Meet of Demand

Figure: Coins

Confidence of metal insideProblem: Difficult to carry

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 19 / 43

Page 72: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Solution: Paper note

Figure: paper note

problem: Paper alone do not have value

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 20 / 43

Page 73: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Solution: Paper note

Figure: paper note

problem: Paper alone do not have valueRas Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 20 / 43

Page 74: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

What gives currency power?

Backed by RBI

RBI controls the flowstrong regulation against counterfeiting

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 21 / 43

Page 75: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

What gives currency power?

Backed by RBIRBI controls the flow

strong regulation against counterfeiting

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 21 / 43

Page 76: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

What gives currency power?

Backed by RBIRBI controls the flowstrong regulation against counterfeiting

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 21 / 43

Page 77: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

What gives currency power?

Backed by RBIRBI controls the flowstrong regulation against counterfeiting

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 21 / 43

Page 78: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Figure: PoS machine

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 22 / 43

Page 79: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Figure: PoS machineRas Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 22 / 43

Page 80: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spendingsolution:Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 81: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacy

problem: Double spendingsolution:Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 82: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spending

solution:Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 83: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spendingsolution:

Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 84: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spendingsolution:Central server to record all the transaction

Enter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 85: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spendingsolution:Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 86: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Digital currency

Backed by Central Bank to give legitimacyproblem: Double spendingsolution:Central server to record all the transactionEnter Banks: act as centralized server

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 23 / 43

Page 87: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

2008 Recession

Figure: Caption

problem: cannot trust the banks

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 24 / 43

Page 88: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Cryptocurrency: The Begining

problem: cannot trust bank

and their ledgersolution: Make decentralized ledger

Figure: The hindu

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 25 / 43

Page 89: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Cryptocurrency: The Begining

problem: cannot trust bank and their ledger

solution: Make decentralized ledger

Figure: The hindu

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 25 / 43

Page 90: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Cryptocurrency: The Begining

problem: cannot trust bank and their ledgersolution: Make decentralized ledger

Figure: The hindu

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 25 / 43

Page 91: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Cryptocurrency: The Begining

problem: cannot trust bank and their ledgersolution: Make decentralized and permissionless ledger

Figure: Caption

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 26 / 43

Page 92: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem solved?

No!It just exploded.

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 27 / 43

Page 93: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem solved?No!

It just exploded.

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 27 / 43

Page 94: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem solved?No!It just exploded.

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 27 / 43

Page 95: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumberfor India KYC normsWho would do identity management here?Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 96: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumber

for India KYC normsWho would do identity management here?Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 97: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumberfor India KYC norms

Who would do identity management here?Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 98: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumberfor India KYC normsWho would do identity management here?

Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 99: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumberfor India KYC normsWho would do identity management here?Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 100: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 1: Identity

bank used to do the verification and assign an identity to the accountnumberfor India KYC normsWho would do identity management here?Think RSA !!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 28 / 43

Page 101: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 102: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to all

Secret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 103: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to none

Anybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 104: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt it

Idea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 105: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea:

What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 106: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identity

nobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 107: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,

but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 108: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?

Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 109: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Identity: RSA a quick look

Public key: Known to allSecret key: known to noneAnybody can use my public key to encrypt the text and only I candecrypt itIdea: What if I make Public key as Identitynobody would know my real identity,but does that really matters?Anonymity comes for free

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 29 / 43

Page 110: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 2: Authorization

How does Banks do it?

They provide you with some secret key like: Password, PIN, OTP, whichyou can use to verify your identityproblem: No trusted BanksSolution: use Digital signature with secret key of RSA :)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 30 / 43

Page 111: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 2: Authorization

How does Banks do it?They provide you with some secret key like: Password, PIN, OTP, whichyou can use to verify your identity

problem: No trusted BanksSolution: use Digital signature with secret key of RSA :)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 30 / 43

Page 112: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 2: Authorization

How does Banks do it?They provide you with some secret key like: Password, PIN, OTP, whichyou can use to verify your identityproblem: No trusted BanksSolution:

use Digital signature with secret key of RSA :)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 30 / 43

Page 113: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 2: Authorization

How does Banks do it?They provide you with some secret key like: Password, PIN, OTP, whichyou can use to verify your identityproblem: No trusted BanksSolution: use Digital signature with secret key of RSA

:)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 30 / 43

Page 114: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 2: Authorization

How does Banks do it?They provide you with some secret key like: Password, PIN, OTP, whichyou can use to verify your identityproblem: No trusted BanksSolution: use Digital signature with secret key of RSA :)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 30 / 43

Page 115: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 116: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?

They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 117: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.

Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 118: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger

and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 119: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every account

what could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 120: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do?

Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 121: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodes

Problem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 122: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved?

No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 123: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to know your balance?

How does Banks do it?They maintain each and every account and every transaction.Basically a ledger and a ledger for each and every accountwhat could we do? Maintain a ledger over distributed nodesProblem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 31 / 43

Page 124: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write it

Problem: how do you know that node is trustworthy?Solution: verify it by majoritycost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 125: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write itProblem:

how do you know that node is trustworthy?Solution: verify it by majoritycost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 126: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write itProblem: how do you know that node is trustworthy?

Solution: verify it by majoritycost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 127: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write itProblem: how do you know that node is trustworthy?Solution:

verify it by majoritycost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 128: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write itProblem: how do you know that node is trustworthy?Solution: verify it by majority

cost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 129: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 1allow any node to write itProblem: how do you know that node is trustworthy?Solution: verify it by majoritycost for not trusting central bank

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 32 / 43

Page 130: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it

and verify it by majorityProblem:Sybil AttackSybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 131: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majority

Problem:Sybil AttackSybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 132: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:

Sybil AttackSybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 133: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:Sybil Attack

Sybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 134: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:Sybil AttackSybil attack: Where one node have more than one identities

Solution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 135: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:Sybil AttackSybil attack: Where one node have more than one identitiesSolution:

Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 136: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:Sybil AttackSybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resources

What are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 137: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: How to update ledger

Solution 2allow any node to write it and verify it by majorityProblem:Sybil AttackSybil attack: Where one node have more than one identitiesSolution: Ask them to show proof of some limited resourcesWhat are the resources available?

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 33 / 43

Page 138: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power.

you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 139: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)

How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 140: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?

Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 141: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problems

What could be a difficult problem ?We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 142: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?

We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 143: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.

Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 144: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.Factoring

problem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 145: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We have seen one such problem before.Factoringproblem: how would you find such difficult problems again and again

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 34 / 43

Page 146: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?

We know hash is uniformly distributedAsk them to find a hash of number, such that it has certain numberof leading zerosAdvantage: you can control the difficulty level of the problem

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 35 / 43

Page 147: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We know hash is uniformly distributed

Ask them to find a hash of number, such that it has certain numberof leading zerosAdvantage: you can control the difficulty level of the problem

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 35 / 43

Page 148: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We know hash is uniformly distributedAsk them to find a hash of number, such that it has certain numberof leading zeros

Advantage: you can control the difficulty level of the problem

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 35 / 43

Page 149: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We know hash is uniformly distributedAsk them to find a hash of number, such that it has certain numberof leading zerosAdvantage: you can control the difficulty level of the problem

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 35 / 43

Page 150: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Proof of Work

Limited Resource is your computation power. you cannot fake it :)How to implement it?Ask them to solve some very difficult problemsWhat could be a difficult problem ?We know hash is uniformly distributedAsk them to find a hash of number, such that it has certain numberof leading zerosAdvantage: you can control the difficulty level of the problem

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 35 / 43

Page 151: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

SHA: Secure Hash Functions

An Ideal Hash function f (x) : {0, 1}m → {0, 1}n is one which hasfollowing properties

given f (x) it is impossible to guess x

given x1 its is impossible to find x2 such that f (x1) = f (x2)it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 36 / 43

Page 152: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

SHA: Secure Hash Functions

An Ideal Hash function f (x) : {0, 1}m → {0, 1}n is one which hasfollowing properties

given f (x) it is impossible to guess xgiven x1 its is impossible to find x2 such that f (x1) = f (x2)

it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 36 / 43

Page 153: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

SHA: Secure Hash Functions

An Ideal Hash function f (x) : {0, 1}m → {0, 1}n is one which hasfollowing properties

given f (x) it is impossible to guess xgiven x1 its is impossible to find x2 such that f (x1) = f (x2)it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 36 / 43

Page 154: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

SHA: Secure Hash Functions

An Ideal Hash function f (x) : {0, 1}m → {0, 1}n is one which hasfollowing properties

given f (x) it is impossible to guess xgiven x1 its is impossible to find x2 such that f (x1) = f (x2)it is impossible to find x1, x2, such that x1 6= x2 and f (x1) = f (x2)

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 36 / 43

Page 155: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions

verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 156: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify them

consolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 157: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then

guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 158: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random number

such that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 159: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zeros

then the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 160: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify it

Gossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 161: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocol

once verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 162: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 163: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

Ask every node to collect the transactions verify themconsolidate them into a block and then guess a random numbersuch that hash of the block has certain leading zerosthen the successful node propagates the block to every other node,and they too verify itGossip Protocolonce verified they add it to their ledger

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 37 / 43

Page 164: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Merkel tree

Figure: Merkle TreeRas Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 38 / 43

Page 165: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

What if two node are successful?accept the one which has better solution

Problem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 39 / 43

Page 166: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

What if two node are successful?accept the one which has better solution

Problem solved?

No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 39 / 43

Page 167: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 3: update the ledger

What if two node are successful?accept the one which has better solution

Problem solved? No!

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 39 / 43

Page 168: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 4: how to know your balance

Assume that there is a public ledgerIt is not practical to maintain each and every account

Solution: modify transaction recording to get the balanceSuppose: A have to give B Rs. x . Initial balance of A was a and Bwas bwe record transaction as A→ B Rs xA→ A Rs a − xGain: you once you get to this transaction, you would never need tosee previous transactions to get balance of A

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 40 / 43

Page 169: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 4: how to know your balance

Assume that there is a public ledgerIt is not practical to maintain each and every accountSolution: modify transaction recording to get the balance

Suppose: A have to give B Rs. x . Initial balance of A was a and Bwas bwe record transaction as A→ B Rs xA→ A Rs a − xGain: you once you get to this transaction, you would never need tosee previous transactions to get balance of A

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 40 / 43

Page 170: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 4: how to know your balance

Assume that there is a public ledgerIt is not practical to maintain each and every accountSolution: modify transaction recording to get the balanceSuppose: A have to give B Rs. x . Initial balance of A was a and Bwas bwe record transaction as

A→ B Rs xA→ A Rs a − xGain: you once you get to this transaction, you would never need tosee previous transactions to get balance of A

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 40 / 43

Page 171: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 4: how to know your balance

Assume that there is a public ledgerIt is not practical to maintain each and every accountSolution: modify transaction recording to get the balanceSuppose: A have to give B Rs. x . Initial balance of A was a and Bwas bwe record transaction as A→ B Rs xA→ A Rs a − x

Gain: you once you get to this transaction, you would never need tosee previous transactions to get balance of A

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 40 / 43

Page 172: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 4: how to know your balance

Assume that there is a public ledgerIt is not practical to maintain each and every accountSolution: modify transaction recording to get the balanceSuppose: A have to give B Rs. x . Initial balance of A was a and Bwas bwe record transaction as A→ B Rs xA→ A Rs a − xGain: you once you get to this transaction, you would never need tosee previous transactions to get balance of A

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 40 / 43

Page 173: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Problem 5: Double spending

Figure: Double SpendingRas Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 41 / 43

Page 174: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Double spending

We have created blocks and verified them

integrity of each block is ensuredwe need to have integrity of all the block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 42 / 43

Page 175: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Double spending

We have created blocks and verified themintegrity of each block is ensured

we need to have integrity of all the block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 42 / 43

Page 176: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Double spending

We have created blocks and verified themintegrity of each block is ensuredwe need to have integrity of all the block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 42 / 43

Page 177: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

Double spending

We have created blocks and verified themintegrity of each block is ensuredwe need to have integrity of all the block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 42 / 43

Page 178: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

A Chain of blocks

Figure: A chain of block

Problem: How to organize them?Solution: Include hash of previous block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 43 / 43

Page 179: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

A Chain of blocks

Figure: A chain of block

Problem: How to organize them?

Solution: Include hash of previous block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 43 / 43

Page 180: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

A Chain of blocks

Figure: A chain of block

Problem: How to organize them?Solution: Include hash of previous block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 43 / 43

Page 181: Lecture 2: Bitcoin and Cryptocurrency Ras DwivediIntroduction to Blockchain Lecture 2: Bitcoin and Cryptocurrency Ras Dwivedi Indian Institute of Technology Kanpur May 22, 2018 Ras

Cryptocurrency

A Chain of blocks

Figure: A chain of block

Problem: How to organize them?Solution: Include hash of previous block

Ras Dwivedi (Indian Institute of Technology Kanpur) Introduction to Blockchain May 22, 2018 43 / 43