Last active
December 11, 2021 16:21
-
-
Save rafaribe/de6352c9d36af23c72d5fc7b53379084 to your computer and use it in GitHub Desktop.
Helium Blockchain Miner Height Helper
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
#!/usr/bin/env bash | |
MINER_HEIGHT=$(curl -d '{"jsonrpc":"2.0","id":"id","method":"block_height","params":[]}' -s -o - http://localhost:4467/|jq .result.height) | |
STAKEJOY_API_URL="https://helium-api.stakejoy.com" | |
HELIUM_API_URL="https://api.helium.io" | |
BLOCKCHAIN_HEIGHT=`curl -s -A "Wget/1.12 (linux-gnu)" $STAKEJOY_API_URL/v1/blocks/height | jq '.data.height'` | |
NEBRA_SNAPSHOT=$(wget -q https://helium-snapshots.nebra.com/latest.json -O - | grep -Po '\"height\": [0-9]*' | sed 's/\"height\": //') | |
SYNC_PERCENTAGE=$(echo "scale=2; ($MINER_HEIGHT / $BLOCKCHAIN_HEIGHT)*100" | bc) | |
echo "Latest Snapshot: $NEBRA_SNAPSHOT" | |
echo "Blockchain Height: $MINER_HEIGHT/$BLOCKCHAIN_HEIGHT - $SYNC_PERCENTAGE%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shows this output.