BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18,...

39
BlockDAG protocols SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar

Transcript of BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18,...

Page 1: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

BlockDAG protocols

SPECTRE, PHANTOM

BPASE’18, Stanford

Yonatan Sompolinsky

Joint work with Aviv Zohar

Page 2: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Motivation

- Algorithms on graphs are fun

- Blockchain does not scale

- BlockDAG - generlization of Satoshi’s paradigm

- 144 blocks per day 1 million blocks per day

Page 3: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

- Proof-of-work

- Miners

- Blocks

- Block rewards

- Transactions

- Transcation fees

- Activity on-chain

- …

Page 4: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

- Proof-of-stake

- ByzCoin [Kogias et al.], Hybrid Consensus/Thunderella [Shi, Pass]

- Lightning Network [Poon and Dryja]

- Sharding protocols

- Blockchain project X

Page 5: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

BlockDAG paradigm

Page 6: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

genesis

block

Blockchain with 10 blocks per second

genesis

block

BlockDAG with 10 blocks per second

Page 7: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

genesis

block

Blockchain with 10 blocks per second BlockDAG with 10 blocks per second

Page 8: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

rule #1: reference tip of longest chain all tips of DAG

rule #2: publish block immediately

DAG mining protocol

new

block

genesis

block

Page 9: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

1. Two honest blocks unconnected in the DAG only if

created at approx same time

2. Rarely more than 𝑘 honest blocks created at approx same time

3. Attacker can create arbitrary structures, but <50%

Key observations

genesis

block

k=2

A

B

C

D

E

G

F

H

J

I

𝑘 = 𝑘(𝐷 ⋅ 𝜆) 𝜆 = 𝑏𝑙𝑜𝑐𝑘 𝑟𝑎𝑡𝑒

𝐷 = 𝑝𝑟𝑜𝑝𝑎𝑔𝑎𝑡𝑖𝑜𝑛 𝑑𝑒𝑙𝑎𝑦

Page 10: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

k=0

A B C D E

k=2

A

B

C

D

E

G

F

H

J

I

k=10

𝑘 ≤ 2 ⋅ 𝐷 ⋅ 𝜆 𝐷 = 𝑝𝑟𝑜𝑝 𝑑𝑒𝑙𝑎𝑦 𝜆 = 𝑏𝑙𝑜𝑐𝑘 𝑟𝑎𝑡𝑒

Page 11: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

• It’s a paradigm, not a solution

• Still need to resolve conflicts, aka double-spends

BlockDAG paradigm

k=10

Page 12: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

The PHANTOM protocol

Page 13: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

A E B

C

G

F K L M

J

D H I

PHANTOM’s goal: recognize cluster of honest

blocks, discard (or penalize) the rest

Page 14: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Definition: A 𝒌-cluster is a subset of blocks such that

each block in it is connected to every block in it, apart

from at most 𝑘 blocks

E not connected to D,H

F not connected to H,I

J not connected to E,F,K,L,D,H,I

A E B

C

G

F K L M

J

D H I

2-cluster

Page 15: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Good news #1: honest blocks form a 𝑘-cluster

A E B

C G

F K

J

D H I

J L Key observations:

1. Two honest blocks are

unconnected in the DAG only if

created at approx same time

2. At most 𝑘 blocks created at

approx same time

honest large k-cluster

Page 16: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Good news #1: honest blocks form a 𝑘-cluster

Bad news: attacker forms a 𝑘-cluster as well

A E B

C G

F K

J

D H I

L M

A E B

C G

F K

J

D H I

L M

honest k-cluster

attacker k-cluster

Page 17: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Good news #1: honest blocks form a 𝑘-cluster

Bad news: attacker forms a 𝑘-cluster as well

Good news #2: honest blocks form a larger one!

A E B

C G

F K

J

D H I

L M

A E B

C G

F K

J

D H I

L M

honest large k-cluster

attacker small k-cluster

Page 18: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Algorithm (NP hard version):

1. Search for largest 𝒌-cluster

2. Order its blocks via some topological ordering

3. Iterate over blocks in the prescribed order, and

accept transactions consistent with history

The PHANTOM protocol

A E B

C G

F K

J

D H I

L M

Page 19: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Algorithm (NP hard version):

1. Search for largest 𝒌-cluster

2. Order its blocks via some topological ordering

3. Iterate over blocks in the prescribed order, and

accept transactions consistent with history

The PHANTOM protocol

Page 20: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Generalization of Satoshi’s paradigm

Page 21: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Forks in the blockchain

A D B

C

F

E G H I

J

deliberate attack? miner of C ignored B

propagation delay? miner of C didn’t receive B yet

What happened here? Who is honest???

Page 22: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Recognizing honest chain of blocks

A D B

C

F

E G H I

J

deliberate attack? miner of C ignored B

propagation delay? miner of C didn’t receive B yet

Page 23: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Recognizing honest chain of blocks

A D B

C

F

E G H I

J

deliberate attack? miner of C ignored B

propagation delay? miner of C didn’t receive B yet

Page 24: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Recognizing honest chain of blocks

A D B

C

F

E G H I

J

1. Two honest blocks unconnected in the DAG chain only if created at approx

same time

2. Rarely more than k 1 honest block created at approx same time

3. Attacker can create arbitrary structures, but <50%

Key observations

Page 25: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Longest chain = Largest 0-cluster

A D B

C

F

E G H J

I

0-cluster

Page 26: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Theorem (Bitcoin):

If attacker<50%, then under low throughput, the largest 0-cluster

(aka longset chain) was created by honest nodes

Theorem (PHANTOM):

If attacker<50%, then under any throughput, the largest 𝑘-cluster

was created by honest nodes, for some suitable 𝑘

Page 27: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

PHANTOM Greedy Algorithm

Algorithm (NP hard version):

1. Search for largest 𝒌-cluster

2. Order its blocks via some topological ordering

3. Iterate over blocks in the prescribed order, and accept

transactions consistent with history

Page 28: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Why not longest-chain of DAG?? b/c orphans do not contribute to honest chain

weight = 5

weight = 6

Page 29: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Why not count all orphans??

weight = 11

weight = 6

Page 30: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Why not count all orphans?? b/c orphans will contribute to attacker chain

weight = 11

weight = 15

I

J L

B

E

D

F

G

C

N

K M

Page 31: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

PHANTOM’s solution: Count all orphans that are well connected to the chain

weight = 11

weight = 10

Longest chain: count no orphans (attackable)

Previous suggestion: count all orphans (attackable)

PHANTOM: count some orphans (secure)

I

J L

B

E

D

F

G

C

N

K M

A

Page 32: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Examples:

B - 0-uncle (it’s inside the chain)

D - 1-uncle (unconnected to E)

H - 2-uncle (unconnected to E,F)

C - 4-uncle (unconnected to B,E,F,K)

A E B

C

G

F K L M

J

D H I

Definition: A 𝒌-uncle of a chain is a block which is unconnected to at most 𝑘 blocks in it

Page 33: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

PHANTOM (greedy version):

1. Search for chain with largest # of uncles of degree ≤𝑘; the chain + uncles are honest

2. Order its blocks via some topological ordering

3. Iterate over blocks in the prescribed order, and accept

transactions consistent with history

PHANTOM (NP hard version):

1. Search for largest 𝒌-cluster; the cluster is honest

2. Order its blocks via some topological ordering

3. Iterate over blocks in the prescribed order, and accept

transactions consistent with history

Page 34: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

The chain with largest number of 2-uncles:

A E B

C

G

F K L M

J

D H I

Page 35: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Security guarantee: For properly chosen 𝑘, 1. (almost) all honest block are uncles of degree ≤ 𝑘 of

heaviest chain

2. (almost) no attacker blocks are uncles of degree ≤ 𝑘 of heaviest chain

3. any topological order over honest blocks will converge

A E B

C

G

F K L M

J

D H I

Page 36: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

PHANTOM pros and cons

• throughput unlimited by the protocol

• easy to implement efficiently

• poor waiting times when conflicts are visible

Page 37: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Desired

throughput

Required

bandwidth

Required

storage

Block

size

Block creation

rate

1,000 txns per sec 0.5 MB per sec ~100 GB per day 50 KB 10 blocks per sec

10,000 txns per sec 5 MB per sec ~1 TB per day 100 KB 50 blocks per sec

1,000,000 txns per sec 500 MB per sec ~0.1 PB per day 0.5 GB 1 block per sec

Throughput

Page 38: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

Scalability, SPECTRE vs PHANTOM

Protocol Throughput

limited by

Confirmation times Ordering

w/o conflicts w/ conflicts

Bitcoin latency slow slow linear

SPECTRE capacity very fast not guaranteed* pairwise

PHANTOM capacity slow very slow linear

SPECTRE +

PHANTOM

capacity very fast very slow pairwise

*under active balancing attack; Weak Liveness

Page 39: BlockDAG protocols SPECTRE, PHANTOMmsagiv/courses/blockchain/... · SPECTRE, PHANTOM BPASE’18, Stanford Yonatan Sompolinsky Joint work with Aviv Zohar . Motivation - Algorithms

More stuff in the paper…

• Other greedy variants

• How to incorporate “red” blocks as well

• Formal proof of convergence

• Waiting times in PHANTOM

• Combining SPECTRE and PHANTOM