traaittplatform-pool-monitor

0.0.1 • Public • Published

NPM

Version Documentation Maintenance License: AGPL-3.0 Twitter:

Prerequisites

Install

Collection Service

npm install -g traaittplatform-pool-monitor
export MYSQL_HOST=<server ip>
export MYSQL_PORT=<server port>
export MYSQL_USERNAME=<server username>
export MYSQL_PASSWORD=<server password>
export MYSQL_DATABASE=<database>
traaittplatform-pool-monitor

Additional Options

export MYSQL_SOCKET=<server socket path (default: not set)>
export MYSQL_CONNECTION_LIMIT=<# of maximum server connections (default: 10)>
export HISTORY_DAYS=<# of days to keep history (default: 6 hours)>
export UPDATE_INTERVAL=<# of seconds between updating pool list (default: 1 hour)>
export POLLING_INTERVAL=<# of seconds between checking pools (default: 15s)>
export POOL_LIST_URL=<Full URL to pool list (default: traaittplatform-pools-json)>

As a Module for Pulling Stats

npm install --save traaittplatform-pool-monitor

Sample Code

const StatsDatabase = require('traaittplatform-pool-monitor')
 
const db = new StatsDatabase({
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'password',
  database: 'traaittplatform',
  connectionLimit: 10
})
 
db.getPoolStats().then((stats) => {
  console.log(stats)
})

Database Schema

CREATE TABLE IF NOT EXISTS `pools` (
  `id` VARCHAR(64) NOT NULL
  `name` VARCHAR(255) NOT NULL
  `url` VARCHAR(255) NOT NULL
  `api` VARCHAR(255) NOT NULL
  `type` VARCHAR(255) NOT NULL
  `miningAddress` VARCHAR(255) NOT NULL
  `mergedMining` INT(1NOT NULL DEFAULT 0
  `mergedMiningIsParentChain` INT(1NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `type` (`type`), 
  KEY `mergedMining` (`mergedMining`), 
  KEY `mergedMiningIsParentChain` (`mergedMiningIsParentChain`)
) engine = innodb DEFAULT charset = utf8 ROW_FORMAT = COMPRESSED;
 
CREATE TABLE `pool_polling` (
  `id` VARCHAR(64) NOT NULL
  `timestamp` BIGINT(1) UNSIGNED NOT NULL
  `height` BIGINT(20NOT NULL DEFAULT 0
  `hashrate` BIGINT(20NOT NULL DEFAULT 0
  `miners` BIGINT(20NOT NULL DEFAULT 0
  `fee` DOUBLE NOT NULL DEFAULT 0
  `minPayout` BIGINT(20NOT NULL DEFAULT 0
  `lastBlock` BIGINT(20NOT NULL DEFAULT 0
  `donation` DOUBLE NOT NULL DEFAULT 0
  `status` INT(1NOT NULL DEFAULT 0,
  PRIMARY KEY (`id``timestamp`), 
  KEY `status` (`status`), 
  KEY `lastBlock` (`lastBlock`)
) engine = innodb DEFAULT charset = utf8 ROW_FORMAT = COMPRESSED;

Author

The TurtCoin Developers

License

Copyright © 2019 The TurtCoin Developers.
This project is AGPL-3.0 licensed.

Readme

Keywords

Package Sidebar

Install

npm i traaittplatform-pool-monitor

Weekly Downloads

1

Version

0.0.1

License

AGPL-3.0

Unpacked Size

62.7 kB

Total Files

11

Last publish

Collaborators

  • traaitt