Created
August 24, 2021 01:41
-
-
Save spuder/965f72b7f8725828a795bab0952a7377 to your computer and use it in GitHub Desktop.
Helium Miner status
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
export ANIMAL=angry-purple-tiger #replace with your miner | |
hotspot=$(curl -s https://api.helium.io/v1/hotspots/name/${ANIMAL}) | |
# TODO: error if result != 1 | |
miner_height=$(echo $hotspot | jq -r '.data[].status.height') | |
chain_height=$(echo $hotspot | jq -r '.data[].block') | |
percentage=$(bc <<<"scale=6; $miner_height / $chain_height") | |
echo "=== ${ANIMAL} ===" | |
echo miner_height = ${miner_height} | |
echo chain_height = ${chain_height} | |
echo lag = $((${chain_height}-${miner_height})) | |
echo percentage = ${percentage} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment