Bitcoin: Concepts, Practice, and Research Directions Ittay Eyal, Emin Gün Sirer Computer Science, Cornell University DISC Bitcoin Tutorial, October 2014
Barter Gold Fiat 2
Barter Gold Fiat Bitcoin 2008: The Bitcoin white paper 2009: Reference implementation [Satoshi Nakamoto] 3
Barter Gold Fiat Bitcoin Decentralized control Decentralized minting Easy to transfer Novel tech, new applications 4
Barter Gold Fiat Bitcoin Banks: criminals, who print money and lend it as debt. taxation is a crime! Bitcoin or oligarchy? Separate church and state? Separate bank and state! 5
Great Success! Mt. Gox USD/BTC 1000$ 100$ 10$ 1.00$ 0.10$ Oct 10 Jan 14 [http://bitcoincharts.com/] 6
Litecoin Great Success! Mt. Gox USD/BTC Ethereum 1000$ 100$ 10$ Namecoin Dogecoin Worldcoin 1.00$ 0.10$ Oct 10 Jan 14 [http://bitcoincharts.com/] 7
1000 800 600 Mostly Great Success USD/BTC (Bitstamp) 400 200 0 Dec-11 Jul-12 Jan-13 Aug-13 Feb-14 Sep-14 [http://bitcoincharts.com/] 8
Acceptance 9
Acceptance 10
Acceptance 11
Acceptance 12
Farmers Payment services Investors Start-ups Venture Capital Miners Developers Researchers Many Players 13
Roadmap Protocol Security Research Non-technical 14
Bitcoin: Concepts, Practice, and Research Directions Part I Protocol Ittay Eyal, Emin Gün Sirer Computer Science, Cornell University DISC Bitcoin Tutorial, October 2014
Overview The Blockchain Block propagation Mining Transactions Part 1 Protocol 2
Protocol Overview
Alice Key Issues Bob 1. Stealing 2. Double-spending Not a local solution 4
Global Ledger M A A B B C 5
Global Ledger M A A B A C 6
Global Ledger M A A B B C 7
Addresses and Transactions M A A B txn AB, PK C, sgn SK(B) B C 8
Addresses and Transactions Transaction structure (roughly): input 1 output 1, amount 1 input 2 output 2, amount 2 input 3 output 3, amount 3 input 4 Inputs are fully spent. 9
Alice Goal 1. No stealing 2. No double-spending Bob 11
The Blockchain
Global Ledger Global Ledger of all transactions Requirements 1. No central control 2. High availability, security 3. Impossible to manipulate 4. Distributed minting 13
Global Ledger Global Ledger of all transactions Requirements 1. No central control 2. High availability, security 3. Impossible to manipulate 4. Distributed minting Sounds like my bank! Doesn t sound like my bank. 14
Global Ledger Distributed system Open Consensus (not exactly) Byzantine model 15
Ledger The Blockchain Blockchain block 16
Ledger The Blockchain Blockchain block 17
Ledger The Blockchain Blockchain block 18
The Blockchain Clients issue unforgeable transactions. Miners collate transactions and add them to blockchain by solving cryptopuzzles, for which they receive a reward (minted coins). 19
Transaction and Block Propagation Nodes propagate legal transactions and blocks. Blocks are difficult to create 20
Hash of Previous header Time Txns Merkle Root Nonce target Auto-adjusting difficulty cryptopuzzle: SHA256(SHA256(block-header)) < target 21
Forks Longest chain of blocks Tiebreaker: earliest A weak form of consensus 22
Fork Resolution Requirement: compute majority is honest Hardest chain of blocks (aggregate difficulty) Or the one you heard of first. 23
Fork Resolution Requirement: compute majority is honest Hardest chain of blocks (aggregate difficulty) Or the one you heard of first. Dishonest majority controls blockchain (More on that later) 24
Block Propagation
Block Propagation 6.5 Average 12.6 40 For blocks larger than 20kB: 1kB +80msec [Decker and Wattenhofer 13] 26
Block Propagation Average 12.6 Large miners connected directly with low latency. 6.5 40 For blocks larger than 20kB: 1kB +80msec [Decker and Wattenhofer 13] 27
Block Propagation 6.5 Average 12.6 40 For blocks larger than 20kB: 1kB +80msec Header before block? [Decker and Wattenhofer 13] 28
Mining
Motivation? Prize: Mining: Newly minted coins (today 25, total 21 million at 2140) Transaction fees (up to ~10 4 /1KB). How? Coinbase transaction Transactions fees 30
Hash Rate [TH/sec] Difficulty rise: 20,000 2,000 Mining Total Network Hash Rate 200 20 Mar 13 Jul 13 (More on that later) Jan 14 [Blockchain.info] 31
Hash Rate [TH/sec] Difficulty rise: 20,000 2,000 Mining Total Network Hash Rate 200 20 Mar 13 Jul 13 (More on that later) Jan 14 [Blockchain.info] 32
Example: (700 USD/BTC) Mining Pools Avg revenue: 6.71$ / day HW break even: ~1.5 years (w/ free power) Time to block: over 7 years 33
Mining Pools Bitcoin Network Pool with power α gets α of blocks Each miner makes the average (- pool fee) 34
Mining Pools 35
Mining Pools How can they tell? 36
Mining Pools hash( ) < pool-target Bitcoin Network 37
Mining Pools (More on that later) [Blockchain.info, February 2014] 38
Transactions
Ledger Transactions Blockchain block 40
Transactions 41
Transactions input 1 output 1, amount 1 input 2 output 2, amount 2 input 3 42
Transactions input 1 output 1, amount 1 input 2 output 2, amount 2 input 3 43
output: scriptpubkey Pay-to-PubkeyHash Input: scriptsig 44
scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> output: scriptpubkey Pay-to-PubkeyHash Address is the public key hash. Owner signs with matching private key. Input: scriptsig 45
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script <sig> <pubkey> OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG 46
scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> <sig> Pay-to-PubkeyHash Stack Verification script <pubkey> OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG 47
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script <pubkey> <sig> OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG 48
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script <pubkey> <pubkey> <sig> OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG 49
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script hash160(<pubkey>) <pubkey> <sig> <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG 50
scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> <pubkeyhash> Pay-to-PubkeyHash hash160(<pubkey>) <pubkey> <sig> Stack Verification script OP_EQUALVERIFY OP_CHECKSIG 51
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script <pubkey> <sig> OP_CHECKSIG 52
Pay-to-PubkeyHash scriptpubkey: OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG scriptsig: <sig> <pubkey> Stack Verification script Return true. 53
Coinbase No input Other Transaction Types Pay to Script Hash (P2SH) Script in signature (receiver side) Multisig Require k/n signatures 54