A Node.js wrapper for the Ethermine and Flypool APIs, allowing you to easily retrieve data about mining pools, miners, and workers.
Install the package using npm:
npm install ethermine-apiFirst, import and instantiate the Ethermine class:
const Ethermine = require('ethermine-api');
const ethermine = new Ethermine();You can also specify an API URL for other pools:
const ethermine = new Ethermine('https://api-zcash.flypool.org');All methods support both callback and Promise patterns. If no callback is provided, the method returns a Promise.
Using callbacks:
ethermine.getPoolStats((err, data) => {
if (!err) {
console.log(data);
}
});Using Promises:
ethermine.getPoolStats()
.then(data => console.log(data))
.catch(err => console.error(err));Using async/await:
try {
const data = await ethermine.getPoolStats();
console.log(data);
} catch (err) {
console.error(err);
}Get the pool's statistics.
Callback:
ethermine.getPoolStats((err, data) => {
if (!err) {
console.log(data);
}
});Promise:
const data = await ethermine.getPoolStats();Get the block history.
ethermine.getBlockHistory((err, data) => {
if (!err) {
console.log(data);
}
});Get the network statistics.
ethermine.getNetworkStats((err, data) => {
if (!err) {
console.log(data);
}
});Get the servers' history.
ethermine.getServersHistory((err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's dashboard.
ethermine.getMinerDashboard('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's history.
ethermine.getMinerHistory('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's payouts.
ethermine.getMinerPayouts('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's rounds.
ethermine.getMinerRounds('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's settings.
ethermine.getMinerSettings('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's current statistics.
ethermine.getMinerCurrentStats('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the miner's workers.
ethermine.getMinerWorkers('0x...', (err, data) => {
if (!err) {
console.log(data);
}
});Get the worker's history.
ethermine.getWorkerHistory('0x...', 'workerName', (err, data) => {
if (!err) {
console.log(data);
}
});Get the worker's current statistics.
ethermine.getWorkerCurrentStats('0x...', 'workerName', (err, data) => {
if (!err) {
console.log(data);
}
});Set a new API URL.
ethermine.setAPIurl('https://api.ethpool.org', (err, result) => {
if (!err) {
console.log(result); // 'API URL set to: https://api.ethpool.org'
}
});You can use the setAPIurl method to switch to any of the following supported pools:
api-ergo.flypool.orgapi-etc.ethermine.orgapi-zcash.flypool.orgapi-ycash.flypool.orgapi-beam.flypool.orgapi-ravencoin.flypool.orgapi.ethpool.org