mirror of https://github.com/BTCPrivate/z-nomp.git
Merge branch 'master' of git://github.com/zone117x/node-open-mining-portal into zone117x-master
This commit is contained in:
commit
98619910d0
|
@ -1,3 +1,2 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
.idea/
|
.idea/
|
||||||
pool_configs/
|
|
|
@ -92,7 +92,8 @@ config directory and coin.conf file. For more info on this see:
|
||||||
Clone the repository and run `npm update` for all the dependencies to be installed:
|
Clone the repository and run `npm update` for all the dependencies to be installed:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/zone117x/node-stratum-portal.git
|
git clone https://github.com/zone117x/node-stratum-portal.git nomp
|
||||||
|
cd nomp
|
||||||
npm update
|
npm update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name" : "Galleon",
|
||||||
|
"symbol" : "GLN",
|
||||||
|
"algorithm" : "keccak",
|
||||||
|
"txMessages" : false
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name" : "Helixcoin",
|
||||||
|
"symbol" : "HXC",
|
||||||
|
"algorithm" : "max",
|
||||||
|
"txMessages" : false
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name" : "Wecoin",
|
||||||
|
"symbol" : "WEC",
|
||||||
|
"algorithm" : "max",
|
||||||
|
"txMessages" : false
|
||||||
|
}
|
|
@ -20,7 +20,7 @@
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"siteTitle": "Cryppit",
|
"siteTitle": "Cryppit",
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"statUpdateInterval": 3,
|
"statUpdateInterval": 5,
|
||||||
"hashrateWindow": 600
|
"hashrateWindow": 600
|
||||||
},
|
},
|
||||||
"proxy": {
|
"proxy": {
|
||||||
|
|
14
init.js
14
init.js
|
@ -179,6 +179,20 @@ var startRedisBlockListener = function(portalConfig){
|
||||||
|
|
||||||
|
|
||||||
var startPaymentProcessor = function(poolConfigs){
|
var startPaymentProcessor = function(poolConfigs){
|
||||||
|
|
||||||
|
var enabledForAny = false;
|
||||||
|
for (var pool in poolConfigs){
|
||||||
|
var p = poolConfigs[pool];
|
||||||
|
var enabled = p.shareProcessing && p.shareProcessing.internal && p.shareProcessing.internal.enabled;
|
||||||
|
if (enabled){
|
||||||
|
enabledForAny = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!enabledForAny)
|
||||||
|
return;
|
||||||
|
|
||||||
var worker = cluster.fork({
|
var worker = cluster.fork({
|
||||||
workerType: 'paymentProcessor',
|
workerType: 'paymentProcessor',
|
||||||
pools: JSON.stringify(poolConfigs)
|
pools: JSON.stringify(poolConfigs)
|
||||||
|
|
|
@ -19,11 +19,16 @@ module.exports = function(logger){
|
||||||
|
|
||||||
function SetupForPool(logger, poolOptions){
|
function SetupForPool(logger, poolOptions){
|
||||||
|
|
||||||
var coin = poolOptions.coin.name;
|
if (!poolOptions.shareProcessing ||
|
||||||
|
poolOptions.shareProcessing.internal ||
|
||||||
|
!poolOptions.shareProcessing.internal.enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
var coin = poolOptions.coin.name;
|
||||||
var processingConfig = poolOptions.shareProcessing.internal;
|
var processingConfig = poolOptions.shareProcessing.internal;
|
||||||
|
|
||||||
if (!processingConfig.enabled) return;
|
|
||||||
|
|
||||||
var logSystem = 'Payments';
|
var logSystem = 'Payments';
|
||||||
var logComponent = coin;
|
var logComponent = coin;
|
||||||
|
|
|
@ -64,7 +64,7 @@ module.exports = function(logger){
|
||||||
var shareProcessing = poolOptions.shareProcessing;
|
var shareProcessing = poolOptions.shareProcessing;
|
||||||
|
|
||||||
//Functions required for MPOS compatibility
|
//Functions required for MPOS compatibility
|
||||||
if (shareProcessing.mpos && shareProcessing.mpos.enabled){
|
if (shareProcessing && shareProcessing.mpos && shareProcessing.mpos.enabled){
|
||||||
var mposCompat = new MposCompatibility(logger, poolOptions)
|
var mposCompat = new MposCompatibility(logger, poolOptions)
|
||||||
|
|
||||||
handlers.auth = function(workerName, password, authCallback){
|
handlers.auth = function(workerName, password, authCallback){
|
||||||
|
@ -81,7 +81,7 @@ module.exports = function(logger){
|
||||||
}
|
}
|
||||||
|
|
||||||
//Functions required for internal payment processing
|
//Functions required for internal payment processing
|
||||||
else if (shareProcessing.internal && shareProcessing.internal.enabled){
|
else if (shareProcessing && shareProcessing.internal && shareProcessing.internal.enabled){
|
||||||
|
|
||||||
var shareProcessor = new ShareProcessor(logger, poolOptions)
|
var shareProcessor = new ShareProcessor(logger, poolOptions)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
var logSystem = 'Stats';
|
||||||
|
|
||||||
var redisClients = [];
|
var redisClients = [];
|
||||||
|
|
||||||
var algoMultipliers = {
|
var algoMultipliers = {
|
||||||
|
@ -17,8 +19,20 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
||||||
'sha256': Math.pow(2, 32)
|
'sha256': Math.pow(2, 32)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var canDoStats = true;
|
||||||
|
|
||||||
Object.keys(poolConfigs).forEach(function(coin){
|
Object.keys(poolConfigs).forEach(function(coin){
|
||||||
|
|
||||||
|
if (!canDoStats) return;
|
||||||
|
|
||||||
var poolConfig = poolConfigs[coin];
|
var poolConfig = poolConfigs[coin];
|
||||||
|
|
||||||
|
if (!poolConfig.shareProcessing || !poolConfig.shareProcessing.internal){
|
||||||
|
logger.error(logSystem, coin, 'Cannot do stats without internal share processing setup');
|
||||||
|
canDoStats = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var internalConfig = poolConfig.shareProcessing.internal;
|
var internalConfig = poolConfig.shareProcessing.internal;
|
||||||
var redisConfig = internalConfig.redis;
|
var redisConfig = internalConfig.redis;
|
||||||
|
|
||||||
|
@ -125,10 +139,10 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
||||||
var shareMultiplier = algoMultipliers[coinStats.algorithm];
|
var shareMultiplier = algoMultipliers[coinStats.algorithm];
|
||||||
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
|
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
|
||||||
coinStats.hashrate = hashratePre / 1e3 | 0;
|
coinStats.hashrate = hashratePre / 1e3 | 0;
|
||||||
delete coinStats.hashrates;
|
|
||||||
delete coinStats.shares;
|
|
||||||
portalStats.global.hashrate += coinStats.hashrate;
|
portalStats.global.hashrate += coinStats.hashrate;
|
||||||
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
||||||
|
delete coinStats.hashrates;
|
||||||
|
delete coinStats.shares;
|
||||||
});
|
});
|
||||||
|
|
||||||
_this.stats = portalStats;
|
_this.stats = portalStats;
|
||||||
|
|
|
@ -1,28 +1,3 @@
|
||||||
/* TODO
|
|
||||||
|
|
||||||
|
|
||||||
Need to condense the entire website into a single html page. Embedding the javascript and css is easy. For images,
|
|
||||||
hopefully we can only use svg which can be embedded - otherwise we can convert the image into a data-url that can
|
|
||||||
be embedded, Favicon can also be a data-url which some javascript kungfu can display in browser. I'm focusing on
|
|
||||||
this mainly to help mitigate ddos and other kinds of attacks - and to just have a badass blazing fast project.
|
|
||||||
|
|
||||||
Don't worry about doing any of that condensing yourself - go head and keep all the resources as separate files.
|
|
||||||
I will write a script for when the server starts to read all the files in the /website folder and minify and condense
|
|
||||||
it all together into one file, saved in memory. We will have 1 persistent condensed file that servers as our "template"
|
|
||||||
file that contains things like:
|
|
||||||
<div>Hashrate: {{=stats.hashrate}</div>
|
|
||||||
|
|
||||||
And then on some caching interval (maybe 5 seconds?) we will apply the template engine to generate the real html page
|
|
||||||
that we serve and hold in in memory - this is the file we serve to seo-bots (googlebot) and users when they first load
|
|
||||||
the page.
|
|
||||||
|
|
||||||
Once the user loads the page we will have server-side event source connected to the portal api where it receives
|
|
||||||
updated stats on some interval (probably 5 seconds like template cache updater) and applies the changes to the already
|
|
||||||
displayed page.
|
|
||||||
|
|
||||||
We will use fs.watch to detect changes to anything in the /website folder and update our stuff in memory.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
@ -31,6 +6,8 @@ var async = require('async');
|
||||||
var dot = require('dot');
|
var dot = require('dot');
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
|
|
||||||
|
var watch = require('node-watch');
|
||||||
|
|
||||||
var api = require('./api.js');
|
var api = require('./api.js');
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +55,8 @@ module.exports = function(logger){
|
||||||
portalConfig: portalConfig
|
portalConfig: portalConfig
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
logger.debug(logSystem, 'Stats', 'Website updated to latest stats');
|
|
||||||
|
//logger.debug(logSystem, 'Stats', 'Website updated to latest stats');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,8 +79,9 @@ module.exports = function(logger){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fs.watch('website', function(event, filename){
|
watch('website', function(filename){
|
||||||
if (event === 'change' && filename in pageFiles)
|
//if (event === 'change' && filename in pageFiles)
|
||||||
|
//READ ALL THE FILEZ BLAHHH
|
||||||
readPageFiles();
|
readPageFiles();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
"async": "*",
|
"async": "*",
|
||||||
"express": "*",
|
"express": "*",
|
||||||
"dot": "*",
|
"dot": "*",
|
||||||
"colors": "*"
|
"colors": "*",
|
||||||
|
"node-watch": "*"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10"
|
"node": ">=0.10"
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
"disabled": true,
|
||||||
|
"coin": "darkcoin.json",
|
||||||
|
|
||||||
|
"shareProcessing": {
|
||||||
|
"internal": {
|
||||||
|
"enabled": true,
|
||||||
|
"validateWorkerAddress": true,
|
||||||
|
"paymentInterval": 10,
|
||||||
|
"minimumPayment": 100.001,
|
||||||
|
"minimumReserve": 10,
|
||||||
|
"feePercent": 0.02,
|
||||||
|
"feeReceiveAddress": "XfkoYutJ8KYtLxZ4TgnMqC6SCmxuc3LEDY",
|
||||||
|
"feeWithdrawalThreshold": 5,
|
||||||
|
"daemon": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 18342,
|
||||||
|
"user": "darkcoinrpc1",
|
||||||
|
"password": "testpass"
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 6379
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mpos": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 3306,
|
||||||
|
"user": "me",
|
||||||
|
"password": "mypass",
|
||||||
|
"database": "ltc",
|
||||||
|
"stratumAuth": "password"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"address": "XfkoYutJ8KYtLxZ4TgnMqC6SCmxuc3LEDY",
|
||||||
|
"blockRefreshInterval": 1000,
|
||||||
|
"txRefreshInterval": 20000,
|
||||||
|
"connectionTimeout": 600,
|
||||||
|
|
||||||
|
"banning": {
|
||||||
|
"enabled": true,
|
||||||
|
"time": 600,
|
||||||
|
"invalidPercent": 50,
|
||||||
|
"checkThreshold": 500,
|
||||||
|
"purgeInterval": 300
|
||||||
|
},
|
||||||
|
|
||||||
|
"ports": {
|
||||||
|
"4073": {
|
||||||
|
"diff": 0.002
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 18342,
|
||||||
|
"user": "darkcoinrpc1",
|
||||||
|
"password": "testpass"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"disabled": false,
|
||||||
|
"coin": "galleon.json",
|
||||||
|
|
||||||
|
"address": "GRAiuGCWLrL8Psdr6pkhLpxrQGHdYfrSEz",
|
||||||
|
"blockRefreshInterval": 1000,
|
||||||
|
"txRefreshInterval": 20000,
|
||||||
|
"connectionTimeout": 600,
|
||||||
|
|
||||||
|
"shareProcessing": {
|
||||||
|
"internal": {
|
||||||
|
"enabled": true,
|
||||||
|
"validateWorkerAddress": true,
|
||||||
|
"paymentInterval": 10,
|
||||||
|
"minimumPayment": 100.001,
|
||||||
|
"minimumReserve": 10,
|
||||||
|
"feePercent": 0.02,
|
||||||
|
"feeReceiveAddress": "GRAiuGCWLrL8Psdr6pkhLpxrQGHdYfrSEz",
|
||||||
|
"feeWithdrawalThreshold": 5,
|
||||||
|
"daemon": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19632,
|
||||||
|
"user": "testuser",
|
||||||
|
"password": "testpass"
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 6379
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"ports": {
|
||||||
|
"3537": {
|
||||||
|
"diff": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19632,
|
||||||
|
"user": "testuser",
|
||||||
|
"password": "testpass"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"p2p": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19333,
|
||||||
|
"protocolVersion": 70002,
|
||||||
|
"magic": "fcc1b7dc"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"disabled": true,
|
||||||
|
"coin": "helixcoin.json",
|
||||||
|
|
||||||
|
"address": "H9xyrh45LzLX4uXCP6jG6ZGrWho8srUgiG",
|
||||||
|
"blockRefreshInterval": 1000,
|
||||||
|
"txRefreshInterval": 20000,
|
||||||
|
"connectionTimeout": 600,
|
||||||
|
|
||||||
|
|
||||||
|
"ports": {
|
||||||
|
"3737": {
|
||||||
|
"diff": 0.2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 16385,
|
||||||
|
"user": "testuser",
|
||||||
|
"password": "testpass"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"p2p": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19333,
|
||||||
|
"protocolVersion": 70002,
|
||||||
|
"magic": "fcc1b7dc"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
"disabled": true,
|
||||||
|
"coin": "hirocoin.json",
|
||||||
|
|
||||||
|
"shareProcessing": {
|
||||||
|
"internal": {
|
||||||
|
"enabled": true,
|
||||||
|
"validateWorkerAddress": true,
|
||||||
|
"paymentInterval": 10,
|
||||||
|
"minimumPayment": 100.001,
|
||||||
|
"minimumReserve": 10,
|
||||||
|
"feePercent": 0.02,
|
||||||
|
"feeReceiveAddress": "HR6WNSR19kvaXSbwKymrba6uNx36BBjinS",
|
||||||
|
"feeWithdrawalThreshold": 5,
|
||||||
|
"daemon": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19389,
|
||||||
|
"user": "hirocoin",
|
||||||
|
"password": "testpass"
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 6379
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mpos": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 3306,
|
||||||
|
"user": "me",
|
||||||
|
"password": "mypass",
|
||||||
|
"database": "ltc",
|
||||||
|
"stratumAuth": "password"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"address": "HR6WNSR19kvaXSbwKymrba6uNx36BBjinS",
|
||||||
|
"blockRefreshInterval": 1000,
|
||||||
|
"txRefreshInterval": 20000,
|
||||||
|
"connectionTimeout": 600,
|
||||||
|
|
||||||
|
"banning": {
|
||||||
|
"enabled": true,
|
||||||
|
"time": 600,
|
||||||
|
"invalidPercent": 50,
|
||||||
|
"checkThreshold": 500,
|
||||||
|
"purgeInterval": 300
|
||||||
|
},
|
||||||
|
|
||||||
|
"ports": {
|
||||||
|
"3073": {
|
||||||
|
"diff": 0.002
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19389,
|
||||||
|
"user": "hirocoin",
|
||||||
|
"password": "testpass"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
"disabled": true,
|
||||||
|
"coin": "hobonickels.json",
|
||||||
|
|
||||||
|
"shareProcessing": {
|
||||||
|
"internal": {
|
||||||
|
"enabled": true,
|
||||||
|
"validateWorkerAddress": true,
|
||||||
|
"paymentInterval": 10,
|
||||||
|
"minimumPayment": 100.001,
|
||||||
|
"minimumReserve": 10,
|
||||||
|
"feePercent": 0.02,
|
||||||
|
"feeReceiveAddress": "EhA4HXF7VPWfnV8TXerAP6p12BiEpXbiYR",
|
||||||
|
"feeWithdrawalThreshold": 5,
|
||||||
|
"daemon": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19339,
|
||||||
|
"user": "hobonickelsrpc",
|
||||||
|
"password": "testpass"
|
||||||
|
},
|
||||||
|
"redis": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 6379
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mpos": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 3306,
|
||||||
|
"user": "me",
|
||||||
|
"password": "mypass",
|
||||||
|
"database": "ltc",
|
||||||
|
"stratumAuth": "password"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"address": "EzGiarU2S56jyRkYpS7FKssXCS6AAJChdU",
|
||||||
|
"blockRefreshInterval": 1000,
|
||||||
|
"txRefreshInterval": 20000,
|
||||||
|
"connectionTimeout": 600,
|
||||||
|
|
||||||
|
"banning": {
|
||||||
|
"enabled": true,
|
||||||
|
"time": 600,
|
||||||
|
"invalidPercent": 50,
|
||||||
|
"checkThreshold": 500,
|
||||||
|
"purgeInterval": 300
|
||||||
|
},
|
||||||
|
|
||||||
|
"ports": {
|
||||||
|
"3033": {
|
||||||
|
"diff": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19339,
|
||||||
|
"user": "hobonickelsrpc",
|
||||||
|
"password": "testpass"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
To get started....
|
To get started simply....
|
||||||
|
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue