calculate participation key generation factors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 + 1)) | |
echo "Start round: $start (+1)" | |
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
To use this version:
Delete any old one if necessary
Download it
Make it executable
Run it