Last active
September 15, 2019 23:02
-
-
Save gaia/fa6f1091528884233e1111c9fef5f543 to your computer and use it in GitHub Desktop.
Harmony (ONE): Blocks Per Minute & Seconds Between Blocks
This file contains hidden or 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
#!/usr/bin/env bash | |
# This scripts takes no arguments. | |
blockearn="0.111" | |
onehour=$(curl -s https://harmony.one/1h | tr -d '[:blank:]' | sed -n '/EARNING/,/NOTEARNING/p') | |
average0=$(echo "$onehour" | sed -n "/Shard0/,/^$/p" | tail +3 | head -n-1 | sed 's/.*://g' | awk -v N=1 '{ sum += $N } END { if (NR > 0) print sum / NR }') | |
average1=$(echo "$onehour" | sed -n "/Shard1/,/^$/p" | tail +3 | head -n-1 | sed 's/.*://g' | awk -v N=1 '{ sum += $N } END { if (NR > 0) print sum / NR }') | |
average2=$(echo "$onehour" | sed -n "/Shard2/,/^$/p" | tail +3 | head -n-1 | sed 's/.*://g' | awk -v N=1 '{ sum += $N } END { if (NR > 0) print sum / NR }') | |
average3=$(echo "$onehour" | sed -n "/Shard3/,/^$/p" | tail +3 | head -n-1 | sed 's/.*://g' | awk -v N=1 '{ sum += $N } END { if (NR > 0) print sum / NR }') | |
blockspermin=$(python -c "print (round ($average0/$blockearn/60, 4))") | |
blockinterval=$(python -c "print (round (60/$blockspermin, 4))") | |
echo "Shard 0: $blockspermin blocks/min & $blockinterval seconds between blocks" | |
blockspermin=$(python -c "print (round ($average1/$blockearn/60, 4))") | |
blockinterval=$(python -c "print (round (60/$blockspermin, 4))") | |
echo "Shard 1: $blockspermin blocks/min & $blockinterval seconds between blocks" | |
blockspermin=$(python -c "print (round ($average2/$blockearn/60, 4))") | |
blockinterval=$(python -c "print (round (60/$blockspermin, 4))") | |
echo "Shard 2: $blockspermin blocks/min & $blockinterval seconds between blocks" | |
blockspermin=$(python -c "print (round ($average3/$blockearn/60, 4))") | |
blockinterval=$(python -c "print (round (60/$blockspermin, 4))") | |
echo "Shard 3: $blockspermin blocks/min & $blockinterval seconds between blocks" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment