blockchain - indian statistical institutercbose/blockchain2017/... · blockchain the foundation...

55
BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata

Upload: others

Post on 20-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BLOCKCHAINThe foundation behind Bitcoin

Sourav Sen GuptaIndian Statistical Institute, Kolkata

Page 2: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

CRYPTOGRAPHYBackbone of Blockchain Technology

Page 3: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Component 1 : Cryptographic Hash Functions

Page 4: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Map variable-length input to constant-length output.

HASH FUNCTIONS

h yx101011101011001…0010110100101 101110101001000110111100010101

Page 5: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Finding the pre-image of a given output is not easy.

HASH FUNCTIONS

h y?101011101011001…0010110100101 101110101001000110111100010101

Page 6: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Finding a colliding twin of a given input is not easy.

HASH FUNCTIONS

h yx1101011101011001…0010110100101

101110101001000110111100010101

x21100101001011001…110010100110

Page 7: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Finding any colliding pair of inputs is not easy.

It is of course possible, but not easy.

HASH FUNCTIONS

h yx1101011101011001…0010110100101

x21100101001011001…110010100110

101110101001000110111100010101

Page 8: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Minor input-mismatch to major output-mismatch.

HASH FUNCTIONS

hy1x1101011101011001…0010110100101 101110101001000110111100010101

x2101010101011001…0010110100101 y2 110010100101100100110010100110

Page 9: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Merkle-Damgard Construction Example : SHA 256 — used in Bitcoin

CONSTRUCTIONS

f

m1

IV f

m2

f

mn

h

Page 10: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Sponge Construction Example : SHA 3 — used in Ethereum

CONSTRUCTIONS

f

m1

f

m2

f

mn

f

h1

c

r

Page 11: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Provably secure scheme for tamper-detection

APPLICATION

h yx

record(x) : c = h(x)

verify(c,x) : h(x) == c

Page 12: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Tamper-evident data pointer = Hash Pointer

Hash Pointer

DATA STRUCTURES

h hash(data)data

addr(data)

Page 13: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Tamper-evident linked data structure = Block

DATA STRUCTURES

h

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Page 14: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Tamper-evident linked-list = Blockchain

DATA STRUCTURES

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Page 15: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Tamper-evident linked-list = Blockchain

DATA STRUCTURES

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Block

HP(block)

data

timestamp

Page 16: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

DATA STRUCTURESProperties Blockchain Merkle Tree Merkle Trie

Size of Commitment O(1) O(1) O(1)

Append a Block/Node O(1) O(log n) O(k)

Update a Block/Node O(n) O(log n) O(k)

Proof of Membership O(n) O(log n) O(k)

Structural Abstraction List of Objects Set of Objects Set of (key, value)

Used for Construction Bitcoin Bitcoin Ethereum

Page 17: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Component 2 : Digital Signature Schemes

Page 18: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

(sk, pk) = keygen(n) verify(pk,m,sign(sk,m)) = True

DIGITAL SIGNATURE

pksk

?

s = sign(sk,m) verify(pk,m,s)keygen(n)

Page 19: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Given pk and access to sign(mi) as an oracle, an adversary should not be able to create a valid fresh message-signature pair (m,s)

DIGITAL SIGNATURE

pksk

?

s = sign(sk,m) verify(pk,m,s)keygen(n)

Page 20: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Elliptic Curve Digital Signature Algorithm (ECDSA)

ECDSA on curve E(Fp) : { (x,y) in Fp x Fp | y2 = x3 + 7 } with base prime p = 2256 - 232 - 29 - 28 - 27 - 26 - 24 - 1

CONSTRUCTIONFpQ

Page 21: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Elliptic Curve group of size |E(Fp)| = q ~ p ~ 2256

ECDSA on curve E(Fp) : { (x,y) in Fp x Fp | y2 = x3 + 7 } with base prime p = 2256 - 232 - 29 - 28 - 27 - 26 - 24 - 1

CONSTRUCTION

Parameters Format Range Bit-sizesk random Zq 256pk sk x G E(Fp) 512m hash(M) Zq 256

Signature (r, s) Zq x Zq 512

Page 22: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Publish the public key pk as your Identity Use the secret key sk to prove your identity

APPLICATIONpk

sksk

verify(pk,m,sign(sk,m))

sk?

Page 23: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINBlockchain in Practice

Page 24: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

ANONYMOUS E-CASH

35624

Zero-Knowledge Proof and Blind Signature

35624

