Skip to content

Epochs and Leaders

Election

  1. Open. The VRF system proposes an epoch with candidates that meet the scope's policies. The ledger checks that each is active and in the scope.
  2. Seed. In a following block, the ledger derives the seed from a random beacon that nobody could know when the epoch was opened.
  3. Evaluate. Each candidate computes its VRF output for the seed in an enclave, with a key for this epoch, and submits the proof.
  4. Finalize. After the window, the ledger verifies the proofs and ranks the outputs. The highest form the quorum, and the first is the leader.

The outputs are mixed into the beacon for the next epoch. If the VRF system does not finalize, the ledger does after five seconds. If too few candidates answer, the epoch is aborted and another is opened.

Rotation

Terms end after rotation_ms. The next active member of the quorum becomes leader. The leader also changes when it is unhealthy or revoked.

Fencing

An action names its epoch and term. The ledger and the action module refuse it unless the sender leads this very term. A leader that was paused and returns cannot do damage.

Settings

epochs.json:

[{
  "scope": "default",
  "entity_type": "controller",
  "epoch_period_ms": 120000,
  "vrf_parameters": {"window_ms": 8000, "rotation_ms": 40000, "quorum_size": 4, "min_quorum": 3},
  "policies_map": {
    "healthy": "health_status == 'healthy' && heartbeat_age_ms >= 0 && heartbeat_age_ms < 10000",
    "supports_actions": "has(capabilities.actions) && size(capabilities.actions) > 0"
  }
}]
Field Meaning
epoch_period_ms Duration of an epoch
window_ms Time for submitting proofs
rotation_ms Length of a term
quorum_size, min_quorum Members, and the minimum
policies_map CEL conditions a candidate must meet