Evaluating a Mina staking pool’s performance

Additional VRF commands

  • generate-witness
  • batch-check-witness
  • batch-generate-witness
  • checkVrf
  • evaluateVrf

Determining all slots won in an epoch

  • Global slots to evaluate.
  • Epoch seed for the epoch.
  • The total stake of the epoch staking ledger.
  • Account indexes for all delegators.
  • The stake of each delegator, in the staking ledger.
  • Rust installed.
  • A copy of the repo.
  • A node running at least 1.2.0 (beta versions work) with GraphQL accessible.

1. Install Rust

2. Clone the repo

git clone https://github.com/zkvalidator/mina-vrf-rs.git

3. Generate the requests

cargo run --release -- batch-generate-witness --pub B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN --epoch 0 > requests
{
"globalSlot":"7140",
"epochSeed":"2vaMKZSXxYDaUzYVRZBNVRmwW7JwXE3vS3NKZfR8d1aijpZU2t3q",
"delegatorIndex":5
}
{
"globalSlot":"7140",
"epochSeed":"2vaMKZSXxYDaUzYVRZBNVRmwW7JwXE3vS3NKZfR8d1aijpZU2t3q",
"delegatorIndex":6
}

4. Generate the witnesses

cat requests | mina advanced vrf batch-generate-witness --privkey-path /keys/my-wallet | grep -v CODA_PRIVKEY_PASS > witnesses
{
"message": {
"globalSlot": "21420",
"epochSeed": "2vafLYumHvDQP49XQScJnPFqh977FdAsjhSrZbrtrXpiPsydG5Sj",
"delegatorIndex": 5
},
"publicKey": "B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN",
"c":
"27756566863414797581781478807131942238852341092608514702602203744130892819006",
"s":
"19521050341837802368631492777160646043301977200100017703727282250002882104946",
"ScaledMessageHash": [
"0x886ad33bd0866191c79a5439f511a6cb4cacef4188805420af9782348a49fd1f",
"0xdd003e9ad3d106fa3ae8337d3c638f87131b2ed4592bc7b971637675af5f5017"
]
}

5. Patch the witnesses with delegation totals

cat witnesses | cargo run --release -- batch-patch-witness --pub B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN --epoch 0 > patches
{
"vrfThreshold":{
"delegatedStake":"67869.906422964",
"totalStake":"829489852.840039300"
}
}

6. Evaluate the witness data

cat patches | mina advanced vrf batch-check-witness | grep -v CODA_PRIVKEY_PASS > check
{
"message": {
"globalSlot": "0",
"epochSeed": "2va9BGv9JrLTtrzZttiEMDYw1Zj6a6EHzXjmP9evHDTG3oEquURA",
"delegatorIndex": 6
},
"publicKey": "B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN",
"c":
"5471098132471102051558687182262111978937438362416021679410512408349591978876",
"s":
"3617882623492222290347674815508142437068468594088059083619705873549466051502",
"ScaledMessageHash": [
"0x9285b788681be702808ae0ce96b76cb9794d0ae61012bc1d7c82eef63b9b5b31",
"0x69a767e6fda7f0db147fbf5bba55d65357b423b552b8b767a3caf278ffed8222"
],
"vrfThreshold": {
"delegatedStake": "32558",
"totalStake": "805385692.8400393"
},
"vrfOutput": "EiRtSPahRsDAvbev8Ua5UbqQ4s1G9AciUgJk1NYfah6oMk2iW1vBD",
"vrfOutputFractional": 0.6448230137594151,
"thresholdMet": false
}

7. Returning the slots won

cat check | cargo run --release -- batch-check-witness --pub B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN --epoch 0
invalid slots: []
invalid local slots: []
producing slots: [47, 48, 91, 196, 228, 247, 266, 300, 373, 378, 407, 478, 577, 596, 605, 648, 649, 863, 873, 914, 969, 1037, 1099, 1102, 1112, 1133, 1159, 1209, 1268, 1274, 1309, 1354, 1499, 1540, 1616, 1618, 1693, 1744, 1762, 1872, 1927, 1971, 2027, 2077, 2193, 2196, 2452, 2511, 2523, 2531, 2551, 2573, 2655, 2664, 2665, 2672, 2678, 2712, 2724, 2769, 2781, 2925, 2943, 2990, 3025, 3048, 3110, 3143, 3173, 3180, 3249, 3279, 3333, 3345, 3445, 3534, 3544, 3578, 3677, 3761, 3781, 3817, 3881, 3919, 4015, 4034, 4072, 4121, 4223, 4240, 4269, 4332, 4342, 4361, 4451, 4606, 4639, 4655, 4717, 4730, 4746, 4827, 4830, 4953, 4961, 4994, 5042, 5139, 5141, 5163, 5213, 5269, 5367, 5431, 5459, 5498, 5503, 5587, 5698, 5834, 5855, 5872, 5900, 5973, 6012, 6203, 6217, 6298, 6331, 6365, 6466, 6570, 6575, 6712, 6796, 6805, 6818, 6846, 6945, 6981, 7045, 7100]
producing local slots: [47, 48, 91, 196, 228, 247, 266, 300, 373, 378, 407, 478, 577, 596, 605, 648, 649, 863, 873, 914, 969, 1037, 1099, 1102, 1112, 1133, 1159, 1209, 1268, 1274, 1309, 1354, 1499, 1540, 1616, 1618, 1693, 1744, 1762, 1872, 1927, 1971, 2027, 2077, 2193, 2196, 2452, 2511, 2523, 2531, 2551, 2573, 2655, 2664, 2665, 2672, 2678, 2712, 2724, 2769, 2781, 2925, 2943, 2990, 3025, 3048, 3110, 3143, 3173, 3180, 3249, 3279, 3333, 3345, 3445, 3534, 3544, 3578, 3677, 3761, 3781, 3817, 3881, 3919, 4015, 4034, 4072, 4121, 4223, 4240, 4269, 4332, 4342, 4361, 4451, 4606, 4639, 4655, 4717, 4730, 4746, 4827, 4830, 4953, 4961, 4994, 5042, 5139, 5141, 5163, 5213, 5269, 5367, 5431, 5459, 5498, 5503, 5587, 5698, 5834, 5855, 5872, 5900, 5973, 6012, 6203, 6217, 6298, 6331, 6365, 6466, 6570, 6575, 6712, 6796, 6805, 6818, 6846, 6945, 6981, 7045, 7100]

Determining the performance of a delegate

The curtailed output of running the script for MinaExplorer Pool for Epoch 0

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gareth Davies

Gareth Davies

Technical writer, data wrangler and (former) full stack dev