0.0.4 • Published 5 years ago

turtlecoin-pool-monitor v0.0.4

Weekly downloads
5
License
AGPL-3.0
Repository
github
Last release
5 years ago

NPM

Prerequisites

Install

Collection Service

npm install -g turtlecoin-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>
turtlecoin-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: turtlecoin-pools-json)>

As a Module for Pulling Stats

npm install --save turtlecoin-pool-monitor

Sample Code

const StatsDatabase = require('turtlecoin-pool-monitor')

const db = new StatsDatabase({
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'password',
  database: 'turtlecoin',
  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(1) NOT NULL DEFAULT 0, 
  `mergedMiningIsParentChain` INT(1) NOT 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(20) NOT NULL DEFAULT 0, 
  `hashrate` BIGINT(20) NOT NULL DEFAULT 0, 
  `miners` BIGINT(20) NOT NULL DEFAULT 0, 
  `fee` DOUBLE NOT NULL DEFAULT 0, 
  `minPayout` BIGINT(20) NOT NULL DEFAULT 0, 
  `lastBlock` BIGINT(20) NOT NULL DEFAULT 0, 
  `donation` DOUBLE NOT NULL DEFAULT 0, 
  `status` INT(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`, `timestamp`), 
  KEY `status` (`status`), 
  KEY `lastBlock` (`lastBlock`)
) engine = innodb DEFAULT charset = utf8 ROW_FORMAT = COMPRESSED;

Author

The TurtleCoin Developers

License

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