Last active
February 7, 2021 00:45
-
-
Save buzzkillb/6fd00b4d3fb3e09645ff705aae52c6d6 to your computer and use it in GitHub Desktop.
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
#Location of block-cli | |
blockcli=/usr/local/bin/blocknet-cli | |
echo "Type in COIN Symbol, ie. BTC, D, DOGE, DVT, LTC, PIVX" | |
read coinCheck | |
coinServiceNodes=$($blockcli servicenodecount | jq -r '.total') | |
echo "total service node(s): $coinServiceNodes" | |
subtractone="$(($coinServiceNodes-5))" | |
xrgetblockcountlarge=$($blockcli xrgetblockcount "${coinCheck}" "${subtractone}" | jq -r '.error' | grep -Eo '[0-9]+$') | |
xrgetblockcountlargetwo=$($blockcli xrgetblockcount "${coinCheck}" "${xrgetblockcountlarge}" | jq -r '.error' | grep -Eo '[0-9]+$') | |
if [ -z "$xrgetblockcountlargetwo" ] | |
then | |
coinnodes=$xrgetblockcountlarge | |
echo "Found Final target of "${coinCheck}" nodes: $coinnodes" | |
else | |
coinnodes=$xrgetblockcountlargetwo | |
echo "Found Final target of "${coinCheck}" nodes: $coinnodes" | |
fi | |
#Get UUID of Coin | |
uuid=$($blockcli xrgetblockcount "${coinCheck}" "${coinnodes}" | jq -r '.uuid') | |
#print list of UUID for Coin | |
xrgetreply=$($blockcli xrgetreply "${uuid}") | |
echo "UUID List "${uuid}" for "${coinCheck}"" | |
nodeList=$(echo $xrgetreply | jq -r '.allreplies') | |
echo "Height nodepubkey address score" | |
echo $nodeList | jq -r '.[] | [.reply,.nodepubkey,.score,.address|tostring] | @tsv' > "${coinCheck}".json | |
cat "${coinCheck}".json | awk '{print $1, $2, $4, $3}' | |
if [ $coinCheck == BTC ] | |
then | |
blockcount=$(curl -s https://blockchain.info/q/getblockcount) | |
echo "$blockcount - "${coinCheck}" block height" | |
elif [ $coinCheck == D ] | |
then | |
blockcount=$(curl -s https://chainz.cryptoid.info/d/api.dws?q=getblockcount) | |
echo "$blockcount - "${coinCheck}" block height" | |
elif [ $coinCheck == DOGE ] | |
then | |
blockcount=$(curl -s https://dogechain.info/chain/Dogecoin/q/getblockcount) | |
echo "$blockcount - "${coinCheck}" block height" | |
elif [ $coinCheck == DVT ] | |
then | |
blockcount=$(curl -s https://www.coinexplorer.net/api/v1/DVT/block/latest | jq -r '.result.height') | |
echo "$blockcount - "${coinCheck}" block height" | |
elif [ $coinCheck == LTC ] | |
then | |
blockcount=$(curl -s https://chainz.cryptoid.info/ltc/api.dws?q=getblockcount) | |
echo "$blockcount - "${coinCheck}" block height" | |
elif [ $coinCheck == PIVX ] | |
then | |
blockcount=$(curl -s https://chainz.cryptoid.info/pivx/api.dws?q=getblockcount) | |
echo "$blockcount - "${coinCheck}" block height" | |
else | |
echo "need to add explorer count" | |
fi | |
rm "${coinCheck}".json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment