Skip to content

Instantly share code, notes, and snippets.

@garethtdavies
Created Jun 28, 2021
Embed
What would you like to do?
Evaluate VRF output
# Generate the input for the epoch
for i in {49980..57120}; do echo "{\"globalSlot\": \"$i\",\"epochSeed\": \"2vb6kwsBmK8ZqJmoLeTXpofEMkXirHmtD6ixTEaiBzzqKmqyNQBD\",\"delegatorIndex\": 1276}"; done > input.txt
# Generate the batch witnesses
cat input.txt | mina advanced vrf batch-generate-witness --privkey-path ~/path-to-my-wallet > batch-generated.txt
# Add in the threshold for VRF evaluation
sed -i 's/]/],"vrfThreshold":{"delegatedStake":"1704440.324956633","totalStake":"829489852.840039300"}/g' batch-generated.txt
# Optional: Remove the using password lines if using env vars
sed -i -e 1,3d batch-generated.txt
# Generate the batch-check-witnesses
cat batch-generated.txt | mina advanced vrf batch-check-witness > batch-check.txt
# How many slots did we win
cat batch-check.txt | grep true | wc -l
# Which slots did we win
cat batch-check.txt | grep -B19 true | awk -F '\n' 'ln ~ /^$/ { ln = "matched"; print $1 } $1 ~ /^--$/ { ln = "" }'
@garethtdavies
Copy link
Author

garethtdavies commented Jun 29, 2021

Make a local GraphQL request to Mina daemon:

curl -d '{"query": "{
  account(publicKey: \"B62qpDpnXsUFR4TmaUYaBqcCUV1L1wsdsCcb7iRrvzJcU3ehiiUyoJd\") {
    index
  }
}"}' -H 'Content-Type: application/json' http://localhost:3085/graphql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment