npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nicehash

v1.0.2

Published

NiceHash API Wrapper

Readme

nicehash

Node NiceHash API Wrapper

A simple API wrapper for the cloud mining site NiceHash.

Installation

If you want to place or modify orders you need a NiceHash account. Under Account > General, you'll find your API ID and Key. You cannot use your read-only API Key.

npm install nicehash --save

Initialization

First, import the module:

const NiceHashClient = require('nicehash');

Next, initialize a new NiceHash client object with your API ID and Key:

const nh = new NiceHashClient({apiId: '123456', apiKey: '66666666-6666-6666-6666-666666666666'});

Note: If you aren't purchasing or modifying orders, you do not need to include API Id or Key.

Methods

All of the methods correspond to NiceHash's API documentation.

Private API Methods (Require Authentication)

nh.getMyOrders(location, algo)

Get all orders for certain algorithm owned by the customer. Refreshed every 30 seconds.

| param | type | description | | -------- | ------- | -------------------------------------------- | | location | Number | Location, 0 for Europe, 1 for USA. | | algo | Number | Algorithm marked with ID |

nh.createOrder(orderOptions)

Create new order. Only standard orders can be created with use of API.

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.amount | Number | Pay amount in BTC. | | orderOptions.price | Number | Price in BTC/GH/Day or BTC/TH/Day. | | orderOptions.limit | Number | Speed limit in GH/s or TH/s (0 for no limit). | | orderOptions.code | Number | Required code if 2FA is enabled | | orderOptions.pool_host | String | Pool hostname or IP. | | orderOptions.pool_port | String | Pool port. | | orderOptions.pool_user | String | Pool username. | | orderOptions.pool_pass | String | Pool password. |

nh.refillOrder(orderOptions)

Refill order with extra Bitcoins.

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.amount | Number | Pay amount in BTC. | | orderOptions.order | Number | Existing Order ID |

nh.removeOrder(orderOptions)

Remove existing order.

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.order | Number | Existing Order ID |

nh.setOrderPrice(orderOptions)

Set new price for the existing order. Only increase is possible.

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.price | Number | Price in BTC/GH/Day or BTC/TH/Day | | orderOptions.order | Number | Existing Order ID |

nh.decreaseOrderPrice(orderOptions)

Decrease price for the existing order. Price decrease possible every 10 minutes.

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.order | Number | Existing Order ID |

nh.setOrderLimit(orderOptions)

| param | type | description | | ---------------------- | ------ | ---------------------------------------------- | | orderOptions.location | Number | 0 for Europe (NiceHash), 1 for USA (WestHash). | | orderOptions.algo | Number | Algorithm marked with ID. | | orderOptions.limit | Number | Speed limit in GH/s or TH/s (0 for no limit). | | orderOptions.order | Number | Existing Order ID |

nh.getMyBalance()

Get current Bitcoin balance (confirmed and pending).


Public API Methods

getApiVersion()

Returns the current API version

getNiceHashAlgorithmNumberByName(algoName)

Returns the internal NiceHash algorithm ID (or null if not found) for the given hashing algorithm.

| param | type | description | | ---------- | ------- | ------------------------------------------------------- | | algoName | String | Name of algorithm |

getAlgorithmNameByNiceHashNumber(number)

Returns the internal NiceHash algorithm ID (or null if not found) for the given hashing algorithm.

| param | type | description | | ---------- | ------- | ------------------------------------------------------- | | number | Number | Internal NiceHash algo ID |

nh.getGlobalCurrentStats(location)

| param | type | description | | ---------- | ------- | ------------------------------------------------------- | | location | Number | (Optional) Location, 0 for Europe, 1 for USA. Optional |

getGlobal24hStats()

Get average profitability (price) and hashing speed for all algorithms in past 24 hours.

nh.getProviderStats(addr)

Get current stats for provider for all algorithms. Refreshed every 30 seconds. It also returns past 56 payments.

| param | type | description | | ------ | ------- | -------------------------------------------- | | addr | String | Providers BTC address |

nh.getDetailedProviderStats(addr, from)

Get details stats for provider for all algorithms including history data and past 56 payments

| param | type | description | | ------ | ------- | -------------------------------------------- | | addr | String | Providers BTC address | | from | String | Get history from this time (Unix timestamp) |

nh.getProviderWorkersStats(addr, algo)

Get detailed stats for provider's workers (rigs).

| param | type | description | | ------ | ------- | -------------------------------------------- | | addr | String | Providers BTC address | | algo | Number | Algorithm marked with ID |

nh.getOrders(location, algo)

Get all orders for certain algorithm. Refreshed every 30 seconds.

| param | type | description | | -------- | ------- | -------------------------------------------- | | location | Number | Location, 0 for Europe, 1 for USA. | | algo | Number | Algorithm marked with ID |

nh.getMultiAlgorithmMiningInfo()

Get information about Multi-Algorithm Mining.

nh.getSimpleMultiAlgorithmMiningInfo()

Get information about Simple Multi-Algorithm Mining. More Here

nh.getNeededBuyingInfo()

Get needed information for buying hashing power using NiceHashBot (https://github.com/nicehash/NiceHashBot)


Contribute

Contributions are welcome and would be awesome. It's a fairly straightforward app. Everything lives in NiceHashClient.js, and tests can be run with mocha.

Donate

BTC 1SUACoD5zyienrajU5PAKADGwySQYVD8G

ETH 0x4E821B7F5Ce9F04dbd7aDe5B98dC597a43e3a6C6