Skip to content

Instantly share code, notes, and snippets.

@spuder
Created August 24, 2021 01:41
Show Gist options
  • Save spuder/965f72b7f8725828a795bab0952a7377 to your computer and use it in GitHub Desktop.
Save spuder/965f72b7f8725828a795bab0952a7377 to your computer and use it in GitHub Desktop.
Helium Miner status
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