Skip to content

Instantly share code, notes, and snippets.

@jaddison
Created January 10, 2018 03:59
Show Gist options
  • Save jaddison/c0e53de62f90e179b07bef9137834725 to your computer and use it in GitHub Desktop.
Save jaddison/c0e53de62f90e179b07bef9137834725 to your computer and use it in GitHub Desktop.
Suprnova JSON API hash/share rate & balance script
#!/bin/bash
if [[ ! -v SUPRNOVA_KEY ]]
then
echo -e "SUPRNOVA_KEY environment variable isn't set.\n\nThis should be the API key from your Suprnova account."
exit 1
fi
if [[ ! -v SUPRNOVA_TARGET ]]
then
echo -e "SUPRNOVA_TARGET environment variable isn't set.\n\nThis should be 'zcl' if you are connecting to 'zcl.suprnova.cc'"
exit 1
fi
if [[ ! -v SUPRNOVA_ID ]]
then
echo -e "SUPRNOVA_ID environment variable isn't set.\n\nThis should be the account ID from your Suprnova account."
exit 1
fi
status=$(http "https://$SUPRNOVA_TARGET.suprnova.cc/index.php?page=api&action=getuserstatus&api_key=$SUPRNOVA_KEY&id=$SUPRNOVA_ID&pretty=1" | jq '.getuserstatus.data | {username, hashrate: (.hashrate / 1000), sharerate}')
balance=$(http "https://$SUPRNOVA_TARGET.suprnova.cc/index.php?page=api&action=getuserbalance&api_key=$SUPRNOVA_KEY&id=$SUPRNOVA_ID&pretty=1" | jq '.getuserbalance.data | {balance: .}')
echo "$status $balance" | jq -Cs add
@jaddison
Copy link
Author

jaddison commented Jan 10, 2018

  • Requires jq to be installed.
  • set the SUPRNOVA_TARGET, SUPRNOVA_ID, and SUPRNOVA_KEY environment variables

For example, if you're mining against zen.suprnova.cc:

watch -cn 60 SUPRNOVA_TARGET=zen SUPRNOVA_ID=<your Suprnova user id> SUPRNOVA_KEY=<your Suprnova API key> ./suprnova_check.sh

@ngarafol
Copy link

  • Requires jq to be installed.

And httpie - pip install httpie ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment