Browse Source

DERO Atlantis pool

master
Captain 2 years ago
parent
commit
f775d1d83e
7 changed files with 504 additions and 290 deletions
  1. +0
    -0
      cert.pem
  2. +430
    -221
      config_dero.json
  3. +0
    -0
      key.pem
  4. +5
    -4
      lib/blockUnlocker.js
  5. +62
    -59
      lib/pool.js
  6. +1
    -0
      package.json
  7. +6
    -6
      website/config.js

+ 0
- 0
cert.pem View File


config_sumokoin.json → config_dero.json View File

@@ -1,221 +1,430 @@
{
"coin": "Sumokoin",
"symbol": "SUMO",
"coinUnits": 1000000000,
"coinDifficultyTarget": 240,
"logging": {
"files": {
"level": "info",
"directory": "logs",
"flushInterval": 5
},
"console": {
"level": "debug",
"colors": true
}
},
"poolServer": {
"enabled": true,
"clusterForks": "auto",
"poolAddress": "Sumoo64zh7dRFyB8dgDWZMLmzKBgGXYWZCG4NBF2VcvzEuiSQpMjyyiYJ1Ra696pZu56PPFQNBDdB1rZjyeX1RVKeWZgHg7pTxj",
"blockRefreshInterval": 1000,
"minerTimeout": 900,
"sslKey": "key.pem",
"sslCert": "cert.pem",
"allowedMinerAddressPrefixes": [
"2864026", "536986"
],
"ports": [
{
"port": 3333,
"difficulty": 2000,
"desc": "Low end hardware"
},
{
"port": 3334,
"difficulty": 2000,
"desc": "Low end hardware (SSL protected)",
"type": "SSL"
},
{
"port": 4444,
"difficulty": 10000,
"desc": "Mid range hardware"
},
{
"port": 4445,
"difficulty": 10000,
"desc": "Mid range hardware (SSL protected)",
"type": "SSL"
},
{
"port": 5555,
"difficulty": 20000,
"desc": "High end hardware"
},
{
"port": 5556,
"difficulty": 20000,
"desc": "High end hardware (SSL protected)",
"type": "SSL"
},
{
"port": 6666,
"difficulty": 30000,
"desc": "Hidden port",
"hidden": true
},
{
"port": 6667,
"difficulty": 30000,
"desc": "Hidden port (SSL protected)",
"hidden": true,
"type": "SSL"
}
],
"varDiff": {
"minDiff": 2000,
"maxDiff": 100000,
"targetTime": 100,
"retargetTime": 30,
"variancePercent": 30,
"maxJump": 100
},
"fixedDiff": {
"enabled": true,
"addressSeparator": "."
},
"shareTrust": {
"enabled": true,
"min": 10,
"stepDown": 3,
"threshold": 10,
"penalty": 30
},
"banning": {
"enabled": true,
"time": 600,
"invalidPercent": 25,
"checkThreshold": 30
}
},
"payments": {
"enabled": true,
"interval": 10800,
"maxAddresses": 30,
"mixin": 12,
"transferFee": 10000000,
"minPayment": 2000000000,
"maxTransactionAmount": 500000000000,
"denomination": 10000000,
"useDynamicTransferFee": true,
"transferFeePerPayee": 4000000,
"minerPayFee": true,
"blockReward": 36.45
},
"blockUnlocker": {
"enabled": true,
"interval": 30,
"depth": 60,
"poolFee": 1.4,
"devDonation": 0,
"coreDevDonation": 0.1,
"extraFeaturesDevDonation":0
},
"api": {
"enabled": true,
"hashrateWindow": 600,
"updateInterval": 20,
"port": 8118,
"blocks": 30,
"payments": 30,
"password": "your_password",
"trust_proxy_ip": false
},
"daemon": {
"host": "127.0.0.1",
"port": 19734
},
"wallet": {
"host": "127.0.0.1",
"port": 19735
},
"redis": {
"host": "127.0.0.1",
"port": 6379
},
"email": {
"enabled": false,
"api_key": "",
"api_domain": "mg.yourdomain",
"from_address": "",
"template_dir": "email_templates",
"domain": "pool.domain.here"
},
"monitoring": {
"daemon": {
"checkInterval": 60,
"rpcMethod": "getblockcount"
},
"wallet": {
"checkInterval": 60,
"rpcMethod": "getbalance"
}
},
"charts": {
"pool": {
"hashrate": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"workers": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"difficulty": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"price": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"profit": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
}
},
"user": {
"hashrate": {
"enabled": true,
"updateInterval": 180,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"payments": {
"enabled": true
}
}
}
}
{

"coin": "Dero",

"symbol": "DERO",

"coinUnits": 1000000000000,

"coinDifficultyTarget": 12,



"logging": {

"files": {

"level": "debug",

"directory": "logs",

"flushInterval": 5

},

"console": {

"level": "debug",

"colors": true

}

},



"poolServer": {

"enabled": true,

"clusterForks": 6,

"poolAddress": "dEToVK8GFSj4TTjKQLP5s9RfzraukCeD8188RY7XcCUQCaNYYZ24FuZF3VWFcZgnrP6Lr7Su8bd5qJ4V3y5kyuFt5RWpXt66ge",

"blockRefreshInterval": 1000,

"minerTimeout": 900,

"sslKey": "key.pem",

"sslCert": "cert.pem",

"allowedMinerAddressPrefixes": [

"823000",

"446296"

],

"ports": [

{

"port": 3333,

"difficulty": 800,

"desc": "Low end hardware"

},

{

"port": 3334,

"difficulty": 2000,

"desc": "Low end hardware (SSL protected)",

"type": "SSL"

},

{

"port": 4444,

"difficulty": 10000,

"desc": "Mid range hardware"

},

{

"port": 4445,

"difficulty": 10000,

"desc": "Mid range hardware (SSL protected)",

"type": "SSL"

},

{

"port": 5555,

"difficulty": 50000,

"desc": "High end hardware"

},

{
"port": 7777,
"difficulty": 80000,
"desc": "High end hardware"
},

{
"port": 7788,
"difficulty": 950000,
"desc": " Very High end hardware"
},

{

"port": 5556,

"difficulty": 50000,

"desc": "High end hardware (SSL protected)",

"type": "SSL"

}

],

"varDiff": {

"minDiff": 3400,

"maxDiff": 950000,

"targetTime": 3,

"retargetTime": 3,

"variancePercent": 20,

"maxJump": 50000

},

"fixedDiff": {

"enabled": true,

"addressSeparator": "."

},

"shareTrust": {

"enabled": true,

"min": 10,

"stepDown": 3,

"threshold": 10,

"penalty": 30

},

"banning": {

"enabled": true,

"time": 320,

"invalidPercent": 35,

"checkThreshold": 40

}

},



"payments": {

"enabled": false,

"interval": 3000,

"maxAddresses": 6,

"mixin": 7,

"transferFee": 79812400000,

"minPayment": 2000000000000,

"maxTransactionAmount": 50000000000000,

"denomination": 100000000000,

"useDynamicTransferFee": false,

"transferFeePerPayee": 0,

"minerPayFee": false,

"blockReward": 30

},



"blockUnlocker": {

"enabled": true,

"interval": 30,

"depth": 60,

"poolFee": 0.5,

"devDonation": 0,

"coreDevDonation": 0,

"extraFeaturesDevDonation":0

},



"api": {

"enabled": true,

"hashrateWindow": 200,



"updateInterval": 2,

"port": 8824,

"blocks": 30,

"payments": 30,

"password": "Hello123",

"trust_proxy_ip": false

},



"daemon": {

"host": "127.0.0.1",
"port": 30306

},



"wallet": {

"host": "127.0.0.1",

"port": 30309

},



"redis": {

"host": "127.0.0.1",

"port": 6379

},



"email": {

"enabled": false,

"api_key": "",

"api_domain": "mg.yourdomain",

"from_address": "",

"template_dir": "email_templates",

"domain": "pool.domain.here"

},



"monitoring": {

"daemon": {

"checkInterval": 60,

"rpcMethod": "getblockcount"

},

"wallet": {

"checkInterval": 60,

"rpcMethod": "getbalance"

}

},



"charts": {

"pool": {

"hashrate": {

"enabled": true,

"updateInterval": 60,

"stepInterval": 60,

"maximumPeriod": 3600

},

"workers": {

"enabled": true,

"updateInterval": 300,

"stepInterval": 1800,

"maximumPeriod": 36000

},

"difficulty": {

"enabled": true,

"updateInterval": 60,

"stepInterval": 60,

"maximumPeriod": 3600

},

"price": {

"enabled": false,

"updateInterval": 1800,

"stepInterval": 10800,

"maximumPeriod": 36000

},

"profit": {

"enabled": false,

"updateInterval": 300,

"stepInterval": 60,

"maximumPeriod": 3600

}

},

"user": {

"hashrate": {

"enabled": true,

"updateInterval": 180,

"stepInterval": 800,

"maximumPeriod": 36000

},

"payments": {

"enabled": true

}

}

}

}

+ 0
- 0
key.pem View File


+ 5
- 4
lib/blockUnlocker.js View File

@@ -45,21 +45,22 @@ function runInterval(){
//Check if blocks are orphaned
function(blocks, callback){
async.filter(blocks, function(block, mapCback){
apiInterfaces.rpcDaemon('getblockheaderbyheight', {height: block.height}, function(error, result){
apiInterfaces.rpcDaemon('getblockheaderbyhash', {hash: block.hash}, function(error, result){
if (error){
log('error', logSystem, 'Error with getblockheaderbyheight RPC request for block %s - %j', [block.serialized, error]);
log('error', logSystem, 'Error with getblockheaderbyhash RPC request for block %s - %j', [block.serialized, error]);
block.unlocked = false;
mapCback();
return;
}
if (!result.block_header){
log('error', logSystem, 'Error with getblockheaderbyheight, no details returned for %s - %j', [block.serialized, result]);
log('error', logSystem, 'Error with getblockheaderbyhash, no details returned for %s - %j', [block.serialized, result]);
block.unlocked = false;
mapCback();
return;
}
var blockHeader = result.block_header;
block.orphaned = blockHeader.hash === block.hash ? 0 : 1;
//block.orphaned = blockHeader.topoheight > 1 ? 0 : 1;
block.orphaned = blockHeader.orphan_status;
block.unlocked = blockHeader.depth >= config.blockUnlocker.depth;
block.reward = blockHeader.reward;
mapCback(block.unlocked);


+ 62
- 59
lib/pool.js View File

@@ -13,6 +13,9 @@ var noncePattern = new RegExp("^[0-9a-f]{8}$");
//SSL for claymore
var tls = require('tls');

// keccak to calculate blockid
var keccak256 = require('js-sha3').keccak256;

var threadId = '(Thread ' + process.env.forkId + ') ';

var logSystem = 'pool';
@@ -116,19 +119,26 @@ function IsBannedIp(ip){

function BlockTemplate(template){
this.blob = template.blocktemplate_blob;
this.blockhashingblob = template.blockhashing_blob;
this.prev_hash = template.prev_hash
this.difficulty = template.difficulty;
this.height = template.height;
this.reserveOffset = template.reserved_offset;
this.buffer = new Buffer(this.blob, 'hex');
instanceId.copy(this.buffer, this.reserveOffset + 4, 0, 3);
this.previous_hash = new Buffer(32);
this.buffer.copy(this.previous_hash,0,7,39);
this.epoch = template.epoch;
this.reserveOffset =template.reserved_offset; //in the getwork


this.hashingbuffer = new Buffer(this.blockhashingblob, 'hex');
instanceId.copy(this.hashingbuffer, this.reserveOffset + 4, 0, 3);
// instanceId.copy(this.buffer, this.reserveOffset + 4, 0, 3);
// this.previous_hash = new Buffer(32);
// this.buffer.copy(this.previous_hash,0,7,39);
this.extraNonce = 0;
}
BlockTemplate.prototype = {
nextBlob: function(){
this.buffer.writeUInt32BE(++this.extraNonce, this.reserveOffset);
return cnUtil.convert_blob(this.buffer).toString('hex');
this.hashingbuffer.writeUInt32BE(++this.extraNonce, this.reserveOffset);
return this.hashingbuffer.toString('hex');
}
};

@@ -139,7 +149,7 @@ function getBlockTemplate(callback){
}

function getBlockCount(callback){
apiInterfaces.rpcDaemon('getblockcount', null, callback);
apiInterfaces.rpcDaemon('getheight', null, callback);
}

function getBlockHash(callback){
@@ -174,43 +184,9 @@ function jobRefresh(state){
break;

case "check_count":
getBlockCount(function(error, result){
if (error){
jobRefreshError('Error polling getblockcount %j', error);
return;
}

if(result.count == currentBlockHeight) {
jobRefresh("check_hash");
return;
}

log('info', logSystem, 'Blockchain height changed to %d, updating template.', [currentBlockHeight]);
jobRefresh("get_template");
return;
});
break;

case "check_hash":
getBlockHash(function(error, result){
if(error) {
jobRefreshError('Error polling on_getblockhash %j', error);
return;
}

if(result == currentBlockHash) {
if(jobRefreshCompleteCallback != null)
jobRefreshCompleteCallback(true);
return;
}

log('info', logSystem, 'Blockchain hash changed to %s, updating template.', currentBlockHash);
jobRefresh("get_template");
return;
});
break;

case "get_template":
jobRefreshCounter=0;
getBlockTemplate(function(error, result){
if(error) {
jobRefreshError('Error polling getblocktemplate %j', error);
@@ -223,9 +199,11 @@ function jobRefresh(state){
var buffer = new Buffer(result.blocktemplate_blob, 'hex');
var previous_hash = new Buffer(32);
buffer.copy(previous_hash,0,7,39);
if (!currentBlockTemplate || previous_hash.toString('hex') != currentBlockTemplate.previous_hash.toString('hex')){
if (!currentBlockTemplate || result.prev_hash != currentBlockTemplate.prev_hash){
log('info', logSystem, 'New block to mine at height %d w/ difficulty of %d', [result.height, result.difficulty]);
processBlockTemplate(result);
} else if ( (result.epoch - currentBlockTemplate.epoch) >= 3 ){ // refresh job every 5 secs
processBlockTemplate(result);
}

if(jobRefreshCompleteCallback != null)
@@ -372,24 +350,28 @@ Miner.prototype = {
return hex;
},
getJob: function(){
if (this.lastBlockHeight === currentBlockTemplate.height && !this.pendingDifficulty) {
if (this.prev_hash === currentBlockTemplate.prev_hash && this.epoch === currentBlockTemplate.epoch && !this.pendingDifficulty) {

return {
blob: '',
job_id: '',
target: ''
};
}
var blob = currentBlockTemplate.nextBlob();
this.lastBlockHeight = currentBlockTemplate.height;
this.prev_hash = currentBlockTemplate.prev_hash;
var target = this.getTargetHex();

var newJob = {
id: utils.uid(),
extraNonce: currentBlockTemplate.extraNonce,
height: currentBlockTemplate.height,
epoch: currentBlockTemplate.epoch,
difficulty: this.difficulty,
diffHex: this.diffHex,
prev_hash: this.prev_hash,
submissions: []
};

@@ -398,6 +380,7 @@ Miner.prototype = {
if (this.validJobs.length > 4)
this.validJobs.shift();


return {
blob: blob,
job_id: newJob.id,
@@ -487,10 +470,24 @@ function recordShareData(miner, job, shareDiff, blockCandidate, hashHex, shareTy
}

function processShare(miner, job, blockTemplate, nonce, resultHash){
var template = new Buffer(blockTemplate.buffer.length);
blockTemplate.buffer.copy(template);
template.writeUInt32BE(job.extraNonce, blockTemplate.reserveOffset);
var shareBuffer = cnUtil.construct_block_blob(template, new Buffer(nonce, 'hex'));
var template = new Buffer(blockTemplate.hashingbuffer.length);
blockTemplate.hashingbuffer.copy(template);


// instanceId.copy(template, blockTemplate.reserveOffset + 4, 0, 3);
// console.log(template.toString('hex'));
// template.writeUInt32BE(job.extraNonce, blockTemplate.reserveOffset);

//instanceId.copy(template, blockTemplate.reserveOffset + 4, 0, 3); // copy instance ID
template.writeUInt32BE(job.extraNonce, blockTemplate.reserveOffset); // set extra nonce


nonce_buf = new Buffer(nonce, 'hex');
nonce_buf.copy(template, 39 , 0, 4);

//var shareBuffer = cnUtil.construct_block_blob(template, new Buffer(nonce, 'hex'));
shareBuffer = template


var convertedBlob;
var hash;
@@ -501,11 +498,12 @@ function processShare(miner, job, blockTemplate, nonce, resultHash){
shareType = 'trusted';
}
else {
convertedBlob = cnUtil.convert_blob(shareBuffer);
hash = cryptoNight(convertedBlob);
//convertedBlob = cnUtil.convert_blob(shareBuffer);
hash = cryptoNight(shareBuffer);
shareType = 'valid';
}


if (hash.toString('hex') !== resultHash) {
log('warn', logSystem, 'Bad hash from miner %s@%s', [miner.login, miner.ip]);
@@ -520,18 +518,23 @@ function processShare(miner, job, blockTemplate, nonce, resultHash){

if (hashDiff.ge(blockTemplate.difficulty)){

apiInterfaces.rpcDaemon('submitblock', [shareBuffer.toString('hex')], function(error, result){
if (error){
apiInterfaces.rpcDaemon('submitblock', [blockTemplate.blob, shareBuffer.toString('hex')], function(error, result){
if (error || result.status!=="OK"){

log('error', logSystem, 'Error submitting block at height %d from %s@%s, share type: "%s" - %j', [job.height, miner.login, miner.ip, shareType, error]);
recordShareData(miner, job, hashDiff.toString(), false, null, shareType);
}
else{
var blockFastHash = cnUtil.get_block_id(shareBuffer).toString('hex');
//var blockFastHash = cnUtil.get_block_id(shareBuffer).toString('hex');
var blockFastHash = keccak256(shareBuffer).toString('hex');
log('info', logSystem,
'Block %s found at height %d by miner %s@%s - submit result: %j',
[blockFastHash.substr(0, 6), job.height, miner.login, miner.ip, result]
// [blockFastHash.substr(0, 6), job.height, miner.login, miner.ip, result]
[result.blid, job.height, miner.login, miner.ip, result]
);
recordShareData(miner, job, hashDiff.toString(), true, blockFastHash, shareType, blockTemplate);
recordShareData(miner, job, hashDiff.toString(), true, result.blid, shareType, blockTemplate);
jobRefresh("get_template");
}
});
@@ -652,8 +655,8 @@ function handleMinerMethod(method, params, ip, portData, sendReply, pushMessage)

job.submissions.push(params.nonce);

var blockTemplate = currentBlockTemplate.height === job.height ? currentBlockTemplate : validBlockTemplates.filter(function(t){
return t.height === job.height;
var blockTemplate = currentBlockTemplate.epoch === job.epoch ? currentBlockTemplate : validBlockTemplates.filter(function(t){
return t.epoch === job.epoch;
})[0];

if (!blockTemplate){


+ 1
- 0
package.json View File

@@ -15,6 +15,7 @@
"dateformat": "*",
"base58-native": "*",
"mailgun.js": "*",
"js-sha3": "*",
"multi-hashing": "git://github.com/clintar/node-multi-hashing.git#Nan-2.0",
"cryptonote-util": "git://github.com/M5M400/node-cryptonote-util.git#xmr-Nan-2.0"
},


+ 6
- 6
website/config.js View File

@@ -1,17 +1,17 @@
var api = "https://pool.sumokoin.ch:8888";
var api = "https://89.38.97.110:8124";

var poolHost = "pool.sumokoin.ch";
var poolHost = "89.38.97.110";

var irc = "irc.freenode.net/#sumokoin";
var irc = "irc.freenode.net/#dero";

var email = "support@sumokoin.ch";
var email = "support@dero";

var cryptonatorWidget = ["{symbol}-BTC", "{symbol}-USD", "{symbol}-EUR"];

var easyminerDownload = "https://github.com/zone117x/cryptonote-easy-miner/releases/";

var blockchainExplorer = "http://explorer.sumokoin.com/block/{id}";
var blockchainExplorer = "http://212.8.242.60/block/{id}";

var transactionExplorer = "http://explorer.sumokoin.com/tx/{id}";
var transactionExplorer = "http://212.8.242.60/tx/{id}";

var themeCss = "themes/default-theme.css";

Loading…
Cancel
Save