Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
533f0f346e | ||
|
|
f45984792e | ||
|
|
6768df06eb | ||
|
|
3f321bfe45 | ||
|
|
f663457e2a | ||
|
|
57982f88b1 | ||
|
|
96ee77913d | ||
|
|
9c4baf14ac | ||
|
|
1f35bb34c4 | ||
|
|
a5c3b3fa2c | ||
|
|
4f298c3ead |
@ -50,6 +50,8 @@ Features
|
|||||||
* ✓ __Quark__ (Quarkcoin [QRK])
|
* ✓ __Quark__ (Quarkcoin [QRK])
|
||||||
* ✓ __X11__ (Darkcoin [DRK], Hirocoin, Limecoin)
|
* ✓ __X11__ (Darkcoin [DRK], Hirocoin, Limecoin)
|
||||||
* ✓ __X13__ (MaruCoin, BoostCoin)
|
* ✓ __X13__ (MaruCoin, BoostCoin)
|
||||||
|
* ✓ __X16R__ (PexaCoin, RavenCoin)
|
||||||
|
* ✓ __X16RV2__ (PexaCoin, RavenCoin)
|
||||||
* ✓ __NIST5__ (Talkcoin)
|
* ✓ __NIST5__ (Talkcoin)
|
||||||
* ✓ __Keccak__ (Maxcoin [MAX], HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
|
* ✓ __Keccak__ (Maxcoin [MAX], HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
|
||||||
* ✓ __Skein__ (Skeincoin [SKC])
|
* ✓ __Skein__ (Skeincoin [SKC])
|
||||||
|
|||||||
@ -73,6 +73,7 @@ var algos = module.exports = global.algos = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
sha1: {
|
sha1: {
|
||||||
hash: function(){
|
hash: function(){
|
||||||
return function(){
|
return function(){
|
||||||
@ -108,6 +109,22 @@ var algos = module.exports = global.algos = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
x16r: {
|
||||||
|
multiplier: Math.pow(2, 8),
|
||||||
|
hash: function(){
|
||||||
|
return function(){
|
||||||
|
return multiHashing.x16r.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
x16rv2: {
|
||||||
|
multiplier: Math.pow(2, 8),
|
||||||
|
hash: function(){
|
||||||
|
return function(){
|
||||||
|
return multiHashing.x16rv2.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
nist5: {
|
nist5: {
|
||||||
hash: function(){
|
hash: function(){
|
||||||
return function(){
|
return function(){
|
||||||
@ -145,6 +162,14 @@ var algos = module.exports = global.algos = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
neoscrypt: {
|
||||||
|
multiplier: Math.pow(2, 5),
|
||||||
|
hash: function(){
|
||||||
|
return function(){
|
||||||
|
return multiHashing.neoscrypt.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
skein: {
|
skein: {
|
||||||
hash: function(){
|
hash: function(){
|
||||||
return function(){
|
return function(){
|
||||||
|
|||||||
@ -37,7 +37,7 @@ function DaemonInterface(daemons, logger){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isOnline(callback){
|
function isOnline(callback){
|
||||||
cmd('getnetworkinfo', [], function(results){
|
cmd('getpeerinfo', [], function(results){
|
||||||
var allOnline = results.every(function(result){
|
var allOnline = results.every(function(result){
|
||||||
return !results.error;
|
return !results.error;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -69,7 +69,6 @@ var JobManager = module.exports = function JobManager(options){
|
|||||||
var coinbaseHasher = (function(){
|
var coinbaseHasher = (function(){
|
||||||
switch(options.coin.algorithm){
|
switch(options.coin.algorithm){
|
||||||
case 'keccak':
|
case 'keccak':
|
||||||
case 'blake':
|
|
||||||
case 'fugue':
|
case 'fugue':
|
||||||
case 'groestl':
|
case 'groestl':
|
||||||
if (options.coin.normalHashing === true)
|
if (options.coin.normalHashing === true)
|
||||||
@ -90,12 +89,6 @@ var JobManager = module.exports = function JobManager(options){
|
|||||||
return util.reverseBuffer(hashDigest.apply(this, arguments));
|
return util.reverseBuffer(hashDigest.apply(this, arguments));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'scrypt-og':
|
|
||||||
if (options.coin.reward === 'POS') {
|
|
||||||
return function (d) {
|
|
||||||
return util.reverseBuffer(hashDigest.apply(this, arguments));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
case 'scrypt-jane':
|
case 'scrypt-jane':
|
||||||
if (options.coin.reward === 'POS') {
|
if (options.coin.reward === 'POS') {
|
||||||
return function (d) {
|
return function (d) {
|
||||||
@ -103,7 +96,6 @@ var JobManager = module.exports = function JobManager(options){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'scrypt-n':
|
case 'scrypt-n':
|
||||||
case 'sha1':
|
|
||||||
return function (d) {
|
return function (d) {
|
||||||
return util.reverseBuffer(util.sha256d(d));
|
return util.reverseBuffer(util.sha256d(d));
|
||||||
};
|
};
|
||||||
@ -236,8 +228,13 @@ var JobManager = module.exports = function JobManager(options){
|
|||||||
//Check if share is a block candidate (matched network difficulty)
|
//Check if share is a block candidate (matched network difficulty)
|
||||||
if (job.target.ge(headerBigNum)){
|
if (job.target.ge(headerBigNum)){
|
||||||
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
|
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
|
||||||
|
if (options.coin.algorithm === 'blake' || options.coin.algorithm === 'neoscrypt') {
|
||||||
|
blockHash = util.reverseBuffer(util.sha256d(headerBuffer, nTime)).toString('hex');
|
||||||
|
}
|
||||||
|
else {
|
||||||
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
|
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (options.emitInvalidBlockHashes)
|
if (options.emitInvalidBlockHashes)
|
||||||
blockHashInvalid = util.reverseBuffer(util.sha256d(headerBuffer)).toString('hex');
|
blockHashInvalid = util.reverseBuffer(util.sha256d(headerBuffer)).toString('hex');
|
||||||
|
|||||||
@ -188,6 +188,9 @@ var Peer = module.exports = function (options) {
|
|||||||
_this.emit('connected');
|
_this.emit('connected');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case commands.version.toString():
|
||||||
|
SendMessage(commands.verack, Buffer.alloc(0));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
23
lib/pool.js
23
lib/pool.js
@ -146,7 +146,8 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
var generateProgress = function(){
|
var generateProgress = function(){
|
||||||
|
|
||||||
_this.daemon.cmd('getblockchaininfo', [], function(results) {
|
var cmd = options.coin.hasGetInfo ? 'getinfo' : 'getblockchaininfo';
|
||||||
|
_this.daemon.cmd(cmd, [], function(results) {
|
||||||
var blockCount = results.sort(function (a, b) {
|
var blockCount = results.sort(function (a, b) {
|
||||||
return b.response.blocks - a.response.blocks;
|
return b.response.blocks - a.response.blocks;
|
||||||
})[0].response.blocks;
|
})[0].response.blocks;
|
||||||
@ -369,12 +370,15 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
var batchRpcCalls = [
|
var batchRpcCalls = [
|
||||||
['validateaddress', [options.address]],
|
['validateaddress', [options.address]],
|
||||||
['getdifficulty', []],
|
['getdifficulty', []],
|
||||||
['getblockchaininfo', []],
|
|
||||||
['getnetworkinfo', []],
|
|
||||||
['getmininginfo', []],
|
['getmininginfo', []],
|
||||||
['submitblock', []]
|
['submitblock', []]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (options.coin.hasGetInfo) {
|
||||||
|
batchRpcCalls.push(['getinfo', []]);
|
||||||
|
} else {
|
||||||
|
batchRpcCalls.push(['getblockchaininfo', []], ['getnetworkinfo', []]);
|
||||||
|
}
|
||||||
_this.daemon.batchCmd(batchRpcCalls, function(error, results){
|
_this.daemon.batchCmd(batchRpcCalls, function(error, results){
|
||||||
if (error || !results){
|
if (error || !results){
|
||||||
emitErrorLog('Could not start pool, error with init batch RPC call: ' + JSON.stringify(error));
|
emitErrorLog('Could not start pool, error with init batch RPC call: ' + JSON.stringify(error));
|
||||||
@ -423,13 +427,18 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
options.testnet = (rpcResults.getblockchaininfo.chain === 'test') ? true : false;
|
options.testnet = options.coin.hasGetInfo ? rpcResults.getinfo.testnet : (rpcResults.getblockchaininfo.chain === 'test') ? true : false;
|
||||||
|
|
||||||
options.protocolVersion = rpcResults.getnetworkinfo.protocolversion;
|
options.protocolVersion = options.coin.hasGetInfo ? rpcResults.getinfo.protocolversion : rpcResults.getnetworkinfo.protocolversion;
|
||||||
|
|
||||||
|
var difficulty = options.coin.hasGetInfo ? rpcResults.getinfo.difficulty : rpcResults.getblockchaininfo.difficulty;
|
||||||
|
if (typeof(difficulty) == 'object') {
|
||||||
|
difficulty = difficulty['proof-of-work'];
|
||||||
|
}
|
||||||
|
|
||||||
options.initStats = {
|
options.initStats = {
|
||||||
connections: rpcResults.getnetworkinfo.connections,
|
connections: (options.coin.hasGetInfo ? rpcResults.getinfo.connections : rpcResults.getnetworkinfo.connections),
|
||||||
difficulty: rpcResults.getblockchaininfo.difficulty * algos[options.coin.algorithm].multiplier,
|
difficulty: difficulty * algos[options.coin.algorithm].multiplier,
|
||||||
networkHashRate: rpcResults.getmininginfo.networkhashps
|
networkHashRate: rpcResults.getmininginfo.networkhashps
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -245,7 +245,7 @@ exports.CreateGeneration = function(rpcData, publicKey, extraNoncePlaceholder, r
|
|||||||
|
|
||||||
var scriptSigPart1 = Buffer.concat([
|
var scriptSigPart1 = Buffer.concat([
|
||||||
util.serializeNumber(rpcData.height),
|
util.serializeNumber(rpcData.height),
|
||||||
new Buffer(rpcData.coinbaseaux.flags, 'hex'),
|
new Buffer([]),
|
||||||
util.serializeNumber(Date.now() / 1000 | 0),
|
util.serializeNumber(Date.now() / 1000 | 0),
|
||||||
new Buffer([extraNoncePlaceholder.length])
|
new Buffer([extraNoncePlaceholder.length])
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
"litecoin",
|
"litecoin",
|
||||||
"scrypt"
|
"scrypt"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/zone117x/node-stratum-pool",
|
"homepage": "https://github.com/ranchimall/node-stratum-pool",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/zone117x/node-stratum-pool/issues"
|
"url": "https://github.com/ranchimall/node-stratum-pool/issues"
|
||||||
},
|
},
|
||||||
"license": "GPL-2.0",
|
"license": "GPL-2.0",
|
||||||
"author": "Matthew Little",
|
"author": "Matthew Little",
|
||||||
@ -25,11 +25,11 @@
|
|||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zone117x/node-stratum-pool.git"
|
"url": "https://github.com/ranchimall/node-stratum-pool.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"multi-hashing": "git://github.com/zone117x/node-multi-hashing.git",
|
"multi-hashing": "git://github.com/zone117x/node-multi-hashing.git",
|
||||||
"bignum": "*",
|
"bignum": "0.12.1",
|
||||||
"base58-native": "*",
|
"base58-native": "*",
|
||||||
"async": "*"
|
"async": "*"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user