35624

35624 35624

35624

Page 25: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BLIND SIGNATURE

First Concept of Untraceable e-Payments and e-Cash

David Chaum, 1984

Page 26: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

CYPHERPUNKS

De-Centralize e-Cash

Anonymity is not Enough!

?!

Page 27: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

CYPHERPUNKS

DavidChaum

PhilZimmermann

DigiCash PGP RPOW

HalFinney

HashCash

AdamBack

B-Money

WeiDai

BitGold

NickSzabo

1990 1991 20041997 1998 1998

Page 28: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINSatoshi Nakamoto31 October 2008

Page 29: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINLedger of Transactions

between Pseudonymous Identities

Semi-Decentralised Publicly-Verifiable Tamper-Resistant Eventually-Consistent

Page 30: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Economic Transaction that we are familiar with

NOT BITCOIN

Tx

Page 31: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

NOT BITCOIN

Tx

Centralised Account-based Ledger

Page 32: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

NOT BITCOIN

Tx

Decentralised Account-based Ledger

Page 33: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Tx

NOT BITCOIN YET

Tx

Decentralised Transaction-based Ledger

Tx Tx Tx Tx TxTx

Page 34: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

TRANSACTION

Tx

Network verifies the Signature

TxSigned by

Page 35: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

TRANSACTION

Tx

Network verifies the Signature

TxSigned by

pk

sk

pk

Page 36: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Input : Array of previous Transactions | Output : Array of recipient Addresses

R1

TRANSACTION

TxTxpk2

sk1

Txpk1

Txpk3

sk2 sk3

pk

R2pk

R3pk

Send

er(s)

Recipient(s)

Network verifies the Signature(s)

Page 37: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Input : Array of previous Transactions | Output : Array of recipient Addresses

R1

TRANSACTION

Txpk2

sk1

Txpk1

Txpk3

sk2 sk3

pk

R2

pk

R3

pk

Tx

Recipients

SignaturesInpu

t Tra

nsac

tions

Network verifies the Signature(s)

Page 38: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

TRAN

SACT

ION

Metadata

Input(s)

Output(s)

Data obtained from blockchain.info

Page 39: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

LEDGER

Tx

Decentralised Transaction-based Ledger

Tx Tx TxTx Tx Tx Tx

Tx Tx Tx TxTx Tx Tx Tx Tx Tx Tx Tx

Page 40: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BLOCK

Data obtained from blockchain.info

Page 41: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOIN

Tx

Tx

Tx

Tx

MiningTransaction

Page 42: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

MINING

Tx

Tx

Tx

Tx

Computational Lottery (Puzzle)

Transaction

Winner writes the next block

Existing blocks at a given time

Find r such thathash(r || m) < C

Page 43: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOIN

Tx

Tx

Tx

Tx

MiningTransaction

Page 44: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINFramework — Decentralised peer-to-peer collaborative networkGoal : All peers should agree on a sequence of transactions

Page 45: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINPublicly-Verifiable

as the complete ledger and the hash function is public

Page 46: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINTamper-Evident / Tamper-Resistant

as the ledger is connected through a chain of hash pointers

X X X

X

X X X

Page 47: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINEventually-Consistent

as the longest chain eventually sustains as the main chain

Page 48: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINSemi-Decentralised

as the mining is dominated by computational power

Page 49: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BITCOINSemi-Decentralised Publicly-Verifiable Tamper-Resistant Eventually-Consistent

Page 50: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

BEYOND BITCOINExploiting the power of Blockchain Ecosystem

Page 51: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Proof-of-Work Proof-of-Space Computation-hard challenge Memory-hard challenge

Proof-of-Stake Proof-of-Importance Depends on holdings Depends on involvement

MINING

PermaCoin, SpaceMint

OmiseGo, EOS

Page 52: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

De-Centralized Semi-Centralized Without any Authority With Trusted Authority

Almost all active Currency RSCoin (Bank of England)

NETWORK

Page 53: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Pseudonymity Pure Anonymity Not easily Traceable Provably not Traceable

Mixing Services provide some guarantee of anonymity otherwise.

ANONYMITY

Page 54: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

Abstraction of Bitcointo the backbone protocol of blockchain

Page 55: BLOCKCHAIN - Indian Statistical Institutercbose/blockchain2017/... · BLOCKCHAIN The foundation behind Bitcoin Sourav Sen Gupta Indian Statistical Institute, Kolkata. CRYPTOGRAPHY

APPLICATION