mirror of https://github.com/BTCPrivate/z-nomp.git
Refactored config options
This commit is contained in:
parent
08fe9ab18d
commit
7f500fc3df
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Darkcoin",
|
||||||
|
"symbol": "drk",
|
||||||
|
"algorithm": "x11",
|
||||||
|
"reward": "POW",
|
||||||
|
"txMessages": false
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Litecoin",
|
||||||
|
"symbol": "ltc",
|
||||||
|
"algorithm": "scrypt",
|
||||||
|
"reward": "POW",
|
||||||
|
"txMessages": false
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Skeincoin",
|
||||||
|
"symbol": "skc",
|
||||||
|
"algorithm": "skein",
|
||||||
|
"reward": "POW",
|
||||||
|
"txMessages": false
|
||||||
|
}
|
40
init.js
40
init.js
|
@ -35,13 +35,30 @@ stratum.on('log', function(logText){
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
fs.readdirSync('coins').forEach(function(file){
|
var coinProfiles = (function(){
|
||||||
|
var profiles = {};
|
||||||
|
fs.readdirSync('coins').forEach(function(file){
|
||||||
|
var coinProfile = JSON.parse(JSON.minify(fs.readFileSync('coins/' + file, {encoding: 'utf8'})));
|
||||||
|
profiles[coinProfile.name.toLowerCase()] = coinProfile;
|
||||||
|
});
|
||||||
|
return profiles;
|
||||||
|
})();
|
||||||
|
|
||||||
var coinOptions = JSON.parse(JSON.minify(fs.readFileSync('coins/' + file, {encoding: 'utf8'})));
|
fs.readdirSync('pool_configs').forEach(function(file){
|
||||||
|
|
||||||
|
var poolOptions = JSON.parse(JSON.minify(fs.readFileSync('pool_configs/' + file, {encoding: 'utf8'})));
|
||||||
|
if (poolOptions.disabled) return;
|
||||||
|
|
||||||
|
if (!(poolOptions.coin.toLowerCase() in coinProfiles)){
|
||||||
|
logError(poolOptions.coin, 'system', 'could not find coin profile');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
poolOptions.coin = coinProfiles[poolOptions.coin.toLowerCase()];
|
||||||
|
|
||||||
var authorizeFN = function (ip, workerName, password, callback) {
|
var authorizeFN = function (ip, workerName, password, callback) {
|
||||||
// Default implementation just returns true
|
// Default implementation just returns true
|
||||||
logDebug(coinOptions.name, 'client', "Authorize ["+ip+"] "+workerName+":"+password);
|
logDebug(poolOptions.coin.name, 'client', "Authorize ["+ip+"] "+workerName+":"+password);
|
||||||
callback({
|
callback({
|
||||||
error: null,
|
error: null,
|
||||||
authorized: true,
|
authorized: true,
|
||||||
|
@ -50,28 +67,29 @@ fs.readdirSync('coins').forEach(function(file){
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var pool = stratum.createPool(coinOptions, authorizeFN);
|
|
||||||
|
var pool = stratum.createPool(poolOptions, authorizeFN);
|
||||||
pool.on('share', function(isValidShare, isValidBlock, data){
|
pool.on('share', function(isValidShare, isValidBlock, data){
|
||||||
|
|
||||||
var shareData = JSON.stringify(data);
|
var shareData = JSON.stringify(data);
|
||||||
|
|
||||||
if (data.solution && !isValidBlock)
|
if (data.solution && !isValidBlock)
|
||||||
logDebug(coinOptions.name, 'client', 'We thought a block solution was found but it was rejected by the daemon, share data: ' + shareData);
|
logDebug(poolOptions.coin.name, 'client', 'We thought a block solution was found but it was rejected by the daemon, share data: ' + shareData);
|
||||||
else if (isValidBlock)
|
else if (isValidBlock)
|
||||||
logDebug(coinOptions.name, 'client', 'Block found, share data: ' + shareData);
|
logDebug(poolOptions.coin.name, 'client', 'Block found, share data: ' + shareData);
|
||||||
else if (isValidShare)
|
else if (isValidShare)
|
||||||
logDebug(coinOptions.name, 'client', 'Valid share submitted, share data: ' + shareData);
|
logDebug(poolOptions.coin.name, 'client', 'Valid share submitted, share data: ' + shareData);
|
||||||
else
|
else
|
||||||
logDebug(coinOptions.name, 'client', 'Invalid share submitted, share data: ' + shareData)
|
logDebug(poolOptions.coin.name, 'client', 'Invalid share submitted, share data: ' + shareData)
|
||||||
|
|
||||||
|
|
||||||
}).on('log', function(severity, logKey, logText) {
|
}).on('log', function(severity, logKey, logText) {
|
||||||
if (severity == 'debug') {
|
if (severity == 'debug') {
|
||||||
logDebug(coinOptions.name, logKey, logText);
|
logDebug(poolOptions.coin.name, logKey, logText);
|
||||||
} else if (severity == 'warning') {
|
} else if (severity == 'warning') {
|
||||||
logWarning(coinOptions.name, logKey, logText);
|
logWarning(poolOptions.coin.name, logKey, logText);
|
||||||
} else if (severity == 'error') {
|
} else if (severity == 'error') {
|
||||||
logError(coinOptions.name, logKey, logText);
|
logError(poolOptions.coin.name, logKey, logText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pool.start();
|
pool.start();
|
||||||
|
|
|
@ -1,37 +1,30 @@
|
||||||
{
|
{
|
||||||
"name": "Litecoin",
|
"disabled": true,
|
||||||
"symbol": "ltc",
|
"coin": "darkcoin",
|
||||||
"algorithm": "scrypt",
|
"pool": {
|
||||||
"reward": "POW",
|
"address": "XjkzAVe3zywGhDFSbJtqUN6xeKP37PSNSh",
|
||||||
"txMessages": false,
|
"stratumPort": 3336,
|
||||||
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc",
|
"difficulty": 0.005,
|
||||||
"stratumPort": 3334,
|
"blockRefreshInterval": 1000
|
||||||
"difficulty": 8,
|
},
|
||||||
"blockRefreshInterval": 1000,
|
"daemons": [
|
||||||
"daemon": [
|
|
||||||
{
|
{
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 19332,
|
"port": 15342,
|
||||||
"user": "litecoinrpc",
|
"user": "darkcoinrpc1",
|
||||||
"password": "testnet"
|
"password": "drkpass"
|
||||||
},
|
|
||||||
{
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 19344,
|
|
||||||
"user": "litecoinrpc",
|
|
||||||
"password": "testnet"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"varDiff": {
|
"varDiff": {
|
||||||
"enabled": true,
|
"enabled": false,
|
||||||
"minDifficulty": 16,
|
"minDifficulty": 1,
|
||||||
"maxDifficulty": 1000,
|
"maxDifficulty": 1000,
|
||||||
"targetTime": 30,
|
"targetTime": 30,
|
||||||
"retargetTime": 120,
|
"retargetTime": 120,
|
||||||
"variancePercent": 20
|
"variancePercent": 20
|
||||||
},
|
},
|
||||||
"p2p": {
|
"p2p": {
|
||||||
"enabled": true,
|
"enabled": false,
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": 19333,
|
"port": 19333,
|
||||||
|
|
||||||
|
@ -40,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
"protocolVersion": 70002,
|
"protocolVersion": 70002,
|
||||||
|
|
||||||
/* Magic value is different for main/testnet and for each coin. It is found in the daemon
|
/* Magic value is different for main/testnet and for each coins. It is found in the daemon
|
||||||
source code as the pchMessageStart variable. For example, litecoin mainnet:
|
source code as the pchMessageStart variable. For example, litecoin mainnet:
|
||||||
http://github.com/litecoin-project/litecoin/blob/85f303d883ffff35238eaea5174b780c950c0ae4/src/main.cpp#L3059
|
http://github.com/litecoin-project/litecoin/blob/85f303d883ffff35238eaea5174b780c950c0ae4/src/main.cpp#L3059
|
||||||
And for litecoin testnet:
|
And for litecoin testnet:
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"disabled": false,
|
||||||
|
"coin": "litecoin",
|
||||||
|
"pool": {
|
||||||
|
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc",
|
||||||
|
"stratumPort": 3334,
|
||||||
|
"difficulty": 8,
|
||||||
|
"blockRefreshInterval": 1000
|
||||||
|
},
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19332,
|
||||||
|
"user": "litecoinrpc",
|
||||||
|
"password": "testnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19344,
|
||||||
|
"user": "litecoinrpc",
|
||||||
|
"password": "testnet"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"varDiff": {
|
||||||
|
"enabled": true,
|
||||||
|
"minDifficulty": 16,
|
||||||
|
"maxDifficulty": 1000,
|
||||||
|
"targetTime": 30,
|
||||||
|
"retargetTime": 120,
|
||||||
|
"variancePercent": 20
|
||||||
|
},
|
||||||
|
"p2p": {
|
||||||
|
"enabled": true,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19333,
|
||||||
|
"protocolVersion": 70002,
|
||||||
|
"magic": "fcc1b7dc"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"disabled": true,
|
||||||
|
"coin": "skeincoin",
|
||||||
|
"pool": {
|
||||||
|
"address": "SUxtDjHYijztRKjbnBkvEbA3mQ5wFeS72H",
|
||||||
|
"stratumPort": 3336,
|
||||||
|
"difficulty": 0.005,
|
||||||
|
"blockRefreshInterval": 1000
|
||||||
|
},
|
||||||
|
"daemons": [
|
||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 15347,
|
||||||
|
"user": "skeincoinrpc1",
|
||||||
|
"password": "skcpass"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"varDiff": {
|
||||||
|
"enabled": false,
|
||||||
|
"minDifficulty": 16,
|
||||||
|
"maxDifficulty": 1000,
|
||||||
|
"targetTime": 30,
|
||||||
|
"retargetTime": 120,
|
||||||
|
"variancePercent": 20
|
||||||
|
},
|
||||||
|
"p2p": {
|
||||||
|
"enabled": false,
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 19333,
|
||||||
|
|
||||||
|
/* Found in src as the PROTOCOL_VERSION variable, for example:
|
||||||
|
https://github.com/litecoin-project/litecoin/blob/85f303d883ffff35238eaea5174b780c950c0ae4/src/version.h#L28
|
||||||
|
*/
|
||||||
|
"protocolVersion": 70002,
|
||||||
|
|
||||||
|
/* Magic value is different for main/testnet and for each coins. It is found in the daemon
|
||||||
|
source code as the pchMessageStart variable. For example, litecoin mainnet:
|
||||||
|
http://github.com/litecoin-project/litecoin/blob/85f303d883ffff35238eaea5174b780c950c0ae4/src/main.cpp#L3059
|
||||||
|
And for litecoin testnet:
|
||||||
|
http://github.com/litecoin-project/litecoin/blob/85f303d883ffff35238eaea5174b780c950c0ae4/src/main.cpp#L2722-L2725
|
||||||
|
*/
|
||||||
|
"magic": "fcc1b7dc"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue