Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ var myCoin = {
"nValue": 1024, //optional - defaults to 1024
"rValue": 1, //optional - defaults to 1
"txMessages": false, //optional - defaults to false,
"coinbase": "MyFunPool", // So explorers can see who mined the block

/* Magic value only required for setting up p2p block notifications. It is found in the daemon
source code as the pchMessageStart variable.
Expand Down
31 changes: 31 additions & 0 deletions lib/algoProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ var algos = module.exports = global.algos = {
}
}
},
allium: {
multiplier: Math.pow(2, 8),
hash: function(){
return function(){
return multiHashing.allium.apply(this, arguments);
}
}
},
blake: {
multiplier: Math.pow(2, 8),
hash: function(){
Expand Down Expand Up @@ -184,12 +192,35 @@ var algos = module.exports = global.algos = {
}
}
},
lyra2: {
multiplier: Math.pow(2, 8),
hash: function(){
return function(){
return multiHashing.lyra2re.apply(this, arguments);
}
}
},
lyra2v2: {
multiplier: Math.pow(2, 8),
hash: function(){
return function(){
return multiHashing.lyra2rev2.apply(this, arguments);
}
}
},
qubit: {
hash: function(){
return function(){
return multiHashing.qubit.apply(this, arguments);
}
}
},
cryptonight_turtle: {
hash: function(){
return function(){
return multiHashing.cryptonightturtle.apply(this, arguments);
}
}
}
};

Expand Down
5 changes: 3 additions & 2 deletions lib/blockTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var util = require('./util.js');
* The BlockTemplate class holds a single job.
* and provides several methods to validate and submit it to the daemon coin
**/
var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, poolAddressScript, extraNoncePlaceholder, reward, txMessages, recipients){
var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, poolAddressScript, extraNoncePlaceholder, reward, txMessages, recipients, coinbase){

//private members

Expand Down Expand Up @@ -71,7 +71,8 @@ var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, pool
extraNoncePlaceholder,
reward,
txMessages,
recipients
recipients,
coinbase
);

this.serializeCoinbase = function(extraNonce1, extraNonce2){
Expand Down
10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ exports.varDiff = require('./varDiff.js');


exports.createPool = function(poolOptions, authorizeFn){

if(poolOptions.OLD === true)
{
pool = require('./pool_O.js');
}
else
{
pool = require('./pool_N.js');
}

var newPool = new pool(poolOptions, authorizeFn);
return newPool;
};
22 changes: 19 additions & 3 deletions lib/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ var JobManager = module.exports = function JobManager(options){
_this.extraNoncePlaceholder,
options.coin.reward,
options.coin.txMessages,
options.recipients
options.recipients,
options.coin.coinbase
);

_this.currentJob = tmpBlockTemplate;
Expand Down Expand Up @@ -162,7 +163,8 @@ var JobManager = module.exports = function JobManager(options){
_this.extraNoncePlaceholder,
options.coin.reward,
options.coin.txMessages,
options.recipients
options.recipients,
options.coin.coinbase
);

this.currentJob = tmpBlockTemplate;
Expand Down Expand Up @@ -268,7 +270,21 @@ var JobManager = module.exports = function JobManager(options){
//Check if share is a block candidate (matched network difficulty)
if (job.target.ge(headerBigNum)){
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
if (options.coin.algorithm === 'blake'
|| options.coin.algorithm === 'neoscrypt'
|| options.coin.algorithm === 'lyra2'
|| options.coin.algorithm === 'allium'
|| options.coin.algorithm === 'lyra2v2'
|| options.coin.algorithm === 'qubit'
) {
blockHash = util.reverseBuffer(util.sha256d(headerBuffer, nTime)).toString('hex');
} else if(options.coin.algorithm === 'x11'){
blockHash = util.reverseBuffer(hashDigest(headerBuffer, nTime)).toString('hex');
}
else {
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
}
//blockHash = blockHasher(headerBuffer, nTime).toString('hex');
/*console.log("processShare - Block Candidate", {
"blockHex": blockHex,
"blockHash": blockHash
Expand Down
Loading