Coder Social home page Coder Social logo

nanopool-api-call-examples's Introduction

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

nanopool-api-call-examples's People

Contributors

gbouziden avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

312-ninja

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.