Compare commits
87 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f892d8275 | ||
|
|
8a673b6d7c | ||
|
|
fe0b9ecafb | ||
|
|
18b29033a8 | ||
|
|
3d9eb88ad4 | ||
|
|
4b4e18e564 | ||
|
|
2afb47a8c9 | ||
|
|
a1229102ee | ||
|
|
46e5cca125 | ||
|
|
9cc31a3cd3 | ||
|
|
ace7e61f45 | ||
|
|
a418dcd868 | ||
|
|
aa44f3d410 | ||
|
|
a2d3654c1b | ||
|
|
a7c4d6d26e | ||
|
|
a20c6350a2 | ||
|
|
0ea18d0d66 | ||
|
|
d130958050 | ||
|
|
de0b5eb1cd | ||
|
|
34375e1f8e | ||
|
|
6d8781de5e | ||
|
|
2d991e4b9d | ||
|
|
9e2006489e | ||
|
|
94ef015a94 | ||
|
|
7740d7dc97 | ||
|
|
f2497dec67 | ||
|
|
47a3a79041 | ||
|
|
cfddff320b | ||
|
|
f7ea01ca63 | ||
|
|
6fd667defb | ||
|
|
3036375362 | ||
|
|
bceb492ada | ||
|
|
26e9640d52 | ||
|
|
4848abda96 | ||
|
|
3a8e470caa | ||
|
|
77da8a5693 | ||
|
|
b955c0cc51 | ||
|
|
baa1d1bf36 | ||
|
|
7c917d82e7 | ||
|
|
c2ca8e4a80 | ||
|
|
3ecfef0ff4 | ||
|
|
3a8508d68d | ||
|
|
490fe51845 | ||
|
|
eadc0fadf1 | ||
|
|
8dbdf7a920 | ||
|
|
1da82420df | ||
|
|
aa5fc5e28f | ||
|
|
10e621ca92 | ||
|
|
69e821432e | ||
|
|
69870510d8 | ||
|
|
6353e7822a | ||
|
|
9b00f2a3cf | ||
|
|
9e6af5adfd | ||
|
|
44528b4518 | ||
|
|
138785c2e9 | ||
|
|
27893e227f | ||
|
|
bed02e0d4a | ||
|
|
45bddd4804 | ||
|
|
a620c635cb | ||
|
|
8828fd222c | ||
|
|
0d2becfe81 | ||
|
|
c9b601d698 | ||
|
|
7cec749db4 | ||
|
|
4c771dd537 | ||
|
|
a7bc8e551b | ||
|
|
b576bc5600 | ||
|
|
0b559ed4b4 | ||
|
|
34d185a8ec | ||
|
|
78882305b7 | ||
|
|
f51bb4dc13 | ||
|
|
c7a84fcabd | ||
|
|
c9ab1e8325 | ||
|
|
cc3887fd21 | ||
|
|
00b769814d | ||
|
|
509828b30e | ||
|
|
bea3bd8d20 | ||
|
|
d2b6e89c4d | ||
|
|
e3dc331508 | ||
|
|
6acd346ed8 | ||
|
|
494e2a13cc | ||
|
|
31fa601539 | ||
|
|
952a5cb196 | ||
|
|
6fbedae7b6 | ||
|
|
f999ebff18 | ||
|
|
7abfb5151b | ||
|
|
f49728c461 | ||
|
|
621e13b17f |
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "Example",
|
||||
"symbol": "EXM",
|
||||
"algorithm": "x99",
|
||||
"peerMagic": "0f0f0f0f",
|
||||
"peerMagicTestnet": "f0f0f0f0",
|
||||
|
||||
"mainnet": {
|
||||
"bech32": "ex",
|
||||
"bip32": {
|
||||
"public": "0f0f0f0f"
|
||||
},
|
||||
"pubKeyHash": "00",
|
||||
"scriptHash": "ff"
|
||||
},
|
||||
|
||||
"testnet": {
|
||||
"bech32": "tex",
|
||||
"bip32": {
|
||||
"public": "f0f0f0f0"
|
||||
},
|
||||
"pubKeyHash": "0f",
|
||||
"scriptHash": "f0"
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "Chaincoin",
|
||||
"symbol": "CHC",
|
||||
"algorithm": "c11",
|
||||
"peerMagic": "a3d27a03",
|
||||
"peerMagicTestnet": "fbc21102",
|
||||
|
||||
"mainnet": {
|
||||
"bech32": "chc",
|
||||
"bip32": {
|
||||
"public": "0488b21e"
|
||||
},
|
||||
"pubKeyHash": "1c",
|
||||
"scriptHash": "04"
|
||||
},
|
||||
|
||||
"testnet": {
|
||||
"bech32": "tchc",
|
||||
"bip32": {
|
||||
"public": "043587cf"
|
||||
},
|
||||
"pubKeyHash": "50",
|
||||
"scriptHash": "2c"
|
||||
}
|
||||
}
|
||||
@ -2,5 +2,5 @@
|
||||
"name": "Fastcoin",
|
||||
"symbol": "FST",
|
||||
"algorithm": "scrypt",
|
||||
"peerMagic": "fbc0b6db"
|
||||
"peerMagic": "fdc2b5dc"
|
||||
}
|
||||
@ -1,25 +1,7 @@
|
||||
{
|
||||
"name": "Litecoin",
|
||||
"symbol": "LTC",
|
||||
"algorithm": "scrypt",
|
||||
"peerMagic": "fbc0b6db",
|
||||
"peerMagicTestnet": "fdd2c8f1",
|
||||
|
||||
"mainnet": {
|
||||
"bech32": "ltc",
|
||||
"bip32": {
|
||||
"public": "0488B21E"
|
||||
},
|
||||
"pubKeyHash": "30",
|
||||
"scriptHash": "05"
|
||||
},
|
||||
|
||||
"testnet": {
|
||||
"bech32": "tltc",
|
||||
"bip32": {
|
||||
"public": "043587CF"
|
||||
},
|
||||
"pubKeyHash": "6F",
|
||||
"scriptHash": "C4"
|
||||
}
|
||||
"name": "Litecoin",
|
||||
"symbol": "LTC",
|
||||
"algorithm": "scrypt",
|
||||
"peerMagic": "fbc0b6db",
|
||||
"peerMagicTestnet": "fdd2c8f1"
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
"hashrateWindow": 300
|
||||
},
|
||||
"adminCenter": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"password": "password"
|
||||
}
|
||||
},
|
||||
|
||||
31
init.js
31
init.js
@ -82,10 +82,6 @@ if (cluster.isWorker){
|
||||
case 'profitSwitch':
|
||||
new ProfitSwitch(logger);
|
||||
break;
|
||||
case 'switchingPaymentProcessor':
|
||||
var SwitchingPaymentProcessor = require('./libs/switchingPaymentProcessor.js');
|
||||
new SwitchingPaymentProcessor(logger);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -147,17 +143,6 @@ var buildPoolConfigs = function(){
|
||||
var coinProfile = JSON.parse(JSON.minify(fs.readFileSync(coinFilePath, {encoding: 'utf8'})));
|
||||
poolOptions.coin = coinProfile;
|
||||
poolOptions.coin.name = poolOptions.coin.name.toLowerCase();
|
||||
if (coinProfile.mainnet) {
|
||||
poolOptions.coin.mainnet.bip32.public = Buffer.from(coinProfile.mainnet.bip32.public, 'hex').readUInt32LE(0);
|
||||
poolOptions.coin.mainnet.pubKeyHash = Buffer.from(coinProfile.mainnet.pubKeyHash, 'hex').readUInt8(0);
|
||||
poolOptions.coin.mainnet.scriptHash = Buffer.from(coinProfile.mainnet.scriptHash, 'hex').readUInt8(0);
|
||||
}
|
||||
if (coinProfile.testnet) {
|
||||
poolOptions.coin.testnet.bip32.public = Buffer.from(coinProfile.testnet.bip32.public, 'hex').readUInt32LE(0);
|
||||
poolOptions.coin.testnet.pubKeyHash = Buffer.from(coinProfile.testnet.pubKeyHash, 'hex').readUInt8(0);
|
||||
poolOptions.coin.testnet.scriptHash = Buffer.from(coinProfile.testnet.scriptHash, 'hex').readUInt8(0);
|
||||
}
|
||||
|
||||
|
||||
if (poolOptions.coin.name in configs){
|
||||
|
||||
@ -371,21 +356,7 @@ var processCoinSwitchCommand = function(params, options, reply){
|
||||
|
||||
};
|
||||
|
||||
var startSwitchingPaymentProcessor = function(){
|
||||
if (!fs.existsSync('libs/switchingPaymentProcessor.js')) return;
|
||||
|
||||
var worker = cluster.fork({
|
||||
workerType: 'switchingPaymentProcessor',
|
||||
pools: JSON.stringify(poolConfigs),
|
||||
portalConfig: JSON.stringify(portalConfig)
|
||||
});
|
||||
worker.on('exit', function(code, signal){
|
||||
logger.error('Master', 'Switching Payment Processor', 'Died, spawning replacement...');
|
||||
setTimeout(function(){
|
||||
startSwitchingPaymentProcessor();
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
|
||||
var startPaymentProcessor = function(){
|
||||
|
||||
@ -463,8 +434,6 @@ var startProfitSwitch = function(){
|
||||
|
||||
startPaymentProcessor();
|
||||
|
||||
startSwitchingPaymentProcessor();
|
||||
|
||||
startWebsite();
|
||||
|
||||
startProfitSwitch();
|
||||
|
||||
@ -8,7 +8,7 @@ module.exports = function() {
|
||||
|
||||
// Constants
|
||||
var version = '0.0.1',
|
||||
PUBLIC_API_URL = 'https://www.coinwarz.com/v1/api/profitability/?apikey=YOUR_API_KEY&algo=all',
|
||||
PUBLIC_API_URL = 'http://www.coinwarz.com/v1/api/profitability/?apikey=YOUR_API_KEY&algo=all',
|
||||
USER_AGENT = 'nomp/node-open-mining-portal'
|
||||
|
||||
// Constructor
|
||||
|
||||
@ -8,7 +8,7 @@ module.exports = function() {
|
||||
|
||||
// Constants
|
||||
var version = '0.1.0',
|
||||
PUBLIC_API_URL = 'https://pubapi.cryptsy.com/api.php',
|
||||
PUBLIC_API_URL = 'http://pubapi.cryptsy.com/api.php',
|
||||
PRIVATE_API_URL = 'https://api.cryptsy.com/api',
|
||||
USER_AGENT = 'nomp/node-open-mining-portal'
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ module.exports = function(logger, poolConfig){
|
||||
shareData.worker,
|
||||
isValidShare ? 'Y' : 'N',
|
||||
isValidBlock ? 'Y' : 'N',
|
||||
shareData.shareDiff,
|
||||
shareData.difficulty * (poolConfig.coin.mposDiffMultiplier || 1),
|
||||
typeof(shareData.error) === 'undefined' ? null : shareData.error,
|
||||
shareData.blockHash ? shareData.blockHash : (shareData.blockHashInvalid ? shareData.blockHashInvalid : '')
|
||||
];
|
||||
|
||||
@ -64,7 +64,6 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||
|
||||
async.parallel([
|
||||
function(callback){
|
||||
if (poolOptions.address != false) {
|
||||
daemon.cmd('validateaddress', [poolOptions.address], function(result) {
|
||||
if (result.error){
|
||||
logger.error(logSystem, logComponent, 'Error with payment processing daemon ' + JSON.stringify(result.error));
|
||||
@ -91,8 +90,6 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||
callback()
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
else callback();
|
||||
},
|
||||
function(callback){
|
||||
daemon.cmd('getbalance', [], function(result){
|
||||
@ -532,37 +529,12 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||
});
|
||||
};
|
||||
|
||||
function handleAddress(address) {
|
||||
if (address.length === 40){
|
||||
return util.addressFromEx(poolOptions.address, address);
|
||||
}
|
||||
else return address;
|
||||
}
|
||||
|
||||
var getProperAddress = function(address){
|
||||
if (address != false) {
|
||||
return handleAddress(address);
|
||||
} else {
|
||||
var addressToPay = '';
|
||||
|
||||
daemon.cmd('getnewaddress', [], function(result){
|
||||
if (result.error){
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
addressToPay = result.data;
|
||||
}
|
||||
catch(e){
|
||||
logger.error(logSystem, logComponent, 'Error getting a new address. Got: ' + result.data);
|
||||
callback(true);
|
||||
}
|
||||
|
||||
}, true, true);
|
||||
|
||||
return handleAddress(addressToPay);
|
||||
|
||||
}
|
||||
if (address.length === 40){
|
||||
return util.addressFromEx(poolOptions.address, address);
|
||||
}
|
||||
else return address;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -18,33 +18,6 @@ module.exports = function(logger){
|
||||
|
||||
var proxySwitch = {};
|
||||
|
||||
var switchingDaemons = (function(){
|
||||
var daemons = {};
|
||||
|
||||
for (var switchName in portalConfig.switching){
|
||||
if (!portalConfig.switching[switchName].singleCoinPayout) continue;
|
||||
var daemonConfig = portalConfig.switching[switchName].singleCoinPayout.daemon;
|
||||
var daemon = new Stratum.daemon.interface([daemonConfig], function(severity, message){
|
||||
logger[severity](logSystem, logComponent, message);
|
||||
});
|
||||
daemons[switchName] = daemon;
|
||||
}
|
||||
|
||||
return daemons;
|
||||
})();
|
||||
|
||||
var singleCoinPayoutPorts = (function(){
|
||||
var ports = {};
|
||||
for (var switchName in portalConfig.switching){
|
||||
if (!portalConfig.switching[switchName].singleCoinPayout) continue;
|
||||
for (var port in portalConfig.switching[switchName].ports){
|
||||
ports[parseInt(port)] = switchName;
|
||||
}
|
||||
}
|
||||
return ports;
|
||||
})();
|
||||
|
||||
|
||||
var redisClient = redis.createClient(portalConfig.redis.port, portalConfig.redis.host);
|
||||
|
||||
//Handle messages from master process sent via IPC
|
||||
@ -155,13 +128,10 @@ module.exports = function(logger){
|
||||
//Functions required for internal payment processing
|
||||
else{
|
||||
|
||||
var shareProcessor = new ShareProcessor(logger, portalConfig, poolOptions, singleCoinPayoutPorts);
|
||||
var shareProcessor = new ShareProcessor(logger, poolOptions);
|
||||
|
||||
handlers.auth = function(port, workerName, password, authCallback){
|
||||
|
||||
var switchDaemon = switchingDaemons[singleCoinPayoutPorts[port]];
|
||||
|
||||
if (!switchDaemon && poolOptions.validateWorkerUsername !== true)
|
||||
if (poolOptions.validateWorkerUsername !== true)
|
||||
authCallback(true);
|
||||
else {
|
||||
if (workerName.length === 40) {
|
||||
@ -174,9 +144,7 @@ module.exports = function(logger){
|
||||
}
|
||||
}
|
||||
else {
|
||||
var daemon = switchDaemon || pool.daemon;
|
||||
|
||||
daemon.cmd('validateaddress', [workerName], function (results) {
|
||||
pool.daemon.cmd('validateaddress', [workerName], function (results) {
|
||||
var isValid = results.filter(function (r) {
|
||||
return r.response.isvalid
|
||||
}).length > 0;
|
||||
|
||||
@ -15,7 +15,7 @@ value: a hash with..
|
||||
|
||||
|
||||
|
||||
module.exports = function(logger, portalConfig, poolConfig, singleCoinPayoutPorts){
|
||||
module.exports = function(logger, poolConfig){
|
||||
|
||||
var redisConfig = poolConfig.redis;
|
||||
var coin = poolConfig.coin.name;
|
||||
@ -68,25 +68,10 @@ module.exports = function(logger, portalConfig, poolConfig, singleCoinPayoutPort
|
||||
|
||||
this.handleShare = function(isValidShare, isValidBlock, shareData){
|
||||
|
||||
|
||||
/*var shareKey = (function(){
|
||||
var port = shareData.port.toString();
|
||||
for (var switchName in portalConfig.switching){
|
||||
if (!portalConfig.switching[switchName]['singleCoinPayout']) continue;
|
||||
var ports = Object.keys(portalConfig.switching[switchName].ports);
|
||||
if (ports.indexOf(port) !== -1) return switchName;
|
||||
}
|
||||
return coin;
|
||||
})();*/
|
||||
|
||||
var shareKey = singleCoinPayoutPorts[shareData.port] || coin;
|
||||
|
||||
console.log('share key ' + shareKey);
|
||||
|
||||
var redisCommands = [];
|
||||
|
||||
if (isValidShare){
|
||||
redisCommands.push(['hincrbyfloat', shareKey + ':shares:roundCurrent', shareData.worker, shareData.difficulty]);
|
||||
redisCommands.push(['hincrbyfloat', coin + ':shares:roundCurrent', shareData.worker, shareData.difficulty]);
|
||||
redisCommands.push(['hincrby', coin + ':stats', 'validShares', 1]);
|
||||
}
|
||||
else{
|
||||
|
||||
12
package.json
12
package.json
@ -12,9 +12,9 @@
|
||||
"litecoin",
|
||||
"scrypt"
|
||||
],
|
||||
"homepage": "https://github.com/zone117x/node-open-mining-portal",
|
||||
"homepage": "https://github.com/ranchimall/node-open-mining-portal",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zone117x/node-open-mining-portal/issues"
|
||||
"url": "https://github.com/ranchimall/node-open-mining-portal/issues"
|
||||
},
|
||||
"license": "GPL-2.0",
|
||||
"author": "Matthew Little",
|
||||
@ -28,10 +28,10 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zone117x/node-open-mining-portal.git"
|
||||
"url": "https://github.com/ranchimall/node-open-mining-portal.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"stratum-pool": "git://github.com/zone117x/node-stratum-pool.git#dev",
|
||||
"stratum-pool": "git://github.com/ranchimall/node-stratum-pool.git",
|
||||
"dateformat": "1.0.12",
|
||||
"node-json-minify": "*",
|
||||
"redis": "0.12.1",
|
||||
@ -42,10 +42,10 @@
|
||||
"compression": "*",
|
||||
"dot": "*",
|
||||
"colors": "*",
|
||||
"node-watch": "*",
|
||||
"node-watch": "0.5.9",
|
||||
"request": "2.69.0",
|
||||
"nonce": "*",
|
||||
"bignum": "0.13.0",
|
||||
"bignum": "0.12.1",
|
||||
"extend": "*"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
<link rel="icon" type="image/png" href="/static/favicon.png"/>
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.min.css">
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<div>
|
||||
This site is powered by the open source <a target="_blank" href="https://github.com/zone117x/node-open-mining-portal/">NOMP</a>
|
||||
project created by Matthew Little and licensed under the <a href="https://www.gnu.org/licenses/gpl-2.0.html">GPL</a>
|
||||
project created by Matthew Little and licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GPL</a>
|
||||
</div>
|
||||
<div>
|
||||
<i class="fa fa-heart"></i> Support this project by donating <i class="fa fa-btc"></i> BTC: 1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR
|
||||
@ -84,9 +84,9 @@
|
||||
<div id="communityFooter">
|
||||
Community <i class="fa fa-comment"></i> : <a target="_blank" href="https://kiwiirc.com/client/irc.freenode.net/nomp">#nomp IRC</a>
|
||||
|
|
||||
<a target="_blank" href="https://reddit.com/r/nomp">/r/nomp</a>
|
||||
<a target="_blank" href="http://reddit.com/r/nomp">/r/nomp</a>
|
||||
|
|
||||
<iframe src="https://ghbtns.com/github-btn.html?user=zone117x&repo=node-open-mining-portal&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="140" height="20"></iframe>
|
||||
<iframe src="http://ghbtns.com/github-btn.html?user=zone117x&repo=node-open-mining-portal&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="140" height="20"></iframe>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user