The Byzantine Generals Problem

5 min read Original article ↗

Can the loyal generals ever be certain they will act as one? The story above hides two different problems, and computer scientists study them separately. In the first, called the Two Generals problem, everyone is honest but riders can vanish. In the second, every rider gets through but someone is lying; that is the Byzantine Generals problem itself. Both have surprising answers. We’ll take them one at a time, but first, the rules.

Puzzle 1 · The lost messenger

“Got it.” “Got your ‘got it.’” …

Start with just two generals, A and B, both completely honest. A wants to attack at dawn, but only if B attacks too. The only danger is the valley between their camps: a rider sent across it can be captured, and his general never finds out.

Predict

General A sends “Attack at dawn.” General B sends back “Got it.” Both riders happen to get through, but each general knows only about the rider who reached him. Can each general now be certain that the other will attack?

Puzzle 2 · The liar

The liar in the ranks

Now flip the danger around. We’re back to three generals, but this time the roads are safe.

Predict

Now every messenger arrives, but one of the three generals might be a traitor who lies. The two loyal generals can send each other as many messengers as they like. Can they always end up doing the same thing?

Through Lieutenant 1’s eyes

Here is how one traitor beats two loyal generals. Put yourself in one lieutenant’s boots.

Add a fourth general

Now add a third lieutenant, and keep the same moves. The commander sends his order to each lieutenant. Each lieutenant then sends the other two a messenger reporting the order he got. Finally, each lieutenant goes with the majority of the three versions he now holds. Walk through two cases, then put on the traitor’s mask yourself.

However you play the traitor, the loyal lieutenants agree. A lying lieutenant is outvoted by two true copies of the order. A lying commander can send different orders to different lieutenants, but because the others relay honestly, every loyal lieutenant ends up holding the same three values, so they all reach the same majority.

That turns out to be a general rule. When a liar can put anything he likes in a message, agreement can be guaranteed only if more than two-thirds of the generals are loyal. Three generals with one traitor falls short; four is enough.

Call the number of traitors f and the number of generals n. For the loyal generals to be guaranteed to agree, no matter what the traitors do, you need:

n ≥ 3f + 1

Fewest generals needed: 3 × traitors + 1
Traitors (f)Generals needed (n)
14
27

Apply

A system has 10 computers, and they send ordinary messages, so a liar can claim anything. At most how many of them can be traitors, with agreement still guaranteed?

The way out

How real systems get out of the trap

This puzzle came out of NASA-funded research into making computers reliable enough to fly airliners. Engineers have never beaten the impossibility. Instead, they change the rules of the game, in one of three ways.

Unforgeable seals

Change
Every order carries a seal nobody can forge. In computers, that’s a digital signature.
You get
Agreement despite any number of traitors. Even three generals are enough, because a two-faced commander’s seal turns up on two different orders.
The price
Every general needs a seal that can’t be faked, and every message still has to arrive.

Clocks and deadlines

Change
Assume messages arrive within a known time. That’s the deadline from Puzzle 2’s rules, and it’s how a missing rider gets noticed: if he isn’t there by the deadline, he isn’t coming.
You get
Systems like PBFT (Practical Byzantine Fault Tolerance, 1999) never give conflicting answers, even when the network is slow, and they keep making progress whenever messages arrive on time. They need 3f + 1 machines: the generals’ two-thirds rule again.
The price
If delays can be unlimited, no method can promise to ever finish, even if just one machine might crash. That was proven in 1985.

Settle for almost certain

Change
Votes count by computing power instead of by identity. That’s Bitcoin’s “proof of work.”
You get
≈0.09%chance that an attacker with 10% of the computing power reverses a payment 5 blocks deep. More blocks, smaller odds; never zero.
The price
It holds only while honest computers control most of the computing power.

Predict

A crypto fan says: “Bitcoin solved the Byzantine Generals problem. Once your payment is confirmed, it’s mathematically impossible to reverse.” Which version is accurate?

What to remember

  • If messages can be lost, two sides can never be certain they agree. Every confirmation needs another.

  • If messages arrive but someone may lie, agreement is guaranteed only when more than two-thirds are loyal: 4 generals to survive 1 traitor.

  • Real systems don’t beat these limits. They change the rules: unforgeable signatures, deadlines, or “almost certain.”

So can the generals ever be certain? Only by changing the rules of the game, and only for as long as those rules hold.

↑ Replay the siege