Leader Selection in Cardano SL

This chapter describes slot-leader selection process.

Follow the Satoshi

As mentioned earlier, Cardano SL uses Follow the Satoshi (FTS) algorithm to choose slot leaders. Leaders for each slot of the current epoch are computed by FTS in the beginning of the current epoch. So genesis block contains a list of selected slot leaders. The number of selected slot-leaders corresponds to a number of slots in epoch, and this number depends on fundamental security parameter k defined in configuration file.

FTS uses a shared seed which is result of Multi Party Computation (MPC) algorithm for previous epoch: in the result of MPC some nodes reveal their seeds, XOR of these seeds is called shared seed. Actually shared seed is a bytestring.

The probability that a stakeholder will be chosen as a slot leader is proportional to the number of coins this stakeholder holds. The same stakeholder can be chosen as a leader for multiple slots within an epoch.

Algorithm

Theoretical aspects of the slot leader selection process is described in paper, page 11.

The node sorts all unspent outputs (utxo) in a deterministic way (lexicographically), so result is an ordered sequence of pairs (StakeholderId, Coin), where StakeholderId is an id of stakeholder (its public key hash) and Coin is an amount of coins this stakeholder has. It’s assumed that utxo isn’t empty.

Then the node chooses several random is between 1 and amount of Lovelaces in the system. To find owner of i-th coin node finds the lowest x such that sum of all coins in this list up to ‘i’-th is not less than ‘i’ (and then ‘x’-th address is the owner of i-th coin).

The result is a non-empty sequence of StakeholderId, ids of selected stakeholders. This sequense of SlotLeaders is storing in the node’s runtime context.

With P2SH addresses, node doesn’t know who is going to end up with funds sent to them. Therefore, P2SH addresses can contain destination address which specifies which addresses should count as “owning” funds for the purposes of FTS.