Browse Source

Merge branch 'master' into master

pull/1/head
Web Worker 6 years ago
committed by GitHub
parent
commit
468bd97b4f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      README.md
  2. 2
      config_example.json
  3. 107
      libs/website.js
  4. 41
      package.json
  5. 23
      website/index.html
  6. 18
      website/pages/getting_started.html
  7. 23
      website/pages/home.html
  8. 13
      website/static/kmdfavicon.svg
  9. BIN
      website/static/komodo-logo-horizontal-01.png

23
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

2
config_example.json

@ -1,5 +1,5 @@
{
"logLevel": "debug",
"logLevel": "debug", //or "warning", "error"
"logColors": true,
"cliPort": 17117,

107
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);

41
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"
}
}

23
website/index.html

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="/static/favicon.png"/>
<link rel="shortcut icon" type="image/png" href="/static/kmdfavicon.svg"/>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
@ -21,7 +21,7 @@
<script src="/static/main.js"></script>
<link rel="stylesheet" href="/static/style.css">
<title>z-nomp</title>
<title>knomp</title>
</head>
@ -30,7 +30,7 @@
<header>
<div class="home-menu pure-menu pure-menu-open pure-menu-horizontal">
<a class="pure-menu-heading hot-swapper" href="/"><i class="fa fa-home"></i>&nbsp;z-nomp</a>
<a class="pure-menu-heading hot-swapper" href="/"><i class="fa fa-home"></i>&nbsp;Home</a>
<ul>
<li class="{{? it.selected === 'getting_started' }}pure-menu-selected{{?}}">
@ -73,22 +73,7 @@
<footer>
<div>
This site is powered by the open source <a target="_blank" href="https://github.com/joshuayabut/z-nomp/">z-nomp</a>
project created by Joshua Yabut and the Zclassic Community and is licensed under the <a href="https://en.wikipedia.org/wiki/MIT_License">MIT License</a>
</div>
<div>
<i class="fa fa-heart"></i>&nbsp; Support this project by donating&nbsp;<i class="fa fa-btc"></i>&nbsp;BTC: 18vHMxVzotQ9EPyESrf7Z1hNM9AwJeVHgD
</div>
<div id="communityFooter">
Community&nbsp;<i class="fa fa-comment"></i>&nbsp;: &nbsp;<a target="_blank" href="https://zclassic.herokuapp.com">#zclassic IRC</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
<a target="_blank" href="http://reddit.com/r/zclassic">/r/zclassic</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
<iframe src="http://ghbtns.com/github-btn.html?user=joshuayabut&repo=z-nomp&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="140" height="20"></iframe>
</div>
&lt;3 🐸 &middot; <a href="https://github.com/webworker01/knomp" target="_blank">knomp on Github</a>
</footer>
</body>

18
website/pages/getting_started.html

@ -33,12 +33,13 @@
}
.menuList > a{
display: block;
display: inline-block;
color: #e3f7ff;
text-decoration: none;
padding: 7px;
padding-left: 25px;
text-transform: capitalize;
width:40px;
}
.menuList > a:hover{
@ -53,10 +54,10 @@
}
.miningOption{
color: white;
display: flex;
/* display: flex;
flex: 1 1 auto;
flex-direction: row;
flex-wrap: wrap;
flex-wrap: wrap; */
min-height: 215px;
justify-content: center;
align-items: center;
@ -81,6 +82,7 @@
}
.miningOptionInstructions{
flex: 1 1 auto;
padding:10px;
}
.miningOptionInstructions > div:first-child{
@ -181,6 +183,12 @@
</style>
<div id="holder">
<a href="#" class="miningOption" id="coinGlowTrigger">
<div class="miningOptionInstructions">
<div>Select a coin for connection details</div>
<div>Configurations for each coin are available for advanced miners</div>
</div>
</a>
<div id="menu">
@ -226,7 +234,7 @@
</div>
</div>
<div id="main">
<!-- <div id="main">
<a href="#" class="miningOption" id="nompAppDownload">
<div class="miningOptionNum">1.</div>
<div class="miningOptionInstructions">
@ -245,7 +253,7 @@
<div>Configurations for each coin are available for advanced miners</div>
</div>
</a>
</div>
</div> -->
</div>
<a href="#" id="coinInfoBackground" class="hidden"></a>

23
website/pages/home.html

@ -56,7 +56,7 @@
opacity: 0.77;
margin-bottom: 5px;
flex: 1 1 auto;
align-content: center;
/* align-content: center; */
}
.boxStatsList i.fa{
height: 15px;
@ -73,25 +73,16 @@
</style>
<div class="pure-g-r" id="boxWelcome">
<div class="pure-u-1-3">
<img id="logoImg" src="/static/logo.svg">
</div>
<div class="pure-u-2-3">
<div id="welcomeText">Welcome to the future of mining</div>
<ul id="welcomeItems">
<li>Low fees</li>
<li>High performance Node.js backend</li>
<li>User friendly mining client</li>
<li>Multi-coin / multi-pool</li>
</ul>
<img src="/static/komodo-logo-horizontal-01.png" style="margin: 0 auto; height:150px;">
<div class="pure-u-1">
<div style="font-size: 2em; text-align:center; margin-bottom:10px;">KNOMP</div>
</div>
</div>
<div class="pure-g-r" id="boxesLower">
<div class="pure-u-1-2">
<div class="pure-u-1">
<div class="boxStats" id="boxStatsLeft">
<div class="boxLowerHeader">Global Stats</div>
<div class="boxStatsList">
@ -106,7 +97,7 @@
</div>
</div>
<div class="pure-u-1-2">
<div class="pure-u-1">
<div class="boxStats" id="boxStatsRight">
<div class="boxLowerHeader">Pools / Coins</div>
<div class="boxStatsList">

13
website/static/kmdfavicon.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 72 72" style="enable-background:new 0 0 72 72;" xml:space="preserve">
<style type="text/css">
.st0{fill:#316565;}
.st1{fill:#FFFFFF;}
</style>
<rect x="0" y="0" class="st0" width="72" height="72"/>
<path class="st1" d="M35.9,65.4l20.8-8.5l8.7-20.8l-8.5-21L36.1,6.6l-20.8,8.5v0.2L6.6,36.1l8.5,20.8L35.9,65.4z M23,22.9L23,22.9
l13.1-5.5l13.1,5.5l5.5,13.1l-5.5,13.1l-13.1,5.5L23,49.2l-5.5-13.1L23,22.9z"/>
<polygon class="st1" points="36,46.9 43.7,43.7 46.9,35.9 43.7,28.3 36,25.1 28.4,28.3 25.2,35.9 28.2,43.7 "/>
</svg>

After

Width:  |  Height:  |  Size: 797 B

BIN
website/static/komodo-logo-horizontal-01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Loading…
Cancel
Save