Staking Incentives
Election and Staking
TON Blockchain makes use of the Proof of Stake (PoS) consensus algorithm which means, like all PoS networks, that the network’s security and stability is maintained by a set of network validators. In particular, validators propose candidates for new blocks (made up of transaction batches), while other validators validate and approve them via digital signatures.
Validators are chosen using special Elector governance contract. During each consensus round, validator candidates send an application for election along with their stake and desired max_factor (a parameter which regulates the amount of maintenance the validator performs per consensus round).
During the validator election process, the governance smart contract chooses the next round of validators and assigns a voting weight to each validator to maximize their total stake, while also taking into consideration the validator’s stake and max_factor. In this respect, the higher the stake and max_factor, the higher the voting weight of the validator and vice versa.
Validators that are elected are chosen to secure the network by participating in the next consensus round. However, unlike many other blockchains, to achieve horizontal scalability, each validator validates only a portion of the network:
For each shardchain and masterchain a dedicated set of validators exists. Sets of masterchain validators consist of up to 100 validators that exhibit the highest voting weight (defined as Network Parameter Config16:max_main_validators
).
In contrast, each shardchain is validated by a set of 23 validators (defined as Network Parameter Config28:shard_validators_num
) and rotated randomly every 1000 seconds (Network Parameter Config28:shard_validators_lifetime
).
Values of Stakes: Max Effective Stake
The current max_factor
in config is 3, meaning the stake of the smallest validator cannot be more than three times less than the stake of the largest one.
The formula with the config parameters:
max_factor
= max_stake_factor
/ validators_elected_for
(Simplified) Selection Algorithm
This algorithm, run by the Elector smart contract, selects the best validator candidates based on the stake they have committed. Here's a breakdown of how it works:
-
Initial Selection: Elector considers all candidates who have staked more than a set minimum amount (300K, as specified in the configuration).
-
Ordering Candidates: These candidates are then arranged from highest to lowest based on their stake.
-
Narrowing Down:
- If the number of candidates exceeds the maximum allowed number of validators (see configuration), those with the lowest stakes are excluded.
- The Elector then evaluates each potential group of candidates, starting from the largest group and moving to smaller ones:
- It examines the top candidates in the ordered list, increasing the number one by one.
- For each candidate, Elector calculates their 'effective stake'. If a candidate's stake is significantly higher than the minimum, it's adjusted down (e.g., if someone staked 310k and the minimum is 100k, but there's a rule capping at three times the minimum, their effective stake is considered as 300k).
- It sums up the effective stakes of all candidates in this group.
-
Final Selection: The group of candidates with the highest total effective stake is chosen as the validators by the Elector.
Validator Selection Algorithm
Based on the available stakes of potential validators, optimal values for the minimum and maximum stake are determined, with the aim of maximizing the magnitude of the total stake:
-
Elector takes all applicants who have a stake higher than the minimum (300K in config).
-
Elector sorts them in descending order of stake.
-
If there are more participants than the maximum number of validators, Elector discards the tail of the list. Then Elector does the following:
- For each cycle i from 1 to N (the remaining number of participants), it takes the first i applications from the sorted list.
- It calculates the effective stake, considering the
max_factor
. That is, if a person has put in 310k, but with amax_factor
of 3, and the minimum stake in the list is 100k Toncoins, then the effective stake will be min(310k, 3*100k) = 300k. One validator node may use up to 600k TON (in this example) in two rounds (half in odd rounds, half in even rounds). To increase the stake, it is necessary to set up multiple validator nodes. - It calculates the total effective stake of all i participants.
Once Elector finds such an i, where the total effective stake is maximal, we declare these i participants as validators.