Delegation Algorithm


In StaFi’s vision, the best delegation algorithm of liquid staking solutions should achieve the following 3 principles: 1.Maximize the staking rewards.

2.Minimize the potential losses.

3.Decentralize the delegations to avoid the voting power centralization of the target-chain’s validators.

In order to continue to fulfill StaFi’s vision, StaFiHub will also explore how to match the above 3 principles with the delegation algorithm for the rTokens issued on StaFiHub itself. Today we want to share the design details of the delegation algorithm on StaFiHub with our community and Cosmos Eco projects. The rToken solution’s delegation algorithm on StaFiHub will be implemented into 2 stages including V1 and V2 step by step.

V1 Introduction

The Delegation Algorithm V1 (DA V1) will achieve the 3 designing principles written above, but it will only include the most important parameters of the target chain’s nodes into its delegation algorithm. In V2, we will include more parameters with less importance of the target chain’s nodes into its delegation algorithm. Therefore, you can think that DA V1 is already matching our design visions in a simplified way.

In DA V1, The delegation algorithm will implement the following steps: 1.First scan the on-chain performance of all official validators who are running the nodes on the target chain.

2.Remove those with a recent slash record which is greater than a certain value.

3.Sort out all the left validator rankings according to delegation amount. This action will help check the voting power rankings of the validators on the target chain now.

4.Remove a certain number of validators which are at the top of the ranking list, and a certain number of validators which are at the bottom of the ranking list. The reason why we remove the validators with highest amount of delegation is to avoid the centralization of the voting powers on the target chain, and the validators with lowest amount of delegation is to maximize the staking rewards and minimize the slashing risks for the StaFiHub users.

5.Analyze the staking reward return of the remaining validators. For example, we will take 10 snapshots of the staking rewards from the last 100,000 blocks, and average them to calculate the comprehensive staking reward return of the validators.

6.Sort out the validators rankings from high to low according to the comprehensive staking return.

7.Screen out the validators with the highest yield to no less than 97% of the highest yield.

8.Finally, in order to ensure the decentralization of the validator voting power, the validators with a relatively small amount of delegation will be selected to be the final validators who will get the delegation from StaFiHub.

Selecting the best validators to delegate from all the validators group on the target chain is not the end. StaFiHub also designs a Validator Rotation Mechanism, which includes temporary rotation and regular rotation.

Temporary rotation will be triggered when the selected validator is disconnected or the handling fee is increased. Regular rotation will be implemented in every two weeks to select the new best validators at that moment based on the same delegation algorithm written above.

The overall architecture diagram is as follows:

V2 Introduction

StaFiHub Delegation algorithm V2 (DA V2) will include more parameters into its algorithm to generate more accurate and smart evaluations for the target chain’s validator on-chain performance.

As stated before, there are three design principles including maximizing the staking rewards, minimizing the potential losses and decentralizing the delegations to avoid the voting power centralization of target-chain’s validators. It may seem that maximizing the staking rewards and minimizing the potential losses generate the same results.

But the parameters used to realize the two principles are not the same. For example, the reference parameter corresponding to reward maximization is Reward, and that to losses minimization is Missed Block.

On the basis of DA V1, DA V2 will further include more on-chain parameters which could help StaFiHub more accurately evaluate the validator’s performance to fulfill the three main delegation algorithm design principles better.

In general, the V2 algorithm upgrade has two key points:

1.Breakdown of result parameters

2.Analysis of process parameters

We have made a summary of the above 2 parameters classification. Due to the increase of data on the chain, this classification summary table will be continuously updated. So far, the parameters include but are not limited to:

1.Result parameters

  • Self-Stake amount

  • Delegations from the staker

  • Commission

  • Missed Block

  • Reward

  • Uptime

  • Slash Amount

  • Stake Share

  • Stake Rank

  • Reward Compound

  • Max/Min Stake Share

  • Number of Delegators/Delegate txs

  • Staked FIS (Optional)

2.Process parameters

  • 1st/last Stake

  • 1st/last Unstake

  • 1st/last Restake(if applicable)

  • Amount of 1st/last Stake/Unstake/Restake/Claim

  • Number of Stake/Unstake/Restake(if applicable)

  • Number of Claims

Due to the increase of parameters, we propose an algorithm to calculate a score that can comprehensively judge the performance of the validator on the target chain. We will set the weights corresponding to different parameters, and comprehensively obtain a validator’s final performance score which will be in the range from 0 to 10.

Considering that the gap between some validators is not large, the score is taken to the last two decimal places to distinguish the performance difference of validators, such as 9.25 over 8.53, etc. The specific algorithm with parameters and weights will be released to our community in the DA V2 stage.

In addition, the Validator Rotation Mechanism is also a key update of V2. Considering the fluctuation of the validator’s performance, we will optimize the Validator Rotation Mechanism in DA V2 based on the DA V1 design. We will make it more real-time to make sure that StaFiHub chooses the best validators all the time.

The Validator Rotation Mechanism will help the target chain’s voting power of the validators become more decentralized, and activate validators to keep contributing to the target chain’s ecosystem. Therefore, we hope to continue to optimize the Validator Rotation Mechanism to make it best fit our vision.

In conclusion, we will optimize the DA V2 by involving more on-chain parameters which could help StaFiHub evaluate the performance of the validators, calculate the performance score through the weighting algorithm, and minimize the losses when abnormal actions occur. This will help us get a better validator pool for delegation by having more accurate evaluation results for validators’ on-chain performance. DA V2 will keep selecting the best validators for a decentralized delegation by every block according to the real-time delegation algorithm. Fully realizing an on-chain and real time delegation algorithm that fulfills the three design principles is the ultimate goal of DA V2 upgrade.

Last updated