Updated structure
This commit is contained in:
parent
5e8353edc8
commit
fb4dd5af81
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Dogecoin",
|
|
||||||
"symbol": "doge",
|
|
||||||
"algorithm": "scrypt",
|
|
||||||
"reward": "POW",
|
|
||||||
"address": "n3s8iDk1onxyY2nuC1k4HoRQFGJ7BhjFcq",
|
|
||||||
"stratumPort": 3334,
|
|
||||||
"difficulty": 8,
|
|
||||||
"blockRefreshInterval": 5,
|
|
||||||
"daemon": {
|
|
||||||
"host": "localhost",
|
|
||||||
"port": 19334,
|
|
||||||
"user": "testnet",
|
|
||||||
"password": "testnet1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"blockNotifyListener": {
|
|
||||||
"enabled": false,
|
|
||||||
"port": 8117,
|
|
||||||
"password": "test"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
var fs = require('fs');
|
|
||||||
|
|
||||||
var Stratum = require('../lib/index.js'); //require('stratum-pool')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var timeLog = function(text, poolName){
|
|
||||||
var desc = poolName ? '[' + poolName + '] ' : '';
|
|
||||||
var time = new Date().toISOString();
|
|
||||||
console.log(time + ': ' + desc + text);
|
|
||||||
};
|
|
||||||
|
|
||||||
var config = JSON.parse(fs.readFileSync("config.json"));
|
|
||||||
|
|
||||||
|
|
||||||
var stratum = new Stratum(config);
|
|
||||||
stratum.on('log', function(logText){
|
|
||||||
timeLog(logText);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fs.readdirSync('coins').forEach(function(file){
|
|
||||||
|
|
||||||
var coinOptions = JSON.parse(fs.readFileSync('coins/' + file, {encoding: 'utf8'}));
|
|
||||||
|
|
||||||
var authorizeFN = function (ip, workerName, password, callback) {
|
|
||||||
// Default implementation just returns true
|
|
||||||
timeLog(coinOptions.name, "Authorize ["+ip+"] "+workerName+":"+password);
|
|
||||||
callback({
|
|
||||||
error: null,
|
|
||||||
authorized: true,
|
|
||||||
disconnect: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var pool = stratum.createPool(coinOptions, authorizeFN);
|
|
||||||
pool.on('share', function(isValid, data){
|
|
||||||
if (isValid)
|
|
||||||
timeLog(coinOptions.name, "A new Valid share from " + data.client.workerName + " has arrived! - " + data.headerHex);
|
|
||||||
else
|
|
||||||
timeLog(coinOptions.name, "Invalid share form " + data.client.workerName + " ErrorCode: " + data.errorCode + " ErrorDescription: " + data.errorDescription);
|
|
||||||
}).on('log', function(logText){
|
|
||||||
timeLog(coinOptions.name, logText);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user