Attributes
- Author(s): @iaa12
Summary
An algorithm for the implementation of node selection based on stake amount
Abstract
In order to allow for node consolidation and reduce the network’s infrastructure costs, a mechanism for the selection of nodes based on stake amount should be implemented.
Specification
Consider a network with 20 servicer nodes , staked at 15,000POKT each, by 4 entities (A,B, C, D):
A A A
B B B B B B B B B B
C
D D D D D D
In order to reduce infrastructure costs, the 3 entities with more than one node consolidate their stakes. Let’s assume the network imposes a cap of 60,000 POKT per node.
A (45k) B(60k) B(60k) B(30k) C(15K) D(45K) D(45K)
The number of nodes on the network has been reduced from 20 to 7.
In order to ensure fair and distributed selection of nodes for sessions, an algorithm should be implemented to split the consolidated nodes into an array of 15K slots (in no particular programming language):
var nodeList =[ A (45k) , B(60k) , B(60k) , B(30k) , C(15K) , D(45K) , D(45K) ]
var selectionArray =[ ]
var maxStake = 60000
var minStake = 15000
foreach (var node in nodeList)
{
int slots = min(maxStake, node.stake)/minStake;
for (i=0; i<slots; i++) selectionArray.push(node);
}
The resulting array would be : [ A, A, A, B, B, B, B, B, B, B, B, B, B, B, C, D, D, D, D, D, D]
This is identical to the node list pre-consolidation, and current node selection procedure can be applied to this array.
A sample implementation/proof of concept based on above can be found at this JSFiddle
In the future, a function can be applied to the slot calculation to tune the probability curve, which would be linear with this algorithm. In addition, quality can also be introduced into that function which could increase/decrease number of resulting slots based on service quality, to punish poor quality and incentivize high quality.
The computed array can be cached for a period of time for optimal performance.
Dissenting Opinions
TBD
Copyright
Copyright and related rights waived via CC0.