Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Consensus Protocols  ›  Lesson

The Consensus Problem

Consensus Protocols 12 minConsensus protocols let independent nodes that do not trust each other agree on a single order of transactions, which stops the same coins being spent twice.

The Consensus Problem

Asha has exactly 5 coins. At the same moment she signs two transactions: one paying all 5 to Ravi, another paying all 5 to Meera. Half the network hears about the Ravi payment first; the other half hears about the Meera one first. Each looks valid on its own. Which one counts? Without a shared answer, the same coins get spent twice. This is the double-spend problem.

The rule

Consensus is how strangers agree on one order, and one order stops double spends.

Once every node agrees which transaction came first, the second is simply invalid, because those coins are already gone. So the real job of a consensus protocol is to agree on the order of blocks, and with it the order of transactions.

Three things make that hard on an open network:

  • No boss. There is no central server entitled to announce "Ravi's came first".
  • Faulty and dishonest nodes. Some nodes crash, lag or lie. A node that may fail in any way at all, including deliberate lying, is called Byzantine, after a classic puzzle about generals who cannot trust all of their messengers.
  • Identities are free. On a public network anyone can start a thousand nodes. If agreement were "one node, one vote", an attacker would simply run more nodes. This is a Sybil attack.

The answer to the last problem shapes every design: blockchains tie influence to something scarce and costly to fake.

Protocol family What earns you a say Covered in
Proof of work Computing power spent on hashing Lesson 2
Proof of stake Coins locked up as collateral Lesson 3
BFT voting A seat in a known set of validators Lesson 4

This is the real meaning of decentralization versus trust. You no longer trust a particular institution. Instead you trust that the rules, the maths and the cost of cheating keep enough participants honest.

The shortcut

Meet any consensus design with two questions: "Who gets to propose the next block?" and "What stops them from lying?"

Settling Asha's double spendStep 1 of 4
  1. Two conflicting transactions

    "Asha pays Ravi 5" and "Asha pays Meera 5" spend the same coins. Nodes disagree about which arrived first.

The trap is thinking consensus establishes the "truth" about the outside world. It only settles the order and validity of transactions inside the chain.

Drills

Answer fast — trust the rule.

quick drill

What problem does agreeing on one order of transactions solve?

quick drill

Why can't a public blockchain decide by "one node, one vote"?

quick drill

What does it mean to call a node Byzantine?

quick drill

The network settles on a block containing "Asha pays Ravi 5". What happens to "Asha pays Meera 5"?

Remember

  • Consensus is how strangers agree on one order, and one order stops double spends.
  • Shortcut: ask who proposes the next block and what stops them from lying.
  • Trap: influence must cost something scarce, such as work, stake or a known seat, or fake nodes win.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainWhy not just vote?

Explain the double-spend problem using Asha's 5 coins, and explain why a public blockchain cannot solve it by giving each node one vote.