Bitcoin: 2014
Total Page:16
File Type:pdf, Size:1020Kb
Copyright ©
Bitcoin: 2014
Concepts, Practice, and IttayEyal,
Research Directions Emin
G
ü n Part II Sirer Security Ittay Eyal, Emin Gün Sirer Computer Science, Cornell University DISC Bitcoin Tutorial, October 2014 Part 2 – Security Copyright ©
• Unbelievable security of core system 2014 • The mining industry IttayEyal,
• Classical attacks Emin
G ü
• Centralization n • Misaligned incentives: Sirer • Transactions • Mining • Reducing pool sizes • User-side security
2
Core System Availability Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer Almost always on.
Despite no shortage of attack motivation.
3 The March 2013 Fork Copyright ©
• Miner with version 0.8.0 generated a large block. 2014
• Old versions rejected it. IttayEyal,
Emin G
version 0.8.0 miners ü
n Sirer
pre-0.8.0 miners Solution: 1. Major miners downgraded to pre-0.8.0. 2. Upgrade to 0.8.1 prevented large blocks. 3. 5 months later: Upgrade done right.
4
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n The Mining Industry Sirer Mining Copyright ©
Difficulty rise: 2014 Total Network Hash Rate IttayEyal,
20,000 Emin
G
ü
n Sirer 2,000
200 Hash Rate [TH/sec] HashRate
20 Mar’13 Jul’13 Jan’14
[Blockchain.info] 6
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
7
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
8
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
9
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
10 Mining Industry Copyright ©
• 2014 Avalon IttayEyal, • ASIC Miner
• BitMine Emin
G ü
• Butterfly Labs n Sirer • CoinTerra • GAW Miners • HashFast • KnC Miner • Spondoolies
11 Mining Industry Copyright ©
• 2014 Avalon IttayEyal, • ASIC Miner
• BitMine Emin
G ü
• Butterfly Labs n Sirer • CoinTerra • GAW Min ers • HashFast • KnC Miner • Spondoolies
12 Mining Industry Copyright ©
• 2014 Avalon IttayEyal, • ASIC Miner
• BitMine Emin
G ü
• Butterfly Labs n Sirer • CoinTerra • GAW Min ers • HashFast • KnC Miner • Spondoolies
13
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
14
Mining Industry Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer This is what makes Bitcoin secure.
15
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Classical Attacks Sirer Double Spending Copyright ©
Eve buys coffee from Bob but keeps her money: 2014 IttayEyal,
B Emin
1. G
ü n C Sirer 2. Bob provides product to Eve. B 3. C Similar, but more feasible: The Finney attack 17 Majority Attacker, aka 51% Copyright ©
Attacker produces the longest chain. 2014
IttayEyal,
Emin
G
ü
n Sirer
Attacker cannot steal. Attacker can: • Require excessive transaction fees, • take ransom from a single user, or • prevent all transactions (DoS).
18
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Centralization Sirer
Centralization Copyright © 2014 2014
One entity gains control of the blockchain: IttayEyal, • Single majority miner
• Consortium of pools Emin
G
ü
n Sirer
Breaks Bitcoin’s essential premise.
20 Centralization Copyright ©
Pool GHash.IO (w/ CEX.IO) surpassed 50%. 2014 IttayEyal, Community raged.
DoS attacks on pool. Emin
G ü
GHash promptly reduced its rate. n Sirer
21 Centralization Copyright ©
Pool GHash.IO (w/ CEX.IO) surpassed 50%. 2014 IttayEyal, Community raged.
DoS attacks on pool. Emin
G ü
GHash promptly reduced its rate. n Sirer
(Almost) no good reason for such large pools. • Nice interface. • Good uptime.
22
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Misaligned Incentives:Sirer Transaction Propagation
Transaction Propagation [1] Copyright © 2014 2014
Nodes should propagate transactions. IttayEyal,
But why would they?
Emin
G
ü n
Actual incentive: don’t propagate. Sirer
[1] Babaioff, Dobzinski, Oren, and Zohar, On Bitcoin and Red Balloons. EC’12 24
Transaction Propagation [1] Copyright © 2014 2014
DARPA Network Challenge ’09: Winner: MIT Group IttayEyal, Find 10 red balloons in US.
Technique: Emin G
$2000 to finder ü n $1000 to recruiter Sirer $500 to 2nd recruiter …
[1] Babaioff, Dobzinski, Oren, and Zohar, On Bitcoin and Red Balloons. EC’12 25
Transaction Propagation [1] Copyright © 2014 2014
DARPA Network Challenge ’09: Winner: MIT Group IttayEyal, Find 10 red balloons in US.
Technique: Emin G
$2000 to finder ü n $1000 to recruiter Sirer $500 to 2nd recruiter …
Applicable to Bitcoin?
[1] Babaioff, Dobzinski, Oren, and Zohar, On Bitcoin and Red Balloons. EC’12 26
Transaction Propagation [1] Copyright ©
2014 2014 IttayEyal,
Red balloons technique not applicable to Bitcoin.
Emin
G
ü n • Why recruit your own competition? Sirer Unlike balloons case where you recruit far away.
• Can masquerade as your own recruits. Unlike balloons case where you physically show up.
[1] Babaioff, Dobzinski, Oren, and Zohar, On Bitcoin and Red Balloons. EC’12 27 Transaction Propagation [1] Copyright ©
Solution sketch: 2014 IttayEyal, Set integers 퐻 and 훽 according to topology.
Then, for a chain of length 푙: Emin
G
ü
n Sirer If 푙 > 퐻 • no reward. Otherwise, • miner gets 1 + 퐻 − 푙 + 1 훽, • others get 1.
[1] Babaioff, Dobzinski, Oren, and Zohar, On Bitcoin and Red Balloons. EC’12 28
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Misaligned Incentives:Sirer Selfish Mining
Common Wisdom Copyright © 2014 2014
Nakamoto’s Bitcoin mining protocol is incentive IttayEyal,
compatible (assuming an honest majority)
Emin
G
ü n 1. Best strategy: being honest Sirer
2. Revenue proportional to compute power
30
Selfish Mining [1] Copyright © 2014 2014
Goal: Get more than fair share. IttayEyal,
How: Maintain secret blocks, publish judiciously.
Emin
G
ü
n Sirer
Intuition: Risk some work, others waste a lot.
[1] Eyal and Sirer: Majority is not Enough: Bitcoin Mining is Vulnerable, FC’14 31 Selfish Mining Algorithm Copyright ©
(a) Any state but two branches of length 1. 2014 IttayEyal, Pool finds a block.
Keep it secret. No revenue. Emin
G
ü
n Sirer
32 Selfish Mining Algorithm Copyright ©
(h) Lead more than 2. 2014 IttayEyal, Others find a block.
Publish one block. Selfish gets 1. Emin
G
ü
n Sirer
33 Selfish Mining Algorithm Copyright ©
(g) Lead of 2. 2014 IttayEyal, Others find a block.
Publish secret chain. Selfish gets 2. Emin
G
ü
n Sirer
34 Selfish Mining Algorithm Copyright ©
(f) Lead of 1. 2014 IttayEyal, Others find a block.
Publish secret block. No revenue. Emin
G
ü
n Sirer
훾: Ratio of others that follow pool
35
Selfish Mining Algorithm Copyright © 2014 2014
(b) Two branches of length 1. IttayEyal, Pool finds a block.
Publish branch. Selfish gets 2. Emin
G
ü
n Sirer
36 Selfish Mining Algorithm Copyright ©
(c) Two branches of length 1. 2014 IttayEyal, Others find a block after pool head.
Revenue: Each get 1. Emin
G
ü
n Sirer
37 Selfish Mining Algorithm Copyright ©
(d) Two branches of length 1. 2014 IttayEyal, Others find a block after others’ head.
Revenue: Others get 2. Emin
G
ü
n Sirer
38 Selfish Mining Algorithm Copyright ©
(e) No private branch. 2014 IttayEyal, Others find a block.
Revenue: Others get 1. Emin
G
ü
n Sirer
39
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Selfish Mining: Sirer Analysis
Selfish Mining – Probabilities Copyright ©
2014 2014
IttayEyal,
Emin G
1 − 훼 ü n
0’ 훼 훼 훼 훼 Sirer (1 − 훾)(1 − 훼) 훾(1 − 훼) 훼 1 2 3 4 0 훼 1 − 훼 1 − 훼 1 − 훼 1 − 훼 1 − 훼
41
Selfish Mining – Probabilities Copyright © 2014 2014
1 − 훼 IttayEyal, 0’ 훼 훼 훼 훼 (1 − 훾)(1 − 훼) 훾(1 − 훼)
훼 1 2 3 4 Emin G
훼 ü 0 1 − 훼 1 − 훼 1 − 훼 n 1 − 훼 Sirer 1 − 훼
42
Selfish Mining – Revenue Copyright © 2014 2014
1 − 훼 IttayEyal, 0’ 훼 훼 훼 훼 (1 − 훾)(1 − 훼) 훾(1 − 훼)
훼 1 2 3 4 Emin G
훼 ü 0 1 − 훼 1 − 훼 1 − 훼 n 1 − 훼 Sirer 1 − 훼
43
Selfish Mining – Revenue Copyright © 2014 2014
Auto-adjusting difficulty, so: IttayEyal,
푟푝표표푙 Emin
푅 = G
푝표표푙 ü n
푟푝표표푙 + 푟표푡ℎ푒푟푠 Sirer
44
Selfish Mining – Analysis Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
45
Selfish Mining – Analysis Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
46
Selfish Mining – Analysis Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
47
Selfish Mining – Analysis Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
48
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Selfish Mining: Sirer Implications Attack Feasible Copyright ©
Unknown ~February 2014 Unknown 2014
P2Pool IttayEyal, Ghash.IO
Slush
Emin
G
ü
n Sirer
BTC Guild Eligius
51
Catastrophe Scenario Copyright © 2014 2014
After threshold: IttayEyal,
Rational miners want Emin
G
ü n to join selfish pool. Sirer
52
Catastrophe Scenario Copyright © 2014 2014
Superlinear growth: IttayEyal,
Selfish pool wants to Emin
G
ü n grow. Sirer
53
Catastrophe Scenario Copyright ©
2014 2014 IttayEyal, Rational miners want
to join selfish pool. Emin
G ü
+ n Sirer Selfish pool wants to grow. = Selfish pool may grow towards 50% NOT GOOD.
54 Attack Happening Now? Copyright ©
Unknown
Unknown ~February 2014 2014 2014
P2Pool
Ghash.IO IttayEyal,
Slush
Emin
G ü
BTC Guild Eligius n Sirer April 16, 2014
Ghash.IO
55
Hardening the protocol Copyright © 2014 2014
Algorithm change: IttayEyal, • Propagate all blocks of longest chain.
• Choose one at random to mine on. Emin
G
ü
n Sirer
56
Hardening the protocol Copyright © 2014 2014
Algorithm change: IttayEyal, • Propagate all blocks of longest chain.
• Choose one at random to mine on. Emin
G
ü
n Sirer Benefits: • Proved threshold • Backward compatible • Progressive • Simple
57
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Reducing Pool Sizes Sirer
P2Pool [1] Copyright © 2014 2014
A peer to peer distributed pool. IttayEyal,
Emin
G
ü
n Sirer • A separate blockchain with Easy PoW • Blocks distribute potential revenue among miners. • Actual revenue on full PoW.
[1] Forrest Voight, p2pool: Decentralized, DoS-resistant, Hop-Proof pool, Bitcoin Forum, June 2011 60 Pool Limiting Copyright ©
• Non-outsourcable PoW [1] 2014 Cryptographic technique: A miner can steal IttayEyal,
from the pool when it finds a block. Emin G
• Pool cannot outsource differently. ü n • Block does not reveal secret. Sirer
• Permacoin [2] Proof of storage rather than work. Storage should not be outsourceable.
[1] Miller, Shi, Kosba, and Katz. Nonoutsourceable Scratch-Off Puzzles to Discourage Bitcoin Mining Coalitions. TR [2] Miller, Juels, Shi, Parno and Katz. Permacoin: Repurposing Bitcoin Work for Data Preservation. TR 61
2-Phase Proof of Work Copyright © 2014 2014
Split the proof of work. IttayEyal, • Phase 1: Standard Bitcoin, but easier.
• Phase 2: Requires coinbase secret key. Emin
G
ü
n Sirer Benefits: • Existing infrastructure controlled phase-out. HW, datacenters. • Pool must trust miners to outsource phase 2. Miner could try and steal the coinbase.
62
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n User-side security Sirer
User-side Security Copyright © 2014 2014
Client must keep private keys secret. IttayEyal,
High availability vs. security Emin
G
ü
n Sirer Individual and large organizations security differs only in scale.
Unprecedented security requirements from commodity systems.
64 Individuals Copyright ©
Tools: 2014
• Standard client IttayEyal,
• Software wallets (for phone) Emin
• Online wallets G
ü n • Brain wallets Sirer • Hardware wallets Practice: • Limited amount on phone • Cold storage – replicated • Use correct cryptography [1]
[1] Bos, Halderman, Heninger, Moore, Naehrig and Wustrow: Elliptic Curve Cryptography in Practice, FC’14 65
Large services Copyright © 2014 2014
Tools: IttayEyal, • Plenty of firewalls
• Bullet proof front-end systems Emin
G ü
• Bullet proof back-end systems n Sirer
Practice: Powered by • Cold storage • Auditing
66 Transaction Malleability Copyright ©
Transaction hash used to track transactions. 2014
But it’s possible to change a transaction: IttayEyal,
input 1 output 1, amount 1 Emin
G
ü
n Sirer
input 1 output 1, amount 1
Change scriptSig: Still valid, for same content, different bits. 1. Change signature. (Crypto trick) 2. Change script. (Protocol trick)
67 Transaction Malleability Copyright ©
The MtGox con: 2014
IttayEyal,
Emin
G
ü
n Sirer
68 Transaction Malleability Copyright ©
The MtGox con: 2014
IttayEyal,
Emin
G
ü n 1. Issue withdraw command. Sirer 2. Generate malformed txn, place in public buffer. 3. Change txn and publish it; get the money. 4. Call Mt.Gox to complain. 5. Pay again with new txn. 6. Get money again. 69
Miners and Pools Copyright © 2014 2014
• The BGP attack IttayEyal,
Emin
G
ü
n Sirer
BGP Get STRATUM Attack
70
Miners and Pools Copyright © 2014 2014
• The BGP attack IttayEyal,
Emin
G
ü
n Sirer
71
Miners and Pools Copyright © 2014 2014
• The BGP attack IttayEyal,
Emin
G
ü
n Sirer
Get work, Get work, Send PoW Send PoW
72
Miners and Pools Copyright © 2014 2014
• The BGP attack IttayEyal, • Block Withholding
Miner sends pool PoW Emin
G
ü n
Unless it’s an actual solution Sirer
73 Copyright ©
Bitcoin: 2014
Concepts, Practice, and IttayEyal,
Research Directions Emin
G
ü n Part III Sirer Other Research Ittay Eyal, Emin Gün Sirer Computer Science, Cornell University DISC Bitcoin Tutorial, October 2014 Part 2 – Other Research Copyright ©
• Alt-coins 2014 • Extensions IttayEyal,
• Privacy Emin
G ü
• Contemporary issues n Sirer
2
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Alt-coins & Sirer Extensions Parameter changing Copyright ©
• Block frequency 2014 IttayEyal, • Faster confirmation
• More forks Emin
G
ü
n Sirer • PoW choice • More green? (no) • More fair? (no)
• Difficulty adjustment rate • Defense against flash miners
4 Proof of stake [1] Copyright ©
Goal: 2014 IttayEyal, • Save some trees.
• Power to the users! (rather than miners) Emin
G
ü
n Sirer Method: • Proof of Stake (PoS) instead of Proof of Work: Lock coins to create block.
[1] King and Nadal. PPCoin: Peer-to-Peer Crypto-Currency with Proof of Stake, August ‘12 5 Proof of stake [1] Copyright ©
Goal: 2014 IttayEyal, • Save some trees.
• Power to the users! (rather than miners) Emin
G
ü
n Sirer Method: • Proof of Stake (PoS) instead of Proof of Work: Lock coins to create block. S1 S2
But nothing is at stake! S1 S2
[1] King and Nadal. PPCoin: Peer-to-Peer Crypto-Currency with Proof of Stake, August ‘12 6
Merged mining Copyright ©
2014 2014 IttayEyal, Bitcoin PoW contains: • Emin
Useless transaction (alt-coin header hash x) G
ü
n Sirer
Alt-coin PoW contains: • Alt-coin header with hash x • Bitcoin header with transaction x
8
Merged mining Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer Miners benefit from mining both chains together. So they do.
Alt-coin gets mining power from day one.
9
Smart Contracts Copyright © 2014 2014
• Smart Contracts: IttayEyal, • 푚 out of 푛 signatures.
• Time-locked transactions: Emin
G
ü n
• Time to place in blockchain. Sirer • Time to use outputs.
• Ethereum: outsource distributed computing (got 31k BTC, at $18 million) • Transactions generate transactions. • Transactions activate one another.
10 Extensions Copyright ©
• Colored coins: 2014
Associate assets to individual Bitcoins. IttayEyal,
Emin
G
ü
n Sirer
• Side chains: • Faster • backed by main blockchain • less secure
11
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Privacy Sirer Transaction Tracking Copyright ©
All transactions remain in Blockchain forever. 2014
IttayEyal,
Emin
G
ü
n Sirer
13 Transaction Tracking Copyright ©
All transactions remain in Blockchain forever. 2014 One can associate addresses by detective work. IttayEyal,
[1] [2Emin ]
G
ü
n Sirer
• For large scale crime? Not great. • For somewhat secret activity? Pretty good. [1] Ron and Shamir, FC’14 [2] Meiklejohn, Pomarole, Jordan, Levchenko, McCoy, Voelker, Savage. IMC’13 14 Zerocoin and Zerocash Copyright ©
Zerocash [2]: 2014 IttayEyal, Privacy preserving alt-coin on top of Bitcoin.
(preceded by Zerocoin [1]) Emin
G
ü
n Sirer
[1] Miers et al., IEEE S&P, 2013 [2] Ben-Sasson et al., TR, 2014 15
Zerocoin and Zerocash Copyright © 2014 2014
The key: IttayEyal,
To move funds: prove* that Emin
“I know the secret for moving certain coins”. G
ü
n Sirer Without revealing the sources or the value. But still preventing double-spending.
*Zero-knowledge Succinct Non-interactive Arguments of Knowledge (zk-SNARKs)
[1] Miers et al., IEEE S&P, 2013 [2] Ben-Sasson et al., TR, 2014 16
Stealth Addresses Copyright © 2014 2014
The goal: IttayEyal,
Untrackable transactions to public address.
Emin
G
ü n
The method: Sirer 1. Bob publishes address template 푥. 2. Alice sends Bitcoin to augmented address 푥′. 3. Bob finds 푥′ and controls it.
• No one but Alice and Bob know x’. Need either Alice’s secrets or Bob’s. • Only Alice controls x’.
17
Copyright ©
2014 2014
IttayEyal,
Emin
G
ü n Contemporary Issues Sirer Scalability Copyright ©
Initialization: 2014 • Blockchain over 22GB. Linear growth. IttayEyal,
• Long time for bootstrapping Emin
G
ü n Running (at 7 txn/sec) : Sirer CPU: Insignificant UTXO + Mempool Memory: ~100MB Network: ~30Kb/sec
[1] Gavin Andresen, A Scalability Roadmap, BTC Foundation Blog, October 2014 19
Scalability Copyright ©
2014 2014 IttayEyal,
Lightweight clients: Simple Proof Verification Emin
G
ü
n Sirer
Initialization speedup: [1] • Headers first • UTXO first
[1] Gavin Andresen, A Scalability Roadmap, BTC Foundation Blog, October 2014 20
UTXO and Mempool Maintenance Copyright ©
2014 2014 IttayEyal, UTXO set becoming large.
Miners can choose to skip transaction verification. Emin
G
ü
n Sirer
Mempool becoming large Miners can publish empty blocks.
21
Block Propagation Time Copyright © 2014 2014
Block propagation time: IttayEyal, • Too long.
• Depends on block size. Emin
G
ü
n Sirer Suggested solutions: • Transaction set reconciliation. • Header first.
22
BIP 70 – Payment Protocol Copyright ©
2014 2014
IttayEyal,
Emin
G
ü
n Sirer
23 Copyright ©
Bitcoin: 2014
Concepts, Practice, and IttayEyal,
Research Directions Emin
G
ü n Part IV Sirer Non-technical Ittay Eyal, Emin Gün Sirer Computer Science, Cornell University DISC Bitcoin Tutorial, October 2014
Economy Copyright © 2014 2014
• Deflationary (21 million total) IttayEyal,
• What is it? Emin
G
ü n
• Store of value? Sirer • Method to transact USD?
• So what’s the potential value (USD/BTC)? • Function of mining cost? No! Rate is set. • Ratio of world economy? • Ratio of world transactions, and a function of the time it needs to store value? 2 Reasons for Volatility Copyright ©
• Regulation 2014 • Anti Money Laundering (US/Europe) IttayEyal, •
Adoption / rejection (China, Russia) Emin
• Fiat regulation (Cyprus, greece) G
ü n • Adoption Sirer • Large companies (Dell, PayPal) • Illegal (Silk Road) • Security • Mt. Gox • Technical • Not really
3 Tax Copyright ©
Commodity or currency? Something else? 2014 IttayEyal,
Revenue in Bitcoin Exchange
Emin
G
ü
n Sirer
Mining?
4 Legal Copyright ©
• Payment for illicit goods. 2014
IttayEyal,
Emin
G
ü
n Sirer
• Money laundering • Tumblers • w/ pool fees • Bitcoin ATMs
5 Community Copyright ©
Diverse – a lot of players 2014 IttayEyal,
• Community health Emin G
• Maturing ü
n Sirer • Governance Mostly the Bitcoin Foundation • Protocol changes • Interaction with state regulation • Bitcoin central bank?
• Large service auditing 6
Conclusion Copyright ©
2014 2014
IttayEyal,
Emin
G
ü Average 12.6 Average input 1 n
output 1, amount 1 Sirer 40 input 2 6.5 output 2, amount 2 input 3
Get STRATUM B BGP Attack
C
1
Conclusion Copyright ©
2014 2014
IttayEyal,
Emin
G
ü Average Average input 1 n
output 1, amount 1 Sirer
12.6 40 input 2 6.5 output 2, amount 2 input 3
Get STRATUM B BGP Attack
C
2