diff --git a/README.md b/README.md index fb21142..a425d42 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ## Mining stratum for Komodo and Komodo assetchains. -## (READY FOR TESTING) +## (READY FOR TESTING Requirements ------------ -* node v8+ +* node v10+ * libsodium * boost * Redis (see https://redis.io/topics/quickstart for details) @@ -36,29 +36,32 @@ strip src/komodo-cli cd ~/komodo/src ./assetchains.old ``` - Once all these chains have synced up we cna configure the stratum. - - We need npm and mvn installed + + Once all these chains have synced up we can configure the stratum. + + We need node and npm installed ```shell cd ~ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash -nvm install 8 ``` Now, let's build our stratum and run it (this stage assumes you already have Redis properly installed and running) This will install the stratum and configure it for all the assetchains on your system automatically. It must be run from the same user as the coin deamons were launched, as it pulls the rpcuser/pass from the conf file in the home directory. ```shell -git clone https://github.com/TheComputerGenie/Knomp -cd Knomp +git clone https://github.com/webworker01/knomp +cd knomp ./gencfg.sh -nvm use 8 npm install npm start ``` +[Further info on config](https://github.com/zone117x/node-open-mining-portal) + License ------- + +Forked from ComputerGenie repo (deleted) + Released under the GNU General Public License v2 http://www.gnu.org/licenses/gpl-2.0.html diff --git a/config_example.json b/config_example.json index b2091a4..1e47753 100644 --- a/config_example.json +++ b/config_example.json @@ -1,5 +1,5 @@ { - "logLevel": "debug", + "logLevel": "debug", //or "warning", "error" "logColors": true, "cliPort": 17117, diff --git a/libs/website.js b/libs/website.js index af956c9..7322726 100644 --- a/libs/website.js +++ b/libs/website.js @@ -4,15 +4,15 @@ var path = require('path'); var async = require('async'); var watch = require('node-watch'); -var redis = require('redis'); +//var redis = require('redis'); var dot = require('dot'); var express = require('express'); var bodyParser = require('body-parser'); var compress = require('compression'); -var Stratum = require('stratum-pool'); -var util = require('stratum-pool/lib/util.js'); +//var Stratum = require('stratum-pool'); +//var util = require('stratum-pool/lib/util.js'); var api = require('./api.js'); @@ -31,7 +31,6 @@ module.exports = function(logger){ var logSystem = 'Website'; - var pageFiles = { 'index.html': 'index', 'home.html': '', @@ -41,7 +40,7 @@ module.exports = function(logger){ 'workers.html': 'workers', 'api.html': 'api', 'admin.html': 'admin', - 'mining_key.html': 'mining_key', +// 'mining_key.html': 'mining_key', 'miner_stats.html': 'miner_stats', 'payments.html': 'payments' }; @@ -75,8 +74,6 @@ module.exports = function(logger){ //logger.debug(logSystem, 'Stats', 'Website updated to latest stats'); }; - - var readPageFiles = function(files){ async.each(files, function(fileName, callback){ var filePath = 'website/' + (fileName === 'index.html' ? '' : 'pages/') + fileName; @@ -130,93 +127,6 @@ module.exports = function(logger){ setInterval(buildUpdatedWebsite, websiteConfig.stats.updateInterval * 1000); - var buildKeyScriptPage = function(){ - async.waterfall([ - function(callback){ - var client = redis.createClient(portalConfig.redis.port, portalConfig.redis.host); - if (portalConfig.redis.password) { - client.auth(portalConfig.redis.password); - } - client.hgetall('coinVersionBytes', function(err, coinBytes){ - if (err){ - client.quit(); - return callback('Failed grabbing coin version bytes from redis ' + JSON.stringify(err)); - } - callback(null, client, coinBytes || {}); - }); - }, - function (client, coinBytes, callback){ - var enabledCoins = Object.keys(poolConfigs).map(function(c){return c.toLowerCase()}); - var missingCoins = []; - enabledCoins.forEach(function(c){ - if (!(c in coinBytes)) - missingCoins.push(c); - }); - callback(null, client, coinBytes, missingCoins); - }, - function(client, coinBytes, missingCoins, callback){ - var coinsForRedis = {}; - async.each(missingCoins, function(c, cback){ - var coinInfo = (function(){ - for (var pName in poolConfigs){ - if (pName.toLowerCase() === c) - return { - daemon: poolConfigs[pName].paymentProcessing.daemon, - address: poolConfigs[pName].address - } - } - })(); - var daemon = new Stratum.daemon.interface([coinInfo.daemon], function(severity, message){ - logger[severity](logSystem, c, message); - }); - daemon.cmd('dumpprivkey', [coinInfo.address], function(result){ - if (result[0].error){ - logger.error(logSystem, c, 'Could not dumpprivkey for ' + c + ' ' + JSON.stringify(result[0].error)); - cback(); - return; - } - - var vBytePub = util.getVersionByte(coinInfo.address)[0]; - var vBytePriv = util.getVersionByte(result[0].response)[0]; - - coinBytes[c] = vBytePub.toString() + ',' + vBytePriv.toString(); - coinsForRedis[c] = coinBytes[c]; - cback(); - }); - }, function(err){ - callback(null, client, coinBytes, coinsForRedis); - }); - }, - function(client, coinBytes, coinsForRedis, callback){ - if (Object.keys(coinsForRedis).length > 0){ - client.hmset('coinVersionBytes', coinsForRedis, function(err){ - if (err) - logger.error(logSystem, 'Init', 'Failed inserting coin byte version into redis ' + JSON.stringify(err)); - client.quit(); - }); - } - else{ - client.quit(); - } - callback(null, coinBytes); - } - ], function(err, coinBytes){ - if (err){ - logger.error(logSystem, 'Init', err); - return; - } - try{ - keyScriptTemplate = dot.template(fs.readFileSync('website/key.html', {encoding: 'utf8'})); - keyScriptProcessed = keyScriptTemplate({coins: coinBytes}); - } - catch(e){ - logger.error(logSystem, 'Init', 'Failed to read key.html file'); - } - }); - - }; - buildKeyScriptPage(); - var getPage = function(pageId){ if (pageId in pageProcessed){ var requestedPage = pageProcessed[pageId]; @@ -281,11 +191,8 @@ module.exports = function(logger){ }; - - var app = express(); - app.use(bodyParser.json()); app.get('/get_page', function(req, res, next){ @@ -297,9 +204,9 @@ module.exports = function(logger){ next(); }); - app.get('/key.html', function(req, res, next){ - res.end(keyScriptProcessed); - }); + // app.get('/key.html', function(req, res, next){ + // res.end(keyScriptProcessed); + // }); //app.get('/stats/shares/:coin', usershares); //app.get('/stats/shares', shares); diff --git a/package.json b/package.json index f44d0de..59f130f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "Komodo-mining", + "name": "knomp", "version": "0.0.1", "description": "High performance Stratum poolserver in Node.js", "keywords": [ @@ -9,14 +9,15 @@ "poolserver", "komodo" ], - "homepage": "https://github.com/TheComputerGenie/Knomp", + "homepage": "https://github.com/webworker01/knomp", "bugs": { - "url": "https://github.com/TheComputerGenie/Knomp/issues" + "url": "https://github.com/webworker01/knomp/issues" }, "license": "GPL-2.0", - "author": "ComputerGenie", + "author": "webworker01", "contributors": [ - "z-classic" + "z-classic", + "ComputerGenie" ], "main": "init.js", "bin": { @@ -24,30 +25,30 @@ }, "repository": { "type": "git", - "url": "https://github.com/webworker01/Knomp.git" + "url": "https://github.com/webworker01/knomp.git" }, "dependencies": { - "async": "2.3.0", - "bignum": "0.12.5", - "body-parser": "1.17.1", - "colors": "1.1.2", - "compression": "1.6.2", - "dateformat": "2.0.0", - "dot": "1.1.1", - "express": "4.15.2", - "extend": "3.0.0", - "mysql": "2.13.0", + "async": "^2.6.1", + "bignum": "0.13.0", + "body-parser": "1.18.3", + "colors": "1.3.2", + "compression": "^1.7.3", + "dateformat": "3.0.3", + "dot": "1.1.2", + "express": "^4.16.3", + "extend": "3.0.2", + "mysql": "^2.16.0", "node-json-minify": "1.0.0", - "node-watch": "0.5.2", + "node-watch": "0.5.8", "nonce": "1.0.4", - "redis": "2.7.1", - "request": "2.81.0", + "redis": "2.8.0", + "request": "^2.88.0", "stratum-pool": "git+https://github.com/webworker01/node-stratum-pool.git" }, "engines": { "node": ">=0.10" }, "scripts": { - "start": "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/node_modules/stratum-pool/node_modules/equihashverify/build/Release/:$PWD/node_modules/equihashverify/build/Release/ node init.js" + "start": "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/node_modules/stratum-pool/node_modules/equihashverify/build/Release/:$PWD/node_modules/equihashverify/build/Release/ node --max-old-space-size=8192 init.js" } } diff --git a/website/index.html b/website/index.html index 88a5153..c81f6eb 100644 --- a/website/index.html +++ b/website/index.html @@ -4,7 +4,7 @@ - + @@ -21,7 +21,7 @@ - z-nomp + knomp @@ -30,7 +30,7 @@
-  z-nomp +  Home