inital upload

This commit is contained in:
Matthew Little 2014-01-13 18:32:54 -07:00
parent 73c936f7a6
commit 6e72e9392a
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,9 @@
* git clone https://github.com/zone117x/node-stratum-portal.git
* npm install stratum-pool
* node init.js
For Development of stratum-pool
===============================
* symlink node_modules/stratum-pool to development directory

View File

@ -0,0 +1,16 @@
{
"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"
}
}

7
config.json Normal file
View File

@ -0,0 +1,7 @@
{
"blockNotifyListener": {
"enabled": false,
"port": 8117,
"password": "test"
}
}

48
init.js Normal file
View File

@ -0,0 +1,48 @@
var fs = require('fs');
var Stratum = 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);
});
});