The consensus algorithm in Tezos is based on the proof-of-stake mechanism. Proof-of-stake means that participants in the consensus algorithm are chosen in function of their stake (the amount of tokens a participant has). The same mechanism is used in the Tezos governance.
If one does not have enough stake to participate on its own or does not want to set up the needed infrastructure, (s)he can use delegation. Therefore, in Tezos, it is the delegates that may participate in consensus. Delegates’ rights to participate are determined by a follow-the-coin strategy. This procedure is random, in that its result cannot be predicted too much in advance. The randomness is obtained from information already found on the blockchain. Thus, the procedure is also deterministic: delegates’ rights are uniquely determined from the random element.
A delegate is any implicit account registered as such by emitting a delegate registration operation.
Any accounts (implicit or originated) can specify a delegate through a delegation operation.
A delegate participates in consensus and in governance with a weight
proportional with their delegated stake, which includes the balances
of all the accounts that delegate to it, and also the balance of the
delegate itself. To participate in consensus or in governance, a
delegate needs to have at least a minimal stake, which is given by the
TOKENS_PER_ROLL protocol constant.
Delegates place security deposits that may be forfeited in case they do not follow (some particular rules of) the protocol. Security deposits are deduced from the delegates’ own balance.
Active and passive delegates¶
A delegate can be marked as either active or passive. A passive delegate cannot participate in the consensus algorithm.
A delegate is marked as active at its registration.
A delegate becomes passive for cycle
n when they
fail to participate in the consensus algorithm in
PRESERVED_CYCLES cycles, that is, in cycles
n - PRESERVED_CYCLES.
Delegates’ rights selection¶
Tezos being proof-of-stake, the delegates’ rights are selected at random based on their stake.
n is associated with a random seed. The random seed for cycle
n is a 256-bit number generated at the very end of cycle
nonces to which delegates commit during cycle
n-2. One block out of every
BLOCKS_PER_COMMITMENT can contain a commitment. A commitment is the hash of
a nonce. The commitment is generated by the block proposer and is included in
the block header.
The committed nonce must be revealed by the original block proposer during cycle
n-1 under penalty of forfeiting the rewards and fees of the block that
included the commitment. The associated security deposit is not forfeited.
A nonce revelation is an operation and multiple nonce revelations can thus be
included in a block. A reward
SEED_NONCE_REVELATION_TIP is given for
including a revelation. Revelations are free operations which do not compete
with transactions for block space. Up to
wallet activations and denunciations can be contained in any given block.
The seed for cycle
n is obtained as follows: the seed of cycle
hashed with a constant and then with each nonce revealed in cycle
To return to the rights selection mechanism, we first introduce a new
terminology, stake snapshot, to denote the stored (in the
context) stake distribution for a given block. Stake
snapshots are taken (and stored) every
The delegates’ rights at a given level and for a particular role in the protocol are expressed in terms of slots that the delegate receives for that role. The slot owner is obtained by running a PRNG (pseudo-random number generator) with the following input:
the role (a string)
the slot (a non-negative integer)
Let n be the cycle the level belongs to.
The seed of the PRNG is the random seed associated with cycle
The PRNG selects a snapshot from cycle
n-PRESERVED_CYCLES-2 and then it selects a stake in the selected snapshot.
The slot owner is then the stake owner.
Protocols are parameterized by several parameters called protocol constants, which may vary from one protocol to another or from one network to another (for instance, test networks move faster).
The list of protocol constants can be found in the API of the Constants module.
In particular, the protocol constants related to the proof-of-stake mechanism are detailed below.