Skip to content

Instantly share code, notes, and snippets.

@d13co
Last active Oct 15, 2022
Embed
What would you like to do?
calculate participation key generation factors
#!/bin/bash
set -e
address=$1
duration=$2
duration=${duration:-650000}
if [ "$address" == "" ]; then
echo "Usage: $0 <address> [<duration>]"
echo "address is mandatory. duration is optional"
exit 1
fi
start=$(goal node status | grep 'Last committed' | cut -d: -f2)
echo Current round: $start
start=$((start + 100))
echo "Start round: $start (+166)"
end=$((start + duration))
echo "End round: $end (+$duration)"
sqrt=`echo "scale=0; sqrt($((end-start)))" | bc`
echo "Dilution (sqrt(end-start)): $sqrt"
echo Command to run:
echo ""
echo "goal account addpartkey -a $address --roundFirstValid=$start --roundLastValid=$end --keyDilution=$sqrt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment