§ Network · Consensus

How many machines become one computer.

Every service on the Internet Computer runs on many independent replica nodes at once, and behaves as one computer that cannot be tampered with or stopped. That takes agreement, round after round, on two things: the order of every call, and the result of every call. This guide explains the three inventions that produce it, under the names they were given in 2016.

Blocks finalized by the network so farmore than 11 billion

  • Threshold Relay
  • Probabilistic Slot Consensus
  • Optimistic Asynchronous Finalizer
Three tracks, advancing together. A random number, the block it helped to choose, and the seals that make first the order and then the results final.

The three inventions

  1. 1 Makes the random numbers

    Threshold Relay

    Each round the nodes jointly sign the previous round’s number. Only one signature is possible, and it is the next number: a stream of randomness nobody can predict, bend or stop.

    Read part 02
  2. 2 Makes the blocks

    Probabilistic Slot Consensus

    Each number deals the nodes into priority slots. The leader proposes a block of calls, reserves stand by, and the nodes are drawn rapidly to one chain.

    Read part 03
  3. 3 Makes them final

    Optimistic Asynchronous Finalizer

    Votes from more than two thirds of the nodes seal the order of calls. Then, separately, they seal the results of executing them, as one signature anyone can check.

    Read part 04
What must be agreed

One computer, made of many machines.

A subnet is a group of replica nodes, separate machines that host the same services. From outside it is one computer. Inside, it is a constant act of agreement.

A call is a request to a service to do something. When one arrives, every node of the subnet runs it. If all the nodes start from the same data and run the same calls in the same order, they all end with the same data and the same answers. So the whole problem comes down to this: getting every honest node to agree on one sequence of calls, and then on what running them produced. Reaching that agreement is called consensus.

Two things make that hard. The nodes are run by independent parties, and some may crash, drop off the network, or be taken over by an attacker and made to lie. And the internet between them delivers messages late and out of order. To stay correct, the protocol assumes only that fewer than a third of a subnet’s nodes are faulty, in any way at all. It assumes nothing about which ones, or about how long messages take.

In the drawings below a subnet has seven nodes and tolerates two faulty ones. Most subnets today are larger, with 13 to 40 nodes, and the arithmetic is the same. Write f for the number of faulty nodes a subnet tolerates: two, here. Two group sizes do all the work, and they return in every part of this guide: f + 1, three of the seven, and 2f + 1, five of the seven. The figure shows why they are enough.

The two numbers behind every agreement
  1. Some nodes may fail, or lie

    Of the n nodes in a subnet, up to f can be broken or hostile, and nobody knows which. With 7 nodes, f is 2.

  2. Any f + 1 include an honest node

    A group one bigger than the number of faulty nodes cannot be all faulty: any 3 of 7. This is the size the random numbers need.

  3. 2f + 1 can always be gathered

    Even if every faulty node stays silent, 5 honest nodes remain to answer. Decisions wait for this many signatures.

  4. Two such groups always overlap

    There are only 7 nodes, so any two groups of 5 share at least 3 of them (f + 1). At least one honest node is in both.

  5. So a sealed decision cannot be contradicted

    A faulty node may vote to seal two conflicting things; an honest node votes to seal only one. Once one decision has its 5 votes, the other can never reach 5.

Up to 2 of 7 may be faultyNobody knows whichAny 3 nodesAt least 1 is honest5 honest nodes answerEven if 2 stay silentGroup A: 5 nodesGroup B: 5 nodesVotes for one only3 in both1234567n = 7nodesf = 2may be faultyf + 1 = 3at least one honest2f + 1 = 5always answeroverlap = 3at least f + 1
Subnet size

A deciding group is n − f nodes. When n is exactly 3f + 1, as it is for each of these sizes, that is 2f + 1.

Nodes
n = 7
May be faulty
f = 2
Any-honest group
f + 1 = 3
Deciding group
2f + 1 = 5
Overlap shown
3 nodes
Honest in both
1 node
The overlap is the whole trick.

With 7 nodes, two groups of 5 share at least 3, of which at most 2 can be faulty: an honest node is always in both. The two groups drawn in step 4 are the worst case: they share 3, and only one of those is honest. One is enough.

Invention one · Threshold Relay

Random numbers that nobody can predict, bend or stop.

Agreement starts with chance. If every node can see the same unpredictable number in each round, the network can use it to choose who leads, and nobody gets a say.

Shared randomness is a hard thing for a network to make. If one node rolls the dice, it can cheat. If the nodes vote on a number, they already need the agreement they were trying to build. Threshold Relay, devised in the spring of 2015, gets it from a property of one particular kind of signature. A digital signature is a number that only the holder of a secret key can produce, and that anyone can check with the matching public key.

For its random numbers a subnet has a signing key that no node holds. Each node holds a share of it. To sign a message, each node makes a signature share, and any sufficient number of shares, here three of seven (f + 1), combine into one signature from the subnet as a whole. That number is the threshold, and the result is called a threshold signature. The scheme is BLS, named for Boneh, Lynn and Shacham, and it is unique and deterministic: for a given key and message exactly one valid signature exists, and it comes out the same whichever nodes took part.

Now let the message be the previous signature. The nodes sign it. What comes out is a number nobody could have known in advance, because making it takes a secret that no small group holds. And nobody could have influenced it, because only one value is possible. The signature is the random number. It is also the message for the next round, so each signature relays to the next, without end.

The nodes agree on a new random number in every round without running a consensus protocol to do it.

That is easy to pass over. Every node that collects enough shares computes the same number, at once, with no voting and no negotiation. And a network that already shares a stream of unpredictable numbers has something solid to build real consensus on.

One round of Threshold Relay
  1. Start from the last number

    The message to sign is the previous round’s random number. Every node already has it.

  2. Every node signs it

    No node holds the secret key. Each holds one share of it, makes a signature share with that, and sends it to all the others.

  3. Any three shares combine

    Three shares are enough, whichever three arrive first (f + 1 of 7). Two reveal nothing about the result.

  4. One possible result

    With BLS, a key and a message have exactly one valid signature, so every node computes the same number. Nobody voted, and nobody could choose it.

  5. Relay

    That signature is this round’s random number. It joins the sequence, and it is the message the nodes sign next.

1234567
Try to change the number

Or press up to 2 nodes on the drawing to switch them off.

Message signed
663f…47bb
Shares used
nodes 2, 7, 4
Signature
4213…1604
Same number, whoever signs.

The shares differ from node to node, and they arrive in a different order every time. The signature they combine into is always the same one.

The arithmetic is real. Your browser runs a small threshold signature scheme: any three shares give the same value. It works on plain numbers; the network does the same with BLS signatures on an elliptic curve, which adds that no key can be worked back from a share or a signature, and that anyone can check every share and the result against public keys. That check is what rejects a forged share; here it is drawn, not computed.
  • UnpredictableIt takes three of the seven nodes to compute the next number, so two faulty nodes cannot work it out by themselves. They cannot have it until an honest node releases its share.
  • UnmanipulableOnly one valid signature exists. A node can decline to take part; it cannot change what comes out.
  • DeterministicThe same key and the same message give the same number, whoever signs and in whatever order.
  • VerifiableEvery share, and the signature they make, is checked against public keys. A forged share is simply discarded.
  • Fault-tolerantAny three nodes are enough, so the faulty ones cannot stop the sequence by staying silent.
Invention two · Probabilistic Slot Consensus

A lottery for leadership, held in every round.

The random number decides whose turn it is. The order of the nodes is settled by chance, in the open, moments before it is needed.

In each round, the new random number shuffles the subnet’s nodes into a ranking of priority slots. Slot 0 is the round’s leader. Slot 1 is the first reserve, slot 2 the second, and so on down the list.

The leader gathers the calls that are waiting, bundles them into a block that points at the block before it, and sends it to every node. The reserves hold back. Each may propose a block of its own only after a delay that grows with its slot, and the other nodes will only consider a reserve’s block after waiting as long. A prompt leader has the round to itself.

Each node checks the best-ranked block it has seen and signs it. When five of the seven have signed (2f + 1) the block is notarized: proof that it is valid, and that it was published in time for the network to see it. With that the round is over and the next one begins.

If the leader is slow, silent or dishonest, nothing is re-run and nobody has to be voted out. The reserves were dealt in the same shuffle as the leader, so the first reserve steps in and its block is notarized, a little later. The chain grows in every round. A block’s height is its place in the chain: the block made in round h sits at height h.

Why probabilistic? The slots are dealt by chance, and more than two thirds of the nodes are honest, so the leader of a round is honest more than two times in three. The quick path is the usual one, and the chance of a run of bad leaders shrinks fast: less than a third, then a ninth, then a twenty-seventh. A round with an honest, prompt leader has exactly one block, so every such round pulls all the nodes onto the same chain: they are drawn rapidly to agreement.

One round of Probabilistic Slot Consensus
  1. The random number deals the slots

    This round’s number from Threshold Relay shuffles the seven nodes into a priority order. Nobody could know the order before the number existed.

  2. Slot 0 proposes a block

    The leader bundles the calls that are waiting into a block, linked to the block before, and sends it to every node.

  3. The nodes sign the best block they have seen

    Each node checks the block and signs it. Signatures from five of the seven (2f + 1) notarize it: proof that it is valid and was published on time.

  4. The reserves stay silent

    Slots 1 and 2 may only propose after growing delays, and nodes only sign their blocks after waiting as long. The leader was prompt, so they are never needed.

  5. New round, new number, new deal

    The chain is one block longer. A fresh random number is about to deal the slots afresh, so nobody can plan to be the leader.

RoundRandomnumberSlot 0leaderSlot 1first reserveSlot 2second reserveSlots 3 to 6h − 2h − 1hh + 14213…160474ed…76cb4a3e…3a2c0c95…e348noblocknot needed1notarizeddeadnoblocknot needed3notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed2notarizeddeadnoblocknot needed6notarizeddeadnoblocknot needed4notarizeddeadnoblocknot needed1notarizeddeadnoblocknot needed7notarizeddeadnoblocknot needed3notarizeddeadnoblocknot needed4notarizeddeadnoblocknot needed6notarizeddeadnoblocknot needed2notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed5notarizeddeadnoblocknot needed5notarizeddead4623715
Change how the round goes
Leader
node 4
Notarized by
not yet
Blocks this round
0
The usual round.

One block, notarized at once. The reserves are dealt their slots too, and never have to use them.

The deal is real. Each deal here is worked out from the number above it. The layout follows the slides from the 2017 Stanford presentation of the protocol: columns are rounds, rows are slots, and every block points back to its parent. As on the slides, each number is drawn arriving when the round before it is notarized; today the nodes begin signing the next number as soon as a round starts, so it is ready a little sooner.
Invention three · Optimistic Asynchronous Finalizer

A seal that cannot be undone.

Notarized is not yet final. The finalizer is the part that says: this block, and no other, for good.

A notarized block is valid and on time, and that is all a signature on a block says. On a slow network an honest node may sign the first reserve’s block and then, when the leader’s block arrives late, sign that too. So two blocks can be notarized at the same height, and something has to choose between them for good. Earlier blockchains left users to wait while more blocks piled on top, until a reversal became unlikely. The finalizer makes reversal impossible, and in the usual round it does so straight away.

The rule is short. A node that sees a notarized block, and has signed no other block at that height, says so by casting a finalization vote for it. Unlike a signature, a vote is exclusive: an honest node votes for one block at a height, or for none. When a block has the votes of five of the seven nodes (2f + 1) it is final, or sealed, and so is every block before it.

The reason is the overlap from the first figure. Once a block has its five votes, a rival at that height would need five signatures of its own. Two groups of five among seven nodes share at least three, so at least one honest node would have to be in both. But an honest node that voted has signed no other block at that height, and never will: for that node the round is over. The rival can never be notarized.

The trap has shut.

How a block becomes final
  1. A block is notarized

    Five nodes of seven have signed it: it is valid, and it was on time. That does not yet prove it is the only block at its height.

  2. Each node asks itself one question

    “Did I sign any other block at this height?” A node that signed only this one says so, with a finalization vote.

  3. Five votes shut the trap

    Five votes (2f + 1) finalize the block. A rival would also need five signatures, and the two groups of five would share an honest node. But an honest node that voted has signed nothing else at this height, and never will.

  4. Everything before it is final too

    A seal covers the whole chain before it. The order of every call in those blocks can never change.

  5. And the chain did not wait

    The finalizer works alongside block making, not in its way: the next round began as soon as the block was notarized.

height h − 1height hheight h + 1already under way1234567
Choose a round
Votes
0 of 7
Sealed up to
h − 1
Optimistic.

In the usual round, finality arrives straight after the block, with no extra waiting.

Why five. With seven nodes of which two may be faulty (3f + 1 nodes, f = 2), five is 2f + 1. Any two groups of five share at least three nodes, so at least one honest node, and an honest node that signed two blocks at a height votes for neither. So a sealed block and a notarized rival cannot both exist. Most subnets are larger, and the arithmetic is the same.
Optimistic
In the usual round there is one block, every honest node votes for it at once, and finality arrives right behind the block: no extra rounds and no waiting period, at the speed of the network itself.
Asynchronous
The finalizer runs beside block making, and a round does not wait for it: the next round begins as soon as a block is notarized. If a round is contested the chain keeps growing, and the next seal covers everything before it. Its safety does not depend on timing: however long messages are delayed, two rival blocks can never both be sealed.
Finalizer
A seal is 2f + 1 votes. On the order of calls, each vote is a node’s own signed statement, and the votes are bundled together. On the results of calls, described next, each vote is a signature share, and the shares fuse into a single threshold signature.
The architecture · two levels

First the order. Then the results.

The Internet Computer agrees twice. It finalizes what is to be executed before executing it, and then it finalizes what execution produced.

Blocks hold calls, not outcomes. Level one, everything described so far, fixes the sequence in which calls must be taken in. It does not run them. Once a block is final, its calls join the queues of the services they are addressed to.

Every node then executes the queued calls, in the agreed order, against identical data, and so arrives at identical results. Calls take as long as they take. A simple one finishes in the round it starts. A long computation is spread across many rounds. A call that asks another service for something waits for the answer. So results come out in a different order from the one the calls went in, and ordering does not wait for any one call to finish.

Level two records what happened. In every round the nodes make a record of what execution has produced for the outside world: chiefly the answers to callers and the messages bound for other subnets. They reduce it to a fingerprint, a short number that would change if any detail of the record changed. Each fingerprint also takes in the one from the round before, so the records link into a second chain. Then the finalizer seals it. 2f + 1 nodes each make a signature share on the fingerprint, and the shares fuse into one threshold signature. The key is the subnet’s main one, shared out so that signing takes five shares of seven, not the relay’s three.

The two levels keep an eye on each other. Blocks note how far the results have been sealed, and only if sealing as a whole falls behind does ordering slow until it catches up. For the caller the outcome is simple: an answer arrives carrying the subnet’s signature, and anyone who has the subnet’s one public key can check it. No single node has to be trusted, and it does not matter which one delivered it.

Four calls, from arrival to signed result
  1. Calls are put in order

    Blocks carry calls, not outcomes. Level one decides only which calls come in which order.

  2. The order is sealed

    Once a block is final its calls can never be reordered. They join the queue for execution.

  3. Every node executes them

    Each node runs the calls in the agreed order on identical data, so all arrive at identical results. A call may finish at once, run for many rounds, or wait on another service.

  4. Each round’s results are sealed

    Every round the nodes fingerprint a record of what execution has produced, together with the previous round’s fingerprint. Five of the seven (2f + 1) each make a signature share on it, and the shares fuse into one signature.

  5. The caller gets a signed answer

    The result comes back with that signature. Anyone can check it against the subnet’s one public key, without trusting any single node.

round 1round 2round 3round 4round 5round 6Level 1the orderExecutionon every nodeLevel 2the resultsnoted in blockABCDqueuedABwaitingCDBDCA5 of 7 shares, one signaturecallerA
Follow a call
Ordered
1st, in round 1
Finished
4th, in round 5
Rounds of work
4
In by the order. Out when ready.

A went in first and came out last. It computed for four rounds, and B, C and D, calls to other services, did not have to wait for it: each was sealed and answered as soon as it was done.

Two chains. Results are not written into the blocks of level one. They are a chain of their own, a record for every round, and a block only notes how far that chain has been sealed.
What it adds up to

Fast, final, and very hard to stop.

Each property below follows from the parts above. Together they are why services on the Internet Computer can be called tamperproof and unstoppable.

  • 6.1 Speed

    Final in a second or two.

    In the usual round a call’s place in the order becomes permanent about as fast as the network can carry the messages. Nobody waits for more blocks to pile on top: once a block is sealed, it is final.

  • 6.2 No fixed leader

    No single target to attack or bribe.

    The leader of a round is chosen by a number that did not exist moments earlier. If it falters, a reserve dealt in the same shuffle steps in after a short wait.

  • 6.3 Fault tolerance

    Keeps going when nodes fail.

    Fewer than a third of a subnet’s nodes can crash, vanish or lie, and the rest carry on. A round led by a healthy node runs at full pace; one whose leader has failed costs a short wait for a reserve.

  • 6.4 Safety

    Safe on a bad network.

    Delays, outages and network splits can slow finality down. They cannot produce two conflicting histories.

  • 6.5 Verifiability

    One signature to check.

    Results carry a single signature from the whole subnet, small enough for a phone or a browser to verify against one public key.

  • 6.6 Throughput

    Computing does not hold up agreement.

    Ordering and execution are kept apart. A heavy computation is spread over as many rounds as it needs, and the chain keeps its rhythm. Ordering slows only if execution as a whole falls behind.

Lineage

From a 2015 idea to the network of today.

The assembly was devised by Dominic Williams in 2015 and 2016, formalized with colleagues in 2018, and refined and proven in the years since. Its three parts still drive every subnet and cloud engine.

  1. Threshold Relay

    Dominic Williams invents Threshold Relay as a means of producing random numbers in a decentralized way. He meets Dan Boneh, a cryptographer at Stanford, who introduces him to BLS (Boneh–Lynn–Shacham), which becomes the unique, deterministic signature scheme applied. Later Ben Lynn joins DFINITY.

  2. Probabilistic Slot Consensus

    During his search for high-performance blockchain designs that might outperform classical asynchronous consensus, Dominic Williams invents Probabilistic Slot Consensus and begins presenting it at meetings on the early crypto scene.

  3. Stanford

    The scheme is presented at Stanford’s Blockchain Protocol Analysis and Security Engineering conference, in a talk titled “Threshold Relay: How to Achieve Near-Instant Finality in Public Blockchains using a VRF”. The slides call the second part the Probabilistic Slot Protocol, and reach finality through notarization and the relay moving on, without a separate vote.

  4. The first paper

    Timo Hanke, Mahnush Movahedi and Dominic Williams publish DFINITY Technology Overview Series, Consensus System, setting out the random beacon, the Probabilistic Slot Protocol and notarization.

  5. The network launches

    The Internet Computer goes live on the refined protocol: finality by explicit vote, and safety that no longer depends on timing. Its subnets have run it ever since.

  6. Published and proven

    Internet Computer Consensus, by Jan Camenisch, Manu Drijvers, Timo Hanke, Yvonne-Anne Pignolet, Victor Shoup and Dominic Williams, sets out the protocol the network runs and what it guarantees: it stays safe on an asynchronous network, and moves at the speed of the network when the leader is honest. The proofs are in the full version.

The 2016 names, and the terms in today’s papers
Named in 2016What it doesIn the papers
Threshold RelayMakes a new random number in every round.random beacon
Probabilistic Slot ConsensusRanks the nodes, then proposes and notarizes blocks of calls.ranks, block makers, notarization
Optimistic Asynchronous FinalizerSeals the order of calls, and then their results.finalization; certification of the per-round state
The papers

Read the full account.

More in Network

Continue reading.