Skip to content

Instantly share code, notes, and snippets.

@polarker
Last active November 20, 2021 16:38
Show Gist options
  • Save polarker/e13a8898b4977d86c2c9d4b867341635 to your computer and use it in GitHub Desktop.
Save polarker/e13a8898b4977d86c2c9d4b867341635 to your computer and use it in GitHub Desktop.
ALPH miner blocks
#!/bin/bash
#credit to @diomark
#first need to unlock wallet. not putting password in here
#check wallet
curlResult=`curl -X 'GET' 'http://127.0.0.1:12973/wallets/PUT_IN_YOUR_WALLET_NAME/balances' -H 'accept: application/json' 2>/dev/null | json_pp | grep totalBalanceHint| cut -f1 -d","`
lastdate=`date +%s`
if echo $curlResult | grep -q ALPH; then
datestr=`date +"%x %R"`
echo -n "$datestr "
echo Wallet unlocked - $curlResult;
else
echo Please unlock wallet first
exit
fi
while true; do
oldResult=$curlResult
datestr=`date +"%x %R"`; echo -n "."; curlResult=`curl -X 'GET' 'http://127.0.0.1:12973/wallets/PUT_IN_YOUR_WALLET_NAME/balances' -H 'accept: application/json' 2>/dev/null | json_pp | grep totalBalanceHint| cut -f1 -d","`
if [ "$oldResult" != "" ]; then
if [ "$curlResult" != "$oldResult" ]; then
echo
echo -n "$datestr "
newdate=`date +%s`
secs=`expr $newdate - $lastdate`
mins=`expr $secs / 60`
echo -n "Won a block after $mins minutes! "
echo $curlResult
lastdate=$newdate
fi
fi
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment