From 77ec4eee7d38c99f755ca65149be2253f0447671 Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Tue, 1 Apr 2014 00:39:08 +0000 Subject: [PATCH 1/5] Added infinitecoin,emoticoin and carpediemcoin configs --- coins/carpediemcoin.json | 6 +++ coins/emoticoin.json | 6 +++ coins/infinitecoin.json | 6 +++ pool_configs/carpediemcoin_example.json | 70 +++++++++++++++++++++++++ pool_configs/emoticoin_example.json | 70 +++++++++++++++++++++++++ pool_configs/infinitecoin_example.json | 70 +++++++++++++++++++++++++ 6 files changed, 228 insertions(+) create mode 100644 coins/carpediemcoin.json create mode 100644 coins/emoticoin.json create mode 100644 coins/infinitecoin.json create mode 100644 pool_configs/carpediemcoin_example.json create mode 100644 pool_configs/emoticoin_example.json create mode 100644 pool_configs/infinitecoin_example.json diff --git a/coins/carpediemcoin.json b/coins/carpediemcoin.json new file mode 100644 index 0000000..966a013 --- /dev/null +++ b/coins/carpediemcoin.json @@ -0,0 +1,6 @@ +{ + "name": "Carpediemcoin", + "symbol": "DIEM", + "algorithm": "sha256", + "txMessages": false +} diff --git a/coins/emoticoin.json b/coins/emoticoin.json new file mode 100644 index 0000000..6e25e27 --- /dev/null +++ b/coins/emoticoin.json @@ -0,0 +1,6 @@ +{ + "name" : "Emoticoin", + "symbol" : "EMO", + "algorithm" : "scrypt", + "txMessages" : false +} diff --git a/coins/infinitecoin.json b/coins/infinitecoin.json new file mode 100644 index 0000000..aa4561d --- /dev/null +++ b/coins/infinitecoin.json @@ -0,0 +1,6 @@ +{ + "name" : "Infinitecoin", + "symbol" : "IFC", + "algorithm" : "scrypt", + "txMessages" : false +} diff --git a/pool_configs/carpediemcoin_example.json b/pool_configs/carpediemcoin_example.json new file mode 100644 index 0000000..beb2066 --- /dev/null +++ b/pool_configs/carpediemcoin_example.json @@ -0,0 +1,70 @@ +{ + "enabled": false, + "coin": "carpediemcoin.json", + + "shareProcessing": { + "internal": { + "enabled": true, + "validateWorkerAddress": true, + "paymentInterval": 60, + "minimumPayment": 10000, + "minimumReserve": 10000, + "feePercent": 0.01, + "feeReceiveAddress": "13vMVvzddHCwsDAqSJW3bQUu7ZEQbopBty", + "feeWithdrawalThreshold": 10, + "daemon": { + "host": "localhost", + "port": 20000, + "user": "carpediemcoinrpc", + "password": "KB57jSBEbX2pCsfh2UPTfG4ZBvzB7qnqhNF5VNt4FfE" + }, + "redis": { + "host": "localhost", + "port": 6379 + } + }, + "mpos": { + "enabled": false, + "host": "localhost", + "port": 3306, + "user": "me", + "password": "mypass", + "database": "ltc", + "stratumAuth": "password" + } + }, + + "address": "19tMKU5c8BkPyf2f2KnGngfsEh4RHonEqW", + "blockRefreshInterval": 1000, + "txRefreshInterval": 20000, + "connectionTimeout": 600, + + "banning": { + "enabled": true, + "time": 600, + "invalidPercent": 50, + "checkThreshold": 500, + "purgeInterval": 300 + }, + + "ports": { + "3000": { + "varDiff": { + "minDiff": 4, //Minimum difficulty + "maxDiff": 512, //Network difficulty will be used if it is lower than this + "targetTime": 15, //Try to get 1 share per this many seconds + "retargetTime": 90, //Check to see if we should retarget every this many seconds + "variancePercent": 30 //Allow time to very this % from target without retargeting + } + } + }, + + "daemons": [ + { + "host": "localhost", + "port": 20000, + "user": "carpediemcoinrpc", + "password": "KB57jSBEbX2pCsfh2UPTfG4ZBvzB7qnqhNF5VNt4FfE" + } + ] +} diff --git a/pool_configs/emoticoin_example.json b/pool_configs/emoticoin_example.json new file mode 100644 index 0000000..6587749 --- /dev/null +++ b/pool_configs/emoticoin_example.json @@ -0,0 +1,70 @@ +{ + "enabled": false, + "coin": "emoticoin.json", + + "shareProcessing": { + "internal": { + "enabled": true, + "validateWorkerAddress": true, + "paymentInterval": 60, + "minimumPayment": 100000, + "minimumReserve": 100000, + "feePercent": 0.01, + "feeReceiveAddress": "6Uivs1TiGHk9CbVGBPWgbgm4TPNTGocSHT", + "feeWithdrawalThreshold": 10, + "daemon": { + "host": "localhost", + "port": 20002, + "user": "emoticoinrpc", + "password": "8rTX7zSJB5szN3oLekP9W1DcitpcPfX2XXbv4Tmi3Wc4" + }, + "redis": { + "host": "localhost", + "port": 6379 + } + }, + "mpos": { + "enabled": false, + "host": "localhost", + "port": 3306, + "user": "me", + "password": "mypass", + "database": "ltc", + "stratumAuth": "password" + } + }, + + "address": "6cS9GpkZeTxifJ9aiQRRRehiAepP1GDvYE", + "blockRefreshInterval": 1000, + "txRefreshInterval": 20000, + "connectionTimeout": 600, + + "banning": { + "enabled": true, + "time": 600, + "invalidPercent": 50, + "checkThreshold": 500, + "purgeInterval": 300 + }, + + "ports": { + "3002": { + "varDiff": { + "minDiff": 4, //Minimum difficulty + "maxDiff": 512, //Network difficulty will be used if it is lower than this + "targetTime": 15, //Try to get 1 share per this many seconds + "retargetTime": 90, //Check to see if we should retarget every this many seconds + "variancePercent": 30 //Allow time to very this % from target without retargeting + } + } + }, + + "daemons": [ + { + "host": "localhost", + "port": 20002, + "user": "emoticoinrpc", + "password": "8rTX7zSJB5szN3oLekP9W1DcitpcPfX2XXbv4Tmi3Wc4" + } + ] +} diff --git a/pool_configs/infinitecoin_example.json b/pool_configs/infinitecoin_example.json new file mode 100644 index 0000000..e5c8f42 --- /dev/null +++ b/pool_configs/infinitecoin_example.json @@ -0,0 +1,70 @@ +{ + "enabled": false, + "coin": "infinitecoin.json", + + "shareProcessing": { + "internal": { + "enabled": true, + "validateWorkerAddress": true, + "paymentInterval": 60, + "minimumPayment": 100000, + "minimumReserve": 100000, + "feePercent": 0.01, + "feeReceiveAddress": "i6yDb6Fa4wLvS11pniGixUVM3WupE5Bego", + "feeWithdrawalThreshold": 10, + "daemon": { + "host": "localhost", + "port": 20001, + "user": "infinitecoinrpc", + "password": "7g9HDJVH2S6iDWvYyMuzuKCuuHj6NfTk6cYvk5eurPme" + }, + "redis": { + "host": "localhost", + "port": 6379 + } + }, + "mpos": { + "enabled": false, + "host": "localhost", + "port": 3306, + "user": "me", + "password": "mypass", + "database": "ltc", + "stratumAuth": "password" + } + }, + + "address": "i82jdH89PuxHUmXKCRckea9cey5CJsQjpJ", + "blockRefreshInterval": 1000, + "txRefreshInterval": 20000, + "connectionTimeout": 600, + + "banning": { + "enabled": true, + "time": 600, + "invalidPercent": 50, + "checkThreshold": 500, + "purgeInterval": 300 + }, + + "ports": { + "3001": { + "varDiff": { + "minDiff": 4, //Minimum difficulty + "maxDiff": 512, //Network difficulty will be used if it is lower than this + "targetTime": 15, //Try to get 1 share per this many seconds + "retargetTime": 90, //Check to see if we should retarget every this many seconds + "variancePercent": 30 //Allow time to very this % from target without retargeting + } + } + }, + + "daemons": [ + { + "host": "localhost", + "port": 20001, + "user": "infinitecoinrpc", + "password": "7g9HDJVH2S6iDWvYyMuzuKCuuHj6NfTk6cYvk5eurPme" + } + ] +} From ba1836b6053899834f29dfc79562fe43d54d9ffd Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Wed, 2 Apr 2014 21:42:50 +0000 Subject: [PATCH 2/5] Added stats grouped by algorithm --- libs/stats.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libs/stats.js b/libs/stats.js index 9977256..d0c16d5 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -14,13 +14,6 @@ module.exports = function(logger, portalConfig, poolConfigs){ var redisClients = []; - /*var algoMultipliers = { - 'x11': Math.pow(2, 16), - 'scrypt': Math.pow(2, 16), - 'scrypt-jane': Math.pow(2,16), - 'sha256': Math.pow(2, 32) - };*/ - var canDoStats = true; Object.keys(poolConfigs).forEach(function(coin){ @@ -55,7 +48,6 @@ module.exports = function(logger, portalConfig, poolConfigs){ this.stats = {}; this.statsString = ''; - this.getGlobalStats = function(callback){ var allCoinStats = {}; @@ -76,6 +68,7 @@ module.exports = function(logger, portalConfig, poolConfigs){ var commandsPerCoin = redisComamndTemplates.length; + client.coins.map(function(coin){ redisComamndTemplates.map(function(t){ var clonedTemplates = t.slice(0); @@ -84,6 +77,7 @@ module.exports = function(logger, portalConfig, poolConfigs){ }); }); + client.client.multi(redisCommands).exec(function(err, replies){ if (err){ console.log('error with getting hashrate stats ' + JSON.stringify(err)); @@ -121,6 +115,7 @@ module.exports = function(logger, portalConfig, poolConfigs){ workers: 0, hashrate: 0 }, + algos: {}, pools: allCoinStats }; @@ -143,6 +138,18 @@ module.exports = function(logger, portalConfig, poolConfigs){ coinStats.hashrate = hashratePre / 1e3 | 0; portalStats.global.hashrate += coinStats.hashrate; portalStats.global.workers += Object.keys(coinStats.workers).length; + + /* algorithm specific global stats */ + var algo = coinStats.algorithm; + if (!portalStats.algos.hasOwnProperty(algo)){ + portalStats.algos[algo] = { + workers: 0, + hashrate: 0 + }; + } + portalStats.algos[algo].hashrate += coinStats.hashrate; + portalStats.algos[algo].workers += Object.keys(coinStats.workers).length; + delete coinStats.hashrates; delete coinStats.shares; }); From c0dae1daa7f0f0769442d61c4f4ead55d32ad291 Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Wed, 2 Apr 2014 21:46:52 +0000 Subject: [PATCH 3/5] Revert "Added infinitecoin,emoticoin and carpediemcoin configs" This reverts commit 77ec4eee7d38c99f755ca65149be2253f0447671. --- coins/carpediemcoin.json | 6 --- coins/emoticoin.json | 6 --- coins/infinitecoin.json | 6 --- pool_configs/carpediemcoin_example.json | 70 ------------------------- pool_configs/emoticoin_example.json | 70 ------------------------- pool_configs/infinitecoin_example.json | 70 ------------------------- 6 files changed, 228 deletions(-) delete mode 100644 coins/carpediemcoin.json delete mode 100644 coins/emoticoin.json delete mode 100644 coins/infinitecoin.json delete mode 100644 pool_configs/carpediemcoin_example.json delete mode 100644 pool_configs/emoticoin_example.json delete mode 100644 pool_configs/infinitecoin_example.json diff --git a/coins/carpediemcoin.json b/coins/carpediemcoin.json deleted file mode 100644 index 966a013..0000000 --- a/coins/carpediemcoin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Carpediemcoin", - "symbol": "DIEM", - "algorithm": "sha256", - "txMessages": false -} diff --git a/coins/emoticoin.json b/coins/emoticoin.json deleted file mode 100644 index 6e25e27..0000000 --- a/coins/emoticoin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name" : "Emoticoin", - "symbol" : "EMO", - "algorithm" : "scrypt", - "txMessages" : false -} diff --git a/coins/infinitecoin.json b/coins/infinitecoin.json deleted file mode 100644 index aa4561d..0000000 --- a/coins/infinitecoin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name" : "Infinitecoin", - "symbol" : "IFC", - "algorithm" : "scrypt", - "txMessages" : false -} diff --git a/pool_configs/carpediemcoin_example.json b/pool_configs/carpediemcoin_example.json deleted file mode 100644 index beb2066..0000000 --- a/pool_configs/carpediemcoin_example.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "enabled": false, - "coin": "carpediemcoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 10000, - "minimumReserve": 10000, - "feePercent": 0.01, - "feeReceiveAddress": "13vMVvzddHCwsDAqSJW3bQUu7ZEQbopBty", - "feeWithdrawalThreshold": 10, - "daemon": { - "host": "localhost", - "port": 20000, - "user": "carpediemcoinrpc", - "password": "KB57jSBEbX2pCsfh2UPTfG4ZBvzB7qnqhNF5VNt4FfE" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "19tMKU5c8BkPyf2f2KnGngfsEh4RHonEqW", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "3000": { - "varDiff": { - "minDiff": 4, //Minimum difficulty - "maxDiff": 512, //Network difficulty will be used if it is lower than this - "targetTime": 15, //Try to get 1 share per this many seconds - "retargetTime": 90, //Check to see if we should retarget every this many seconds - "variancePercent": 30 //Allow time to very this % from target without retargeting - } - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 20000, - "user": "carpediemcoinrpc", - "password": "KB57jSBEbX2pCsfh2UPTfG4ZBvzB7qnqhNF5VNt4FfE" - } - ] -} diff --git a/pool_configs/emoticoin_example.json b/pool_configs/emoticoin_example.json deleted file mode 100644 index 6587749..0000000 --- a/pool_configs/emoticoin_example.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "enabled": false, - "coin": "emoticoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100000, - "minimumReserve": 100000, - "feePercent": 0.01, - "feeReceiveAddress": "6Uivs1TiGHk9CbVGBPWgbgm4TPNTGocSHT", - "feeWithdrawalThreshold": 10, - "daemon": { - "host": "localhost", - "port": 20002, - "user": "emoticoinrpc", - "password": "8rTX7zSJB5szN3oLekP9W1DcitpcPfX2XXbv4Tmi3Wc4" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "6cS9GpkZeTxifJ9aiQRRRehiAepP1GDvYE", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "3002": { - "varDiff": { - "minDiff": 4, //Minimum difficulty - "maxDiff": 512, //Network difficulty will be used if it is lower than this - "targetTime": 15, //Try to get 1 share per this many seconds - "retargetTime": 90, //Check to see if we should retarget every this many seconds - "variancePercent": 30 //Allow time to very this % from target without retargeting - } - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 20002, - "user": "emoticoinrpc", - "password": "8rTX7zSJB5szN3oLekP9W1DcitpcPfX2XXbv4Tmi3Wc4" - } - ] -} diff --git a/pool_configs/infinitecoin_example.json b/pool_configs/infinitecoin_example.json deleted file mode 100644 index e5c8f42..0000000 --- a/pool_configs/infinitecoin_example.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "enabled": false, - "coin": "infinitecoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100000, - "minimumReserve": 100000, - "feePercent": 0.01, - "feeReceiveAddress": "i6yDb6Fa4wLvS11pniGixUVM3WupE5Bego", - "feeWithdrawalThreshold": 10, - "daemon": { - "host": "localhost", - "port": 20001, - "user": "infinitecoinrpc", - "password": "7g9HDJVH2S6iDWvYyMuzuKCuuHj6NfTk6cYvk5eurPme" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "i82jdH89PuxHUmXKCRckea9cey5CJsQjpJ", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "3001": { - "varDiff": { - "minDiff": 4, //Minimum difficulty - "maxDiff": 512, //Network difficulty will be used if it is lower than this - "targetTime": 15, //Try to get 1 share per this many seconds - "retargetTime": 90, //Check to see if we should retarget every this many seconds - "variancePercent": 30 //Allow time to very this % from target without retargeting - } - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 20001, - "user": "infinitecoinrpc", - "password": "7g9HDJVH2S6iDWvYyMuzuKCuuHj6NfTk6cYvk5eurPme" - } - ] -} From 5918baac2f577c1ea20648f9f33b4ecccc5621d4 Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Wed, 2 Apr 2014 23:36:36 +0000 Subject: [PATCH 4/5] added human readable auto-scaling hash rate strings to stats --- libs/stats.js | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/libs/stats.js b/libs/stats.js index d0c16d5..10e4af0 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -115,7 +115,7 @@ module.exports = function(logger, portalConfig, poolConfigs){ workers: 0, hashrate: 0 }, - algos: {}, + algos: {}, pools: allCoinStats }; @@ -139,19 +139,25 @@ module.exports = function(logger, portalConfig, poolConfigs){ portalStats.global.hashrate += coinStats.hashrate; portalStats.global.workers += Object.keys(coinStats.workers).length; - /* algorithm specific global stats */ - var algo = coinStats.algorithm; - if (!portalStats.algos.hasOwnProperty(algo)){ - portalStats.algos[algo] = { - workers: 0, - hashrate: 0 - }; - } + /* algorithm specific global stats */ + var algo = coinStats.algorithm; + if (!portalStats.algos.hasOwnProperty(algo)){ + portalStats.algos[algo] = { + workers: 0, + hashrate: 0, + hashrateString: null + }; + } portalStats.algos[algo].hashrate += coinStats.hashrate; portalStats.algos[algo].workers += Object.keys(coinStats.workers).length; delete coinStats.hashrates; delete coinStats.shares; + coinStats.hashrateString = _this.getReadableHashRateString(coinStats.hashrate); + }); + + Object.keys(portalStats.algos).forEach(function(algo){ + algo.hashrateString = _this.getReadableHashRateString(algo.hashrate); }); _this.stats = portalStats; @@ -160,5 +166,16 @@ module.exports = function(logger, portalConfig, poolConfigs){ }); }; + + this.getReadableHashRateString = function(hashrate){ + var i = -1; + var byteUnits = [' KH', ' MH', ' GH', ' TH', 'PH' ]; + do { + hashrate = hashrate / 1024; + i++; + } while (hashrate > 1024); + return hashrate.toFixed(2) + byteUnits[i]; + }; + }; From 795b93e254499027a751ada5b49861b231fcec94 Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Thu, 3 Apr 2014 02:04:39 +0000 Subject: [PATCH 5/5] fixed bug in collection of per algo hash rate string --- libs/stats.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/stats.js b/libs/stats.js index 10e4af0..5c31ccb 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -157,7 +157,8 @@ module.exports = function(logger, portalConfig, poolConfigs){ }); Object.keys(portalStats.algos).forEach(function(algo){ - algo.hashrateString = _this.getReadableHashRateString(algo.hashrate); + var algoStats = portalStats.algos[algo]; + algoStats.hashrateString = _this.getReadableHashRateString(algoStats.hashrate); }); _this.stats = portalStats; @@ -169,10 +170,10 @@ module.exports = function(logger, portalConfig, poolConfigs){ this.getReadableHashRateString = function(hashrate){ var i = -1; - var byteUnits = [' KH', ' MH', ' GH', ' TH', 'PH' ]; + var byteUnits = [ ' KH', ' MH', ' GH', ' TH', ' PH' ]; do { hashrate = hashrate / 1024; - i++; + i++; } while (hashrate > 1024); return hashrate.toFixed(2) + byteUnits[i]; };