Skip to content

gbouziden/nanopool-api-call-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 

Repository files navigation

Please note that you should not make more than 30 calls per minute to the API.
This process will work with - Ethereum, Ethereum Classic, SiaCoin, ZCash, Monero, Pascal, Electroneum

You can use Homebrew or the precompiled binary to install watch if you don't already have it:

Homebrew:
brew install watch

Open terminal, then execute:
curl -O http://ktwit.net/code/watch-0.2-macosx/watch
chmod +x watch
./watch
sudo mv watch /usr/local/bin/

Create a new file:
touch miner.sh
chmod +x miner.sh

Use an editor to edit file:
vi miner.sh

Miner - General Info - The Essentials

#!/bin/bash

curl -k --silent https://api.nanopool.org/v1/eth/user/:your_wallet_address |

jq -r '{balance:.data.balance, curent_hashrate:.data.hashrate, six_hr_avg:.data.avgHashrate.h6}, {workers:.data.workers[0].id, hashrate:.data.workers[0].hashrate}, {workers:.data.workers[1].id, hashrate:.data.workers[1].hashrate}' |

sed 's/[{}]//g' |
tr -d '""' |
tr -d ','

Save file and run:
watch -n 10 --no-title /.miner.sh

Output:

total_hashrate: 1025.0
six_hr_avg: 1030.5

workers: GTX1070
hashrate: 1030.5


workers: GTX1070x2
hashrate: 1030.5

Other - Prices

#!/bin/bash

curl -k --silent https://api.nanopool.org/v1/eth/user/:your_wallet_address |

jq -r '{Eth_USD:.data.price_usd, Eth_BTC:.data.price_btc}' |

sed 's/[{}]//g' |
tr -d '""' |
tr -d ','

Output:

Eth_USD: 475.13
Eth_BTC: 0.0491

UserSettings - Payment Limit

#!/bin/bash

curl -k --silent https://api.nanopool.org/v1/eth/usersettings/:your_wallet_address | 

jq -r '{payout_limit:.data.payout}' | 

sed 's/[{}]//g' |
tr -d '""' | 
tr -d ',' 

Output:

payout_limit: 0.1

Combined Output

#!/bin/bash

mining/prices.sh
echo "  --- --- --- --- --- ---"
mining/mining_general.sh

Output:

  Eth_USD: 962.76
  Eth_BTC: 0.08932

  --- --- --- --- --- ---

  balance: 0.03722546
  curent_hashrate: 1030.5
  six_hr_avg: 1030.5


  workers: GTX1070
  hashrate: 1030.5


  workers: GTX1070x2
  hashrate: 1030.5