25
Bitcoin’s Blockchain from hashes to escrow and beyond Grzegorz Gawron Arini Labs marketics at arini.biz

Bitcoin’s blockchain - from hashes to Escrow and beyond

Embed Size (px)

Citation preview

Bitcoin’s Blockchainfrom hashes to escrow

and beyond

Grzegorz GawronArini Labs

marketics at arini.biz

AGENDA- basic building blocks

- (cryptographic) hash functions- hash pointers- merkle tree- digital signatures

- practicalities- bootstrapping- 51 pct attack- forking

- beyond simple transactions- scripts- escrow, green addresses, micropayments

basic building blocks

hash functions● any size input● fixed size output● efficient computation

cryptographic hash functions● collision resistance

○ infeasible to find x,y with same hash output○ what is guaranteed way of finding a collision?○ what’s the time-cost?

● hiding○ given hash it’s infeasible to find the message○ example: coin flip?○ with the ‘random’ nonce

● puzzle-friendliness○ given a set of hashes it’s infeasible to find the message

Crypto Hash Applications● message digests● commitments

○ com = commit(msg, key)○ ver = verify(com, msg, key)

● search puzzle○ for a set Y find x that H(x || r) belongs to Y

Merkle Tree

* 7/1/2016 wikipedia

Digital Signatures

* 7/1/2016 wikimedia

Blockchain

* 7/1/2015 https://21.co/learn/bitcoin-mining/#the-merkle-root

digital signatures

crypto hash pointers

merkle tree

Transactions

* Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi Nakamoto

scriptPK

scriptSig

Transaction: combine / split

* Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi Nakamoto

Practicalities

Bootstrapping is hard

security

healthy mining

ecosystem

stablevalue

Changing the Protocol

HARD FORKS

new client’s blocks rejected by old

SOFT FORKS

new client’s blocks accepted by old

51 Percent Attack

● what an attacker can hope for? ○ steal?○ suppress transactions?○ change block reward?○ destroy confidence?

transaction scripts

Scripts

● pay to public key hash● pay to script hash

○ multi signature

pay to public key hash

* https://en.bitcoin.it/wiki/Transaction

script to run = scriptSig scriptPubKeyscriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIGscriptSig: <sig> <pubKey>

pay to script (m-of-n multisignature)

* https://en.bitcoin.it/wiki/Transaction

script1 to validate = scriptSig scriptPubKeyscript2 to run = <serialised script>

scriptPubKey: OP_HASH160 <scriptHash> OP_EQUAL scriptSig: ...signatures... <serialized script>

0 <sig1> <sig2> ... <sigM> OP_m <pubKey1> ... OP_n OP_CHECKMULTISIG

Scripts’ Applications● escrow (alice, bob, 3rd party)● green addresses (alice, bob, bank)● efficient micro-payments (alice, bob)

TRANSACTION

10 BTC

from Alice

to MULTISIG(2 out of 3)

Escrow

Arbitrator

Alice

2x sign

Bob

sign

2x sign

1 2a

2c 2b

Bob

TRANSACTION

10 BTC

from Bank

to Bob

Green Addresses

Alice

‘Bank’

1

sign2

3

4

Bob

TRANSACTION B<lock time>

1 BTC

from TRANS A

to Alice

Micropayments

Alice

2asign

TRANSACTION k

0.0001 BTC

from TRANS A

to Bob

TRANSACTION 2

0.0002 BTC

from TRANS A

to Bob

TRANSACTION 3

0.0003 BTC

from TRANS A

to Bob

TRANSACTION A

1 BTC

from Alice

to MULTISIG (2 out of 2)

1sign

sign

2b

3signsignsign

4 5

6

References- Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi

Nakamotohttps://bitcoin.org/bitcoin.pdf

- Princeton University: ‘Bitcoin and cryptocurrency technologies’https://www.coursera.org/course/bitcointech

- https://bitcoin.org/en/developer-guide- https://en.bitcoin.it/wiki - https://21.co/learn/#reference-21-bitcoin-org

- wiki*edia

Thank You

Grzegorz GawronArini Labs

marketics at arini.biz