Difference between revisions of "IC consensus layer"

From Internet Computer Wiki
Jump to: navigation, search
Line 1: Line 1:
The job consensus layer of the IC is to order transaction requests so that all replicas in a subnet will process  
+
The job of the consensus layer of the IC is to order transaction requests so that all replicas in a subnet will process  
transaction requests in the same order.
+
such requests in the same order.
 
There are many protocols in the literature for this problem.
 
There are many protocols in the literature for this problem.
 
The IC uses a new consensus protocol, which is described here at a high level.  
 
The IC uses a new consensus protocol, which is described here at a high level.  
Line 7: Line 7:
 
Any secure consensus protocol should guarantee two properties, which (roughly stated) are:
 
Any secure consensus protocol should guarantee two properties, which (roughly stated) are:
 
* <b>safety</b>: all replicas in fact agree on the same ordering of transaction requests, and
 
* <b>safety</b>: all replicas in fact agree on the same ordering of transaction requests, and
* <b>liveness</b>: all replicas should make steady progress,
+
* <b>liveness</b>: all replicas should make steady progress.
 
The paper https://eprint.iacr.org/2021/1330 proves that the IC consensus protocol satisfies both of these properties
 
The paper https://eprint.iacr.org/2021/1330 proves that the IC consensus protocol satisfies both of these properties
  
Line 26: Line 26:
 
The IC consensus protocol guarantees safety under this very weak communication assumption.
 
The IC consensus protocol guarantees safety under this very weak communication assumption.
 
However, to guarantee liveness, we need to assume a form of <b>partial synchrony</b>,
 
However, to guarantee liveness, we need to assume a form of <b>partial synchrony</b>,
which (roughly stated) says that the network will be <b>timely</b> periodically.
+
which (roughly stated) says that the network will be periodically <b>timely</b> .
 
Somewhat more precisely, there exists a bound <math>\Delta</math> such that
 
Somewhat more precisely, there exists a bound <math>\Delta</math> such that
 
periodically all undelivered     
 
periodically all undelivered     
 
messages will be delivered within time <math>\Delta</math>.
 
messages will be delivered within time <math>\Delta</math>.
The bound <math>\Delta</math> does not have to be known in advance (the protocol can
+
The bound <math>\Delta</math> does not have to be known in advance  
adapt itself to an unknown <math>\Delta</math> value).
+
(the protocol is initialized with a bound, but will dynamically
 +
adapt and increase this bound if it is too small).
 
Regardless of whether we are assuming an asynchronous
 
Regardless of whether we are assuming an asynchronous
or partially synchronous network,
+
or a partially synchronous network,
 
we assume that every message sent from one honest
 
we assume that every message sent from one honest
 
party to another will <i>eventually</i> be delivered.
 
party to another will <i>eventually</i> be delivered.
Line 63: Line 64:
 
In each round, a pseudo-random process is used to assign
 
In each round, a pseudo-random process is used to assign
 
each replica a unique <b>rank</b>, which is an
 
each replica a unique <b>rank</b>, which is an
integer in the range <math>0,\ldots,</math>.
+
integer in the range <math>0,\ldots,h-1</math>.
 
This is pseudo-random process is implemented using a <b>random beacon</b> (see below).
 
This is pseudo-random process is implemented using a <b>random beacon</b> (see below).
 
The party of lowest rank is the <b>leader</b> of that round.
 
The party of lowest rank is the <b>leader</b> of that round.
Line 69: Line 70:
 
the leader will propose a block, which will be added to the tree;
 
the leader will propose a block, which will be added to the tree;
 
moreover, this will be the <i>only</i> block added to the tree
 
moreover, this will be the <i>only</i> block added to the tree
and it will extend the finalized path.
+
in this round and it will extend the finalized path.
 
If the leader is not honest or the network is not timely,
 
If the leader is not honest or the network is not timely,
 
some other parties of higher rank may also propose blocks,
 
some other parties of higher rank may also propose blocks,
 
and also have their blocks added to the tree.
 
and also have their blocks added to the tree.
 
In any case, the logic of the protocol gives highest priority  
 
In any case, the logic of the protocol gives highest priority  
to the leader's proposed block.
+
to the leader's proposed block
 +
and <i>some</i> block or blocks will be added to this tree in this round.
  
The message complexity per round of the IC consensus protocol is typically <math>O(n^2)</math>.
+
When the network is timely,
 +
the message complexity in a given round of the IC consensus protocol is <math>O(n^2)</math>
 +
with overwhelming probability.  
 
The protocol also enjoys the property known as <b>optimistic responsiveness</b>,
 
The protocol also enjoys the property known as <b>optimistic responsiveness</b>,
 
which means that  
 
which means that  
Line 94: Line 98:
 
which allows many signatures on the same message to be aggregated into
 
which allows many signatures on the same message to be aggregated into
 
a compact multi-signature.
 
a compact multi-signature.
FIXME: citation, discussion of rogue key attack mitigation.
+
FIXME: citation, discussion of rogue key attack mitigation via PoPs.
  
 
<b>Random beacon.</b>
 
<b>Random beacon.</b>
Line 115: Line 119:
 
The Internet Computer implements a new [[non-interactive DKG (NiDKG) protocol]].
 
The Internet Computer implements a new [[non-interactive DKG (NiDKG) protocol]].
  
<b>Block maker.</b>
+
 
 +
<b>Block making.</b>
 
Each replica may at different points in time play the role of a <b>block maker</b>.
 
Each replica may at different points in time play the role of a <b>block maker</b>.
 
As a block maker in round <math>h</math>,  
 
As a block maker in round <math>h</math>,  
Line 127: Line 132:
 
The block <math>B</math> consists of
 
The block <math>B</math> consists of
 
* the payload,
 
* the payload,
* the hash of  <math>B'</math>, and
+
* the hash of  <math>B'</math>,  
* the rank of the block maker.
+
* the rank of the block maker,
 +
* the height <math>h</math> of the block.
 
After forming the block <math>B</math>, the block maker forms
 
After forming the block <math>B</math>, the block maker forms
 
a <b>block proposal</b>, consisting of
 
a <b>block proposal</b>, consisting of
 
* the block <math>B</math>,
 
* the block <math>B</math>,
 
* the block maker's identity <math>\textit{ID}</math>, and
 
* the block maker's identity <math>\textit{ID}</math>, and
* the block maker's signature on <math>B</math> and <math>\textit{ID}</math>.
+
* the block maker's signature on a message comprising <math>B</math> and <math>\textit{ID}</math> (and  the [[registry version]] associated with height <math>h</math>).
 +
A block maker will broadcast its block proposal to all other replicas.
  
XXX
+
<b>Notarization.</b>
 +
A block is only added to the tree of blocks when it becomes <b>notarized</b>.
 +
To become notarized, a block must be approved by <math>2f+1</math> replicas.
 +
To approve a proposed block <math>B</math> at height <math>h</math>,
 +
each replica will verify a number of conditions,
 +
and if these tests pass, the replica will approve the block
 +
and broadcase a <b>notarization share</b> for <math>B</math>,
 +
consisting of
 +
* the hash of <math>B</math>,
 +
* the height <math>h</math> of <math>B</math>,
 +
* the identity <math>\textit{ID}</math> of the approving replica, and
 +
* the approving replica's signature on a message comprising the hash of <math>B</math>, <math>h</math>, and <math>\textit{ID}</math> (and  the [[registry version]] associated with height <math>h</math>).

Revision as of 00:27, 2 November 2021

The job of the consensus layer of the IC is to order transaction requests so that all replicas in a subnet will process such requests in the same order. There are many protocols in the literature for this problem. The IC uses a new consensus protocol, which is described here at a high level. For more details, see the paper https://eprint.iacr.org/2021/1330 (in particular, Protocol ICC1 in that paper).

Any secure consensus protocol should guarantee two properties, which (roughly stated) are:

  • safety: all replicas in fact agree on the same ordering of transaction requests, and
  • liveness: all replicas should make steady progress.

The paper https://eprint.iacr.org/2021/1330 proves that the IC consensus protocol satisfies both of these properties

The IC consensus protocol is design to be

  • extremely simple, and
  • robust (performance degrades gracefully when some replicas are malicious).

As discussed in the introduction, we assume

  • a subnet of [math]\displaystyle{ n }[/math] replicas, and
  • at most [math]\displaystyle{ f \lt n/3 }[/math] of the replicas are faulty.

Faulty replicas may exhibit arbitrary, malicious (i.e., Byzantine) behavior. To simplify the presentation, we assume here that [math]\displaystyle{ n=3f+1 }[/math].


We assume that communication is asynchronous, with no a priori bound on the delay of messages sent between replicas. In fact, the scheduling of message delivery may be completely under adversarial control. The IC consensus protocol guarantees safety under this very weak communication assumption. However, to guarantee liveness, we need to assume a form of partial synchrony, which (roughly stated) says that the network will be periodically timely . Somewhat more precisely, there exists a bound [math]\displaystyle{ \Delta }[/math] such that periodically all undelivered messages will be delivered within time [math]\displaystyle{ \Delta }[/math]. The bound [math]\displaystyle{ \Delta }[/math] does not have to be known in advance (the protocol is initialized with a bound, but will dynamically adapt and increase this bound if it is too small). Regardless of whether we are assuming an asynchronous or a partially synchronous network, we assume that every message sent from one honest party to another will eventually be delivered.

Like a number of consensus protocols, the IC consensus protocol is based in a blockchain. As the protocol progresses, a tree of blocks is grown, starting from a special genesis block that is the root of the tree. Each non-genesis block in the tree contains (among other things) a payload, consisting of a sequence of transaction requests, and a hash of the block's parent in the tree. The honest replicas have a consistent view of this tree: while each replica may have a different, partial view of this tree, all the replicas have a view of the same tree. In addition, as the protocol progresses, there is always a path of finalized blocks in this tree. Again, the honest replicas have a consistent view of this path: while each replica may have a different, partial view of this path, all the parties have a view of the same path. The transaction requests in the payloads of the blocks along this path are the ordered transaction requests will be processed by the execution layer of the Internet Computer.

The protocol proceeds in rounds. In round [math]\displaystyle{ h }[/math] of the protocol, one or more blocks of height [math]\displaystyle{ h }[/math] are added to the tree. That is, the blocks added in round [math]\displaystyle{ h }[/math] are always at a distance of exactly [math]\displaystyle{ h }[/math] from the root. In each round, a pseudo-random process is used to assign each replica a unique rank, which is an integer in the range [math]\displaystyle{ 0,\ldots,h-1 }[/math]. This is pseudo-random process is implemented using a random beacon (see below). The party of lowest rank is the leader of that round. When the leader is honest and the network is timely, the leader will propose a block, which will be added to the tree; moreover, this will be the only block added to the tree in this round and it will extend the finalized path. If the leader is not honest or the network is not timely, some other parties of higher rank may also propose blocks, and also have their blocks added to the tree. In any case, the logic of the protocol gives highest priority to the leader's proposed block and some block or blocks will be added to this tree in this round.

When the network is timely, the message complexity in a given round of the IC consensus protocol is [math]\displaystyle{ O(n^2) }[/math] with overwhelming probability. The protocol also enjoys the property known as optimistic responsiveness, which means that so long as the leader is honest, the protocol will proceed at the pace of the actual network delay, rather than some upper bound on the network delay.


To implement the protocol, each replica is associated with a public key for the BLS signature scheme, and each replica also holds the corresponding secret signing key. The association of replicas to public keys is maintained by the network nervous system (NNS) of the Internet Computer. These BLS signatures will be used to authenticate messages, also called artifacts, sent by replicas. The protocol also uses the signature aggregation feature of BLS signatures, which allows many signatures on the same message to be aggregated into a compact multi-signature. FIXME: citation, discussion of rogue key attack mitigation via PoPs.

Random beacon. In addition to BLS signatures and multi-signatures as discussed above, the protocol makes use of a BLS threshold signature scheme to implement the above-mentioned random beacon. The random beacon for height [math]\displaystyle{ h }[/math] is a [math]\displaystyle{ (f+1) }[/math]-threshold signature on a message unique to height [math]\displaystyle{ h }[/math]. In each round of the protocol, each replica broadcasts its share of the beacon for the next round, so that when the next round begins, all replicas should have enough shares to reconstruct the beacon for that round. As discussed above, the random beacon at height [math]\displaystyle{ h }[/math] is used to assign a pseudo-random rank to each replica that will be used in round [math]\displaystyle{ h }[/math] of the protocol. Because of the security properties of the threshold signature, an adversary will not be able to predict the ranking of the replicas more than one round in advance, and these rankings will effectively be as good as random. To set up such a threshold signature scheme, the Internet Computer runs a distributed key generation (DKG) protocol. There are many DKG protocols in the literature. The Internet Computer implements a new non-interactive DKG (NiDKG) protocol.


Block making. Each replica may at different points in time play the role of a block maker. As a block maker in round [math]\displaystyle{ h }[/math], the replica proposes a block [math]\displaystyle{ B }[/math] of height [math]\displaystyle{ h }[/math] that to be child of a block [math]\displaystyle{ B' }[/math] of height [math]\displaystyle{ h-1 }[/math] in the tree of blocks. To do this, the block maker first gathers together a payload consisting of all transaction requests it knows about (but not including those already included in payloads in blocks in the path through the tree ending at [math]\displaystyle{ B' }[/math]). The block [math]\displaystyle{ B }[/math] consists of

  • the payload,
  • the hash of [math]\displaystyle{ B' }[/math],
  • the rank of the block maker,
  • the height [math]\displaystyle{ h }[/math] of the block.

After forming the block [math]\displaystyle{ B }[/math], the block maker forms a block proposal, consisting of

  • the block [math]\displaystyle{ B }[/math],
  • the block maker's identity [math]\displaystyle{ \textit{ID} }[/math], and
  • the block maker's signature on a message comprising [math]\displaystyle{ B }[/math] and [math]\displaystyle{ \textit{ID} }[/math] (and the registry version associated with height [math]\displaystyle{ h }[/math]).

A block maker will broadcast its block proposal to all other replicas.

Notarization. A block is only added to the tree of blocks when it becomes notarized. To become notarized, a block must be approved by [math]\displaystyle{ 2f+1 }[/math] replicas. To approve a proposed block [math]\displaystyle{ B }[/math] at height [math]\displaystyle{ h }[/math], each replica will verify a number of conditions, and if these tests pass, the replica will approve the block and broadcase a notarization share for [math]\displaystyle{ B }[/math], consisting of

  • the hash of [math]\displaystyle{ B }[/math],
  • the height [math]\displaystyle{ h }[/math] of [math]\displaystyle{ B }[/math],
  • the identity [math]\displaystyle{ \textit{ID} }[/math] of the approving replica, and
  • the approving replica's signature on a message comprising the hash of [math]\displaystyle{ B }[/math], [math]\displaystyle{ h }[/math], and [math]\displaystyle{ \textit{ID} }[/math] (and the registry version associated with height [math]\displaystyle{ h }[/math]).