30
Prism: Scaling Bitcoin by 10,000× Lei Yang 1 Vivek Bagaria 2 Gerui Wang 3 Mohammad Alizadeh 1 David Tse 2 Giulia Fanti 4 Pramod Viswanath 3 1 MIT CSAIL 2 Stanford University 3 University of Illinois Urbana-Champaign 4 Carnegie Mellon University The Stanford Blockchain Conference 2020

Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Prism: Scaling Bitcoin by 10,000×

Lei Yang 1 Vivek Bagaria 2 Gerui Wang 3 Mohammad Alizadeh 1

David Tse 2 Giulia Fanti 4 Pramod Viswanath 3

1MIT CSAIL

2Stanford University

3University of Illinois Urbana-Champaign

4Carnegie Mellon University

The Stanford Blockchain Conference 2020

Page 2: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Bitcoin: high security, low throughput, and long latency

I Security: 50% adversary

I Throughput: 7 tps

I Confirmation Latency: hours

Page 3: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Prism: decoupling performance from security

I Bitcoin: throughput, latency coupled with security

I Prism: decouple performance from security

Page 4: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

This talk

The Prism consensus protocol

System implementation

Evaluation results and findings

Page 5: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

This talk

The Prism consensus protocol

System implementation

Evaluation results and findings

Page 6: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Bitcoin: the longest chain rule

Mining rate = 1 block per 10 min

Page 7: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Bitcoin: k-deep confirmation rule

TXTXConfirmed TX Private chain

Longest chaink

Longest chain

30% adversary powerFor 10−3 attack probability, wait 250 mins!

Nakamoto’s Table

k ε0 1.00000005 0.1773523

10 0.041660515 0.010100820 0.002480425 0.000613230 0.000152235 0.000037940 0.000009545 0.000002450 0.0000006

Page 8: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Calculating the performance of Bitcoin

Throughput

Block size × Mining rate

Latency

Confirmation depth (k) ÷ Mining rate

Page 9: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Increasing the mining rate or the block size causes forking

Forking happens when the next block ismined before the previous one is received.

I Mine faster → Shorter interval

I Bigger blocks → Slower propagation

Page 10: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Forking compromises security

0%

25%

50%

Security

Mining rate / Block sizeBitcoin performance is coupled with security!

Page 11: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Deconstructing a block: proposing and voting

TX Add new transactions

Certify previous blocks

Page 12: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Scale proposing with lots of transaction blocks

Forking does not matter among transaction blocks!

Throughput , latency

Page 13: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Scale voting with lots of voter chains

. . .

. . .

. . .

. . .

I 1 voter chain: 25-deep

I 1000 voter chains: 2-deep

Page 14: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Prism is provably fast and secure

Adversary power β < 0.5Network bandwidth C , network latency D, confirmation reliability ε, m voter chains

I Security: consistency and liveness

I Throughput: (1− β)C

I Confirmation Latency: O (D) + O(−D log(ε)

m

)

Page 15: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Understanding the real-world performance of Prism

I Protocol more complex than Bitcoin

I Theory based on simplified assumptions

I Unknown constants in confirmation latency

I Other bottlenecks besides network

Page 16: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

This talk

The Prism consensus protocol

System implementation

Evaluation results and findings

Page 17: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Implementing Prism in Rust

I 10,000 lines of Rust

I Unspent Transaction Output (UTXO) model

I Pay-to-public-key transactions

I Code available at t.leiy.me/prism-code

Page 18: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Prism: ∼70,000 tps and ∼10s latency

100

101

102

103

104

105

1 10 100 1000

β=20%

β=20%

Throughput (tps)

Latency (s)

AlgorandLongest Chain

Prism

β=20%

Bitcoin-NG

β=20%

Page 19: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Blockchain client: consensus and ledger keeping

I Consensus: keep track of theblockchains and mine

I Ledger keeping: process transactionsand calculate the UTXO set

Blocks

Consensus

Ordered Transactions

Ledger Keeping

UTXO Set

Page 20: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Achieving high throughput

LessonsI Bottlenecks: ledger keeping, SSD

I Must parallelize

Optimizations

I “Scoreboarding”

I Async ledger keeping

I Functional design pattern

I No transaction broadcasting

Page 21: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Parallelize ledger keeping with scoreboarding

A→C

A→D

B→E

E→F

BAC EFD E A C

A D

B EE

E F

Scoreboard: A, C A, B, C, E A, D A, D, E, F

Page 22: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Parallelize ledger keeping with scoreboarding

2×104

4×104

6×104

8×104

0 2 4 6 8 10 12 14 16

Throughput (tps)

#Cores

Page 23: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Parallelize consensus with async ledger update

I Ledger updates are “infrequent”

I Don’t do it every new block

Page 24: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

The Prism consensus protocol

System implementation

Evaluation results and findings

Page 25: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Testbed setup

I 100 - 1000 AWS EC2 instances

I Random 4-regular graph

I 120ms propagation delay

I 400 Mbps bandwidth

Page 26: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Experiments

I Comparison of throughput, latency with Algorand, Bitcoin-NG, Longest Chain

I Scalability to 1000 nodes

I CPU, bandwidth utilization

I Censorship, spamming, balancing attacks

Page 27: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Comparison with Algorand, Bitcoin-NG, Nakamoto

100

101

102

103

104

105

1 10 100 1000

β=20%

β=20% β=33%

Throughput (tps)

Latency (s)

AlgorandLongest Chain

Prism

β=20%

β=33%

β=40%

β=43%

β=44%

Bitcoin-NG

β=20%

β=33%

Page 28: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Our implementation is efficient

CPUI Signature check: 22%

I RocksDB: 53%

I Data serialization: 7%

BandwidthI Transaction blocks: 99.5%

I Voter blocks: 0.4%

I Proposer blocks: 0.1%

Page 29: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Takeaways

I Deconstruct blockchain into proposing and voting

I Scale each part to the physical limit

I Must parallelize everying in the client

I Current bottleneck is ledger keeping and SSD

I Simple and natural extension of Natamoto

Page 30: Prism: Scaling Bitcoin by 10,000 · 2020-02-23 · Bitcoin: the longest chain rule Mining rate = 1 block per 10 min. Bitcoin: k-deep con rmation rule Con rmed TX Private chain k Longest

Resources

I Code: t.leiy.me/prism-code

I Theory Paper: Deconstructing the Blockchain to Approach Physical Limits

I System Paper: t.leiy.me/prism-paper

I Online Demo: t.leiy.me/prism-demo