What is Leader Rotation?
Leader Rotation determines which validator creates a block at the moment of production. As Solana validators create blocks based on a pre-determined schedule, the current validator leader collects transactions from the network mempool, arranges them, and creates a block, which is then verified by other validators. The entire process is executed in mere seconds, allowing Solana to perform thousands of transactions in just one second.
Unlike Bitcoin, Solana doesn't rely on miners and a consensus process to determine the next block producer. Nor does it rely on randomness. In Solana, any network node can know which validator will produce the next block and at what time.
How Leader Rotation Works in Solana
Solana utilizes Proof-of-History (PoH) to determine its schedule. The leader rotation mechanism is based on a system consisting of slots and epochs. Solana slots are approximately 400 milliseconds or less (less than 0.500 seconds). Each epoch contains 432,000 slots, approximately 2 days per epoch. A schedule containing validator leaders, organized by four-slot leader window, is generated prior to each epoch.
In simple terms, validators with a higher stake (both directly and indirectly delegated from others) have a higher chance of winning leadership slots (more slots to produce blocks) in any particular epoch. To explain with an example, if a validator staked 2% of the overall SOL in the network, they would get around 2% of leader slots in an epoch.
The validator has four slots to produce a block. A four-slot window allows the validator to collect transactions, assign the Proof-of-History timestamp, build the block, and submit the block for verification by other validators. The four-slot window allows the network leader enough time to build a block and if a mistake was made in the first slot, there are three other opportunities for a slot leader to make a block. The validator then steps off after their 4-slot window and the next scheduled leader assumes its position.
Benefits and Importance of Leader Rotation
By using a rotating leader, Solana becomes more resilient to attacks. With a four-slot window lasting approximately 1,600 ms, an adversary can only hold a single leadership slot for up to 1600ms, making it difficult for malicious actors to control the network. The validator is also limited in how much damage they can do in that four-slot leader window, such as omitting (censor) specific transactions. Other validators in the network continue to validate the current slot leader's block and have the ability to vote against (punish) the leader if they suspect malicious behavior.
In the event that a leader becomes unresponsive or disconnected from the network during their slot leader window, the leader simply rotates to the next scheduled validator and continues producing blocks. There is no need for the network to vote to replace the current leader. Because the number of leaders rotating through each epoch is so high, the network load is distributed among many leaders, reducing the likelihood that one leader node could become the target.
Because of leader rotation, a given slot leader can know in advance which validator slot they are to act as slot leader for. Consequently, each validator leader can ensure their network connection and hardware is ready to produce a block during their assigned slot. Furthermore, the slot schedule can be distributed across a wide range of validator node computers and not solely on one. This keeps the network moving quickly and efficiently by not having to elect a replacement leader. Finally, because validators must maintain a high degree of reliability to perform well as a slot leader, they are constantly improving their hardware and ensuring they have good network speed to maximize the chance of performing well and earning more rewards. This ensures delegators are well taken care of by their validator and do not need to find another validator to delegate to. The network leader schedule is public and can be used by a network observer to verify that any leader received their scheduled time proportionate to their stake.
