[Note: this lecture is based on material in Elaine Shi's textbook in chapters 5, 6, 12, and 13.]
In the last few lectures, we studied the Byzantine Broadcast problem. In this question:
There are a total of $n$ parties, including the sender. Within the group, there is a subset of $f$ generals who can be faulty in arbitrarily-malicious ways, including the sender.
These protocols can be constructed for different types of networks.
Bounded vs unbounded delay:
Network setup:
We introduced two protocols in the synchronous setting:
Then we introduced one protocol in the asynchronous setting: Bracha's broadcast.
Dolev-Strong |
Phase-King |
Bracha broadcast |
|
---|---|---|---|
Β PKI | Β YES |
Β NO | Β NO |
Synchronous network |
Β YES | Β YES | Β NO |
Number of fauly parties |
Β f β€ n - 2 | Β f β€ (n-1)/(3) | Β f β€ (n-1)/(3) |
Number of rounds |
Β f+1 | Β 3(f+1) | Β constant |
Guaranteed termination? |
Β YES | Β YES | Β NO |
Byzantine Broadcast protocols guarantee the following properties.
Throughout this course, our security guarantees only protect the honest parties. That's because we have no idea what the corrupted parties will do; we can't stop them from taking a different action nor can we protect one corrupted party from another corrupted party.
One exception here: in the asynchronous setting, we do not require termination because it is impossible to achieve. In particular:
In today's lecture, let's revisit Byzantine broadcast in the synchronous model. Recall that we have constructed two protocols that we could use.
Both of these protocols achieve our security guarantees of termination, agreement/consistency, and validity. But they are admittedly slow to reach consensus.
Can we do better?
Theorem. [Dolev-Strong] No deterministic protocol (even with a PKI) can achieve Byzantine Broadcast in fewer than $f + 1$ rounds.
We're not going to prove this theorem formally. But why do you think it might be true?
Source:Wikipedia
This issue is easier to see in the phase-king protocol, where each party in turn acts as a "king" (or leader) for an epoch of 3 rounds.
In the worst case, it could be the case that our adversary has corrupted the first $f$ parties. As a result, we cannot be sure that we have learned anything until there is an epoch that is led by an honest party.
Even more nefariously: our adversary might wait until we decide upon an ordering of the parties, and then adaptively corrupt the first $f$ parties in the ordered list.
The Dolev-Strong protocol has a similar issue, even though it does not follow the style of electing one leader per epoch. And it turns out that every deterministic protocol suffers from the same fate.
But what if we consider a protocol that makes random choices? Can we do better? How could we even take advantage of randomness to foil the adversary?
Let's imagine that the $n$ parties can get together to flip a coin.
In the physical world, a coin is a powerful object that provides some nice guarantees.
(Note: if all $n$ parties are colluding together, then they can break these properties since they could just set the coin to be the value that they all like. But in this case, there is no honest party to protect.)
These properties are very cool! It would be great if we can build such a CommonCoin in the digital world.
If we could do this, it would solve many challenges involving agreement.
For instance: suppose you and your friends are talking on the telephone and trying to decide where to eat dinner. Each of you prefers a different restaurant, and you want to pick fairly between them. A CommonCoin protocol would let you "toss a coin" over the phone.
But there is bad news here: it is impossible to design any protocol that guarantees these properties for any number of faulty parties $f < n$.
The good news is that we can build a CommonCoin protocol that can withstand a minority of faulty or adversarial parties, say $f < n/3$.
We will discuss how to build a CommonCoin protocol next time. For now, let's just assume that it exists.
What can we do with a CommonCoin, beyond choosing a restaurant for dinner?
Returning back to our original question: can we build a faster Byzantine broadcast protocol that can complete in fewer than $f+1$ rounds?
Recall that the phase-king protocol has the following structure.
This protocol satisfies:
Question. How can we improve upon this protocol using randomness?
Here is one option:
How many epochs of this protocol do we need to run, in order to be convinced that there has been an epoch led by an honest party with overwhelming probability?
Let's consider this question in the setting where $f = \frac{n}{3} - 1$. That is, there are approximately $2/3$ honest parties and $1/3$ faulty parties.
The CommonCoin protocol guarantees that the choice of leader is unbiased. So, each epoch individually has a $2/3$ chance of being led by an honest party.
If we run for $k$ epochs, then the probability that there are no honest leaders is $\left(\frac{1}{3}\right)^k$.
Hence, the probability of having at least one epoch with an honest leader is $1 - \left(\frac{1}{3}\right)^k$.
This is a powerful observation!
For example: if we want to ensure that we reach agreement with $n = 10^6$ parties, then we have two options.
Let's take state of where we stand in this course so far.
[Image source: Nakamoto whitepaper]
Question. How are these problems related?
There are some similarities between the problems:
But also, there are some differences between broadcast and blockchains.
One-shot vs long-running
Computational power
[Image source: blockchain.info]
Time to finalize a transaction
Assumptions about the network
That said, there is nothing that stops us from designing a blockchain that relies upon the assumption of a synchronous network. Let's do that now.
So far we have only seen a blockchain in one context: within the Bitcoin protocol.
Let's abstract away from what we have seen in the Bitcoin context, and define the objectives of a "blockchain" more generically.
A blockchain has three types of data:
Definition. Let's define a blockchain protocol in the synchronous setting as any interactive protocol that distributes a log. It must satisfy the following two properties:
Consistency: all parties have the "same" view of the linearly-ordered log. But since the chain may take some time to propagate, it's acceptable if some parties record a block in their chain before other ones do.
Formally: for any pair of honest parties $i$ and $j$ and at any round $r$, it must be the case that party $i$'s log is a subset of party $j$'s log, or the other way around. (Note: these need not be proper subsets; the two parties could fully agree on the log.)
Liveness: there is some upper bound $\Delta$ on the number of rounds that it takes for a transaction to be included in the agreed-upon log.
Formally: if an honest party receives a transaction $tx$ at some round $r$, then by the end of round $r + \Delta$ all honest parties' logs must include this transaction.
(One more bit of terminology: once a single transaction $tx$ reaches this point, we say that the transaction is finalized. This means that it has been confirmed and cannot be undone, aka double-spent, from then onward.)
Let's consider the following question: starting from a Byzantine Broadcast protocol, can we construct a blockchain?
Source:Wikipedia
[Image source: Nakamoto whitepaper]
For now, let's limit consider the easiest options of all design parameters:
Question. How might we do this?
Here is one way to build a blockchain, starting from any $R$-round Byzantine Broadcast protocol.
Epoch 1 (containing $R$ rounds):
Now repeat this cycle forever:
Impressively, this simple construction works! You can instantiate it with Dolev-Strong if a PKI is available, with phase-king if there is no setup, or any other Byzantine Broadcast protocol that you want.
Theorem. Let BB denote any Byzantine Broadcast protocol in the synchronous setting, which can communicate messages from a particular set (e.g., one bit, or multi-bit messages) within $R$ rounds for a network of $n$ parties and tolerating up to $f$ faulty parties.
Then, the above blockchain construction satisfies consistency and liveness with $\Delta = O(Rn)$, also for the same $n$ and $f$ and the same setup assumptions.
Proof of consistency. This follows immediately from the agreement/consistency property of the underlying Byzantine Broadcast protocol.
The broadcast protocol guarantees that at the end of each epoch, "all honest parties decide the same value" for the block to add to the log in that epoch.
As a result, honest parties always have exactly the same log, because the protocol states that honest parties only append to the log at the end of each epoch.
Proof of liveness. To argue this claim, let's think about how a transaction $tx$ might be sent by someone in the world to one or more of the $n$ parties in the permissioned blockchain.
If a transaction $tx$ is sent to a single honest party, then there are at most $n$ epochs until that party becomes the designated sender and can add the transaction to a block that gets included in the log.
If a transaction $tx$ is sent to all parties, then there are at most $f+1$ epochs until some honest party is nominated to the role of the designated sender. This party will include the transaction $tx$ in its block (note: for now we are assuming that block sizes can be unbounded).
Since each epoch takes $R$ rounds, and we typically think of $f$ as being a constant fraction of $n$: in either case it takes $O(Rn)$ rounds to guarantee that a transaction gets added to the log.
Let's step back and think about what we have just accomplished.
On the one hand: this is an amazing result! It states that if we know how to build Byzantine Broadcast, then in some sense we have solved the problem of making a blockchain and therefore a financial transaction system.
On the other hand: this blockchain protocol not that great for a few reasons.
It is really slow; that is, it takes awhile for your transactions to get included in a block. If each round takes 1 second and there are $n = 301$ parties running phase-king with $f = 100$ faulty parties, then each broadcast requires $303$ seconds and liveness takes $30603$ seconds or about $8.5$ hours for your transaction to be finalized.
So if you want to buy lunch, the restaurant might force you to sit there all afternoon and evening to make sure your transaction settles before they will let you leave.
We made a lot of assumptions along the way that are unrealistic or sub-optimal for a financial transaction system, such as network synchrony and the existence of a permissioned set of $n$ parties that will handle all financial transactions for the rest of time.
The good news is that we can withstand any $f$ of them getting bored and deciding to quit the system... but what happens if more of them want to leave? Or what if they eventually become punch-drunk with power and decide that they want to use this power for nefarious purposes?
The nice thing about asynchronous, permission-less systems like Bitcoin is that they are more stable in the face of such power.