From 5624ddcd7449873ef6f9f3f5c62ad500e82694b5 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 Apr 2014 09:41:13 -0600 Subject: [PATCH 1/9] Fixed incorrect link for coin config in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 841ea7f..ee91f6e 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ Here is an example of the required fields: ```` For additional documentation how to configure coins *(especially important for scrypt-n and scrypt-jane coins)* -see [these instructions](https://github.com/zone117x/node-stratum-pool/edit/master/README.md#module-usage). +see [these instructions](//github.com/zone117x/node-stratum-pool#module-usage). ##### Pool config From 8ca0253eb6cf53a116357f4bd1a11a91d8ee9283 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 Apr 2014 09:43:18 -0600 Subject: [PATCH 2/9] Clarified that payment processing is completed and working in readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ee91f6e..df4369a 100644 --- a/README.md +++ b/README.md @@ -204,16 +204,16 @@ Description of options: /* (2% default) What percent fee your pool takes from the block reward. */ "feePercent": 0.02, - /* Name of the account to use when moving coin profit within daemon wallet. */ + /* Name of the daemon account to use when moving coin profit within daemon wallet. */ "feeCollectAccount": "feesCollected", /* Your address that receives pool revenue from fees. */ "feeReceiveAddress": "LZz44iyF4zLCXJTU8RxztyyJZBntdS6fvv", - /* (Not implemented yet) How many coins from fee revenue must accumulate on top of the + /* How many coins from fee revenue must accumulate on top of the minimum reserve amount in order to trigger withdrawal to fee address. The higher this threshold, the less of your profit goes to transactions fees. */ - //"feeWithdrawalThreshold": 5, + "feeWithdrawalThreshold": 5, /* This daemon is used to send out payments. It MUST be for the daemon that owns the configured 'address' that receives the block rewards, otherwise the daemon will not From 9938681fbc71f87a8831369f94543eeec9a769dc Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 Apr 2014 10:10:01 -0600 Subject: [PATCH 3/9] Added jobRebroadcastTimeout configuration --- README.md | 4 ++++ pool_configs/bitcoin_example.json | 1 + pool_configs/darkcoin_example.json | 1 + pool_configs/execoin_example.json | 1 + pool_configs/galleon_example.json | 1 + pool_configs/helixcoin_example.json | 1 + pool_configs/hirocoin_example.json | 1 + pool_configs/hobonickels_example.json | 1 + pool_configs/litecoin_example.json | 1 + pool_configs/maxcoin_example.json | 3 ++- pool_configs/ultracoin_example.json | 1 + pool_configs/vertcoin_example.json | 1 + 12 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df4369a..66f9f49 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,10 @@ Description of options: job broadcast. */ "txRefreshInterval": 20000, + /* Some miner software is bugged and will consider the pool offline if it doesn't receive + anything for around a minute, so every time we broadcast jobs, set a timeout to rebroadcast + in this many seconds unless we find a new job. Set to zero or remove to disable this. */ + "jobRebroadcastTimeout": 55, //instanceId: 37, //Recommend not using this because a crypto-random one will be generated diff --git a/pool_configs/bitcoin_example.json b/pool_configs/bitcoin_example.json index c6cd29b..a18e6bf 100644 --- a/pool_configs/bitcoin_example.json +++ b/pool_configs/bitcoin_example.json @@ -38,6 +38,7 @@ "address": "mtCiLWzBy9EpuxzkLwizPYiPFDy69HTd4b", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/darkcoin_example.json b/pool_configs/darkcoin_example.json index 3ad716e..291cd46 100644 --- a/pool_configs/darkcoin_example.json +++ b/pool_configs/darkcoin_example.json @@ -38,6 +38,7 @@ "address": "XfkoYutJ8KYtLxZ4TgnMqC6SCmxuc3LEDY", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/execoin_example.json b/pool_configs/execoin_example.json index afc7b20..6625326 100644 --- a/pool_configs/execoin_example.json +++ b/pool_configs/execoin_example.json @@ -38,6 +38,7 @@ "address": "EabPhjVKcmus3LKFViAcwq3dfo8kzqpMkQ", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, diff --git a/pool_configs/galleon_example.json b/pool_configs/galleon_example.json index d257684..32e3a41 100644 --- a/pool_configs/galleon_example.json +++ b/pool_configs/galleon_example.json @@ -5,6 +5,7 @@ "address": "GRAiuGCWLrL8Psdr6pkhLpxrQGHdYfrSEz", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "shareProcessing": { diff --git a/pool_configs/helixcoin_example.json b/pool_configs/helixcoin_example.json index 3608317..9949a88 100644 --- a/pool_configs/helixcoin_example.json +++ b/pool_configs/helixcoin_example.json @@ -29,6 +29,7 @@ "address": "H9xyrh45LzLX4uXCP6jG6ZGrWho8srUgiG", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, diff --git a/pool_configs/hirocoin_example.json b/pool_configs/hirocoin_example.json index 68bca63..d0b27f7 100644 --- a/pool_configs/hirocoin_example.json +++ b/pool_configs/hirocoin_example.json @@ -39,6 +39,7 @@ "address": "HR6WNSR19kvaXSbwKymrba6uNx36BBjinS", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/hobonickels_example.json b/pool_configs/hobonickels_example.json index 438bae6..275ad3f 100644 --- a/pool_configs/hobonickels_example.json +++ b/pool_configs/hobonickels_example.json @@ -38,6 +38,7 @@ "address": "EzGiarU2S56jyRkYpS7FKssXCS6AAJChdU", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/litecoin_example.json b/pool_configs/litecoin_example.json index acd9856..223b33c 100644 --- a/pool_configs/litecoin_example.json +++ b/pool_configs/litecoin_example.json @@ -39,6 +39,7 @@ "address": "n4jSe18kZMCdGcZqaYprShXW6EH1wivUK1", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/maxcoin_example.json b/pool_configs/maxcoin_example.json index a5a852c..7907165 100644 --- a/pool_configs/maxcoin_example.json +++ b/pool_configs/maxcoin_example.json @@ -5,6 +5,7 @@ "address": "tKWkadAkT2vqK6v2PHLJmV1RTVvF7XZEgN", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "shareProcessing": { @@ -33,7 +34,7 @@ "ports": { "5547": { - "diff": 2 + "diff": 6 } }, diff --git a/pool_configs/ultracoin_example.json b/pool_configs/ultracoin_example.json index 7b8ffa7..cd6158d 100644 --- a/pool_configs/ultracoin_example.json +++ b/pool_configs/ultracoin_example.json @@ -38,6 +38,7 @@ "address": "UhyKVr4m516TPsrLwm91pYL4f99VGrJ1oC", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, "banning": { diff --git a/pool_configs/vertcoin_example.json b/pool_configs/vertcoin_example.json index 2f053ff..1cf3685 100644 --- a/pool_configs/vertcoin_example.json +++ b/pool_configs/vertcoin_example.json @@ -38,6 +38,7 @@ "address": "VrcunuCcNUULMBoiw66v9SAdQq2m1FpP3C", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, + "jobRebroadcastTimeout": 55, "connectionTimeout": 600, From dafb0a7a55b522ec7a1d456639651654fa904664 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 Apr 2014 16:39:27 -0600 Subject: [PATCH 4/9] Added check for dropkicked (self orphaned) blocks that have the same txHash --- libs/paymentProcessor.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libs/paymentProcessor.js b/libs/paymentProcessor.js index d01271b..a9edd14 100644 --- a/libs/paymentProcessor.js +++ b/libs/paymentProcessor.js @@ -123,9 +123,6 @@ function SetupForPool(logger, poolOptions, setupFinished){ - - - /* Number.toFixed gives us the decimal places we want, but as a string. parseFloat turns it back into number we don't care about trailing zeros in this case. */ var toPrecision = function(value, precision){ @@ -194,14 +191,14 @@ function SetupForPool(logger, poolOptions, setupFinished){ txDetails.forEach(function(tx, i){ var round = rounds[i]; - if (tx.error && tx.error.code === -5){ + if (tx.error && tx.error.code === -5 || round.solution !== tx.result.blockhash){ /* Block was dropped from coin daemon even after it happily accepted it earlier. */ //If we find another block at the same height then this block was drop-kicked orphaned - var dropKicked = !!rounds.filter(function(r){ + var dropKicked = rounds.filter(function(r){ return r.height === round.height && r.solution !== round.solution && r.category !== 'dropkicked'; - }).length; + }).length > 0; if (dropKicked){ logger.warning(logSystem, logComponent, @@ -536,8 +533,10 @@ function SetupForPool(logger, poolOptions, setupFinished){ finalizeRedisTx(); var totalWorkers = Object.keys(workerPayments).length; - logger.debug(logSystem, logComponent, 'Payments sent, a total of ' + totalAmountUnits + ' ' + poolOptions.coin.symbol + - ' was sent to ' + totalWorkers + ' miners'); + + logger.debug(logSystem, logComponent, 'Payments sent, a total of ' + totalAmountUnits + + ' ' + poolOptions.coin.symbol + ' was sent to ' + totalWorkers + ' miners'); + daemon.cmd('gettransaction', [results[0].response], function(results){ if (results[0].error){ callback('Check finished - error with gettransaction ' + JSON.stringify(results[0].error)); @@ -595,11 +594,12 @@ function SetupForPool(logger, poolOptions, setupFinished){ daemon.cmd('sendmany', [processingConfig.feeCollectAccount, withdrawal], function(results){ if (results[0].error){ - logger.debug(logSystem, logComponent, 'Profit withdrawal finished - error with sendmany ' + JSON.stringify(results[0].error)); + logger.debug(logSystem, logComponent, 'Profit withdrawal finished - error with sendmany ' + + JSON.stringify(results[0].error)); return; } - logger.debug(logSystem, logComponent, 'Profit sent, a total of ' + withdrawalAmount + ' ' + poolOptions.coin.symbol + - ' was sent to ' + processingConfig.feeReceiveAddress); + logger.debug(logSystem, logComponent, 'Profit sent, a total of ' + withdrawalAmount + + ' ' + poolOptions.coin.symbol + ' was sent to ' + processingConfig.feeReceiveAddress); }); } }); From 6aae77a15994137a2657a44edfb5ee8ad555c346 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 1 Apr 2014 16:41:03 -0600 Subject: [PATCH 5/9] Removed all but one example config. --- pool_configs/bitcoin_example.json | 66 -------------------------- pool_configs/darkcoin_example.json | 66 -------------------------- pool_configs/execoin_example.json | 59 ----------------------- pool_configs/galleon_example.json | 57 ----------------------- pool_configs/helixcoin_example.json | 58 ----------------------- pool_configs/hirocoin_example.json | 67 --------------------------- pool_configs/hobonickels_example.json | 66 -------------------------- pool_configs/litecoin_example.json | 5 +- pool_configs/maxcoin_example.json | 49 -------------------- pool_configs/ultracoin_example.json | 66 -------------------------- pool_configs/vertcoin_example.json | 59 ----------------------- 11 files changed, 2 insertions(+), 616 deletions(-) delete mode 100644 pool_configs/bitcoin_example.json delete mode 100644 pool_configs/darkcoin_example.json delete mode 100644 pool_configs/execoin_example.json delete mode 100644 pool_configs/galleon_example.json delete mode 100644 pool_configs/helixcoin_example.json delete mode 100644 pool_configs/hirocoin_example.json delete mode 100644 pool_configs/hobonickels_example.json delete mode 100644 pool_configs/maxcoin_example.json delete mode 100644 pool_configs/ultracoin_example.json delete mode 100644 pool_configs/vertcoin_example.json diff --git a/pool_configs/bitcoin_example.json b/pool_configs/bitcoin_example.json deleted file mode 100644 index a18e6bf..0000000 --- a/pool_configs/bitcoin_example.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "enabled": false, - "coin": "bitcoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "msjLr1XfpB6aAL1wi8e2CDnDSNhF4WrJ5n", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 18332, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "mtCiLWzBy9EpuxzkLwizPYiPFDy69HTd4b", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "6774": { - "diff": 1 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 18332, - "user": "testuser", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/darkcoin_example.json b/pool_configs/darkcoin_example.json deleted file mode 100644 index 291cd46..0000000 --- a/pool_configs/darkcoin_example.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "enabled": false, - "coin": "darkcoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "XfkoYutJ8KYtLxZ4TgnMqC6SCmxuc3LEDY", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 18342, - "user": "darkcoinrpc1", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "XfkoYutJ8KYtLxZ4TgnMqC6SCmxuc3LEDY", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "4073": { - "diff": 0.002 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 18342, - "user": "darkcoinrpc1", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/execoin_example.json b/pool_configs/execoin_example.json deleted file mode 100644 index 6625326..0000000 --- a/pool_configs/execoin_example.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "enabled": false, - "coin": "execoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "ESfYVyfh1yZx1AkqJnu6rJje5nWE3f2C3r", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 19847, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "EabPhjVKcmus3LKFViAcwq3dfo8kzqpMkQ", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - - "ports": { - "6368": { - "diff": 8 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 19847, - "user": "testuser", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/galleon_example.json b/pool_configs/galleon_example.json deleted file mode 100644 index 32e3a41..0000000 --- a/pool_configs/galleon_example.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "enabled": false, - "coin": "galleon.json", - - "address": "GRAiuGCWLrL8Psdr6pkhLpxrQGHdYfrSEz", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "GRAiuGCWLrL8Psdr6pkhLpxrQGHdYfrSEz", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 19632, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - } - }, - - "ports": { - "3537": { - "diff": 4 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 19632, - "user": "testuser", - "password": "testpass" - } - ], - - "p2p": { - "enabled": false, - "host": "localhost", - "port": 19333, - "protocolVersion": 70002, - "magic": "fcc1b7dc" - } -} \ No newline at end of file diff --git a/pool_configs/helixcoin_example.json b/pool_configs/helixcoin_example.json deleted file mode 100644 index 9949a88..0000000 --- a/pool_configs/helixcoin_example.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "enabled": false, - "coin": "helixcoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 70, - "minimumReserve": 10, - "feePercent": 0.05, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "mppaGeNaSbG1Q7S6V3gL5uJztMhucgL9Vh", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 19332, - "user": "litecoinrpc", - "password": "testnet" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - } - }, - - "address": "H9xyrh45LzLX4uXCP6jG6ZGrWho8srUgiG", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - - "ports": { - "3737": { - "diff": 0.2 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 16385, - "user": "testuser", - "password": "testpass" - } - ], - - "p2p": { - "enabled": false, - "host": "localhost", - "port": 19333, - "protocolVersion": 70002, - "magic": "fcc1b7dc" - } -} \ No newline at end of file diff --git a/pool_configs/hirocoin_example.json b/pool_configs/hirocoin_example.json deleted file mode 100644 index d0b27f7..0000000 --- a/pool_configs/hirocoin_example.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "enabled": false, - "coin": "hirocoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "HR6WNSR19kvaXSbwKymrba6uNx36BBjinS", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 19389, - "user": "hirocoin", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - - "address": "HR6WNSR19kvaXSbwKymrba6uNx36BBjinS", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "3073": { - "diff": 0.002 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 19389, - "user": "hirocoin", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/hobonickels_example.json b/pool_configs/hobonickels_example.json deleted file mode 100644 index 275ad3f..0000000 --- a/pool_configs/hobonickels_example.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "enabled": false, - "coin": "hobonickels.json", - - "shareProcessing": { - "internal": { - "enabled": false, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeReceiveAddress": "EhA4HXF7VPWfnV8TXerAP6p12BiEpXbiYR", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 19339, - "user": "hobonickelsrpc", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - - "address": "EzGiarU2S56jyRkYpS7FKssXCS6AAJChdU", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "3033": { - "diff": 8 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 19339, - "user": "hobonickelsrpc", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/litecoin_example.json b/pool_configs/litecoin_example.json index 223b33c..044a1e9 100644 --- a/pool_configs/litecoin_example.json +++ b/pool_configs/litecoin_example.json @@ -6,7 +6,7 @@ "internal": { "enabled": true, "validateWorkerAddress": true, - "paymentInterval": 60, + "paymentInterval": 20, "minimumPayment": 70, "minimumReserve": 10, "feePercent": 0.05, @@ -35,7 +35,6 @@ } }, - "address": "n4jSe18kZMCdGcZqaYprShXW6EH1wivUK1", "blockRefreshInterval": 1000, "txRefreshInterval": 20000, @@ -51,7 +50,7 @@ }, "ports": { - "3008":{ + "3008": { "diff": 8, "varDiff": { "minDiff": 8, diff --git a/pool_configs/maxcoin_example.json b/pool_configs/maxcoin_example.json deleted file mode 100644 index 7907165..0000000 --- a/pool_configs/maxcoin_example.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "enabled": false, - "coin": "maxcoin.json", - - "address": "tKWkadAkT2vqK6v2PHLJmV1RTVvF7XZEgN", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "tQ2TKXXk2jh7EX2RJQ4ZxpZYEdRx7fdiaw", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 27932, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - } - }, - - "ports": { - "5547": { - "diff": 6 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 27932, - "user": "testuser", - "password": "testpass" - } - ] -} diff --git a/pool_configs/ultracoin_example.json b/pool_configs/ultracoin_example.json deleted file mode 100644 index cd6158d..0000000 --- a/pool_configs/ultracoin_example.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "enabled": false, - "coin": "ultracoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "UZ3cz7EKjC4eRKbhiN9tA6xcaDGSVoESc8", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 18365, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "UhyKVr4m516TPsrLwm91pYL4f99VGrJ1oC", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - - "ports": { - "6856": { - "diff": 8 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 18365, - "user": "testuser", - "password": "testpass" - } - ] -} \ No newline at end of file diff --git a/pool_configs/vertcoin_example.json b/pool_configs/vertcoin_example.json deleted file mode 100644 index 1cf3685..0000000 --- a/pool_configs/vertcoin_example.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "enabled": false, - "coin": "vertcoin.json", - - "shareProcessing": { - "internal": { - "enabled": true, - "validateWorkerAddress": true, - "paymentInterval": 60, - "minimumPayment": 100.001, - "minimumReserve": 10, - "feePercent": 0.02, - "feeCollectAccount": "feesCollected", - "feeReceiveAddress": "VrcunuCcNUULMBoiw66v9SAdQq2m1FpP3C", - "feeWithdrawalThreshold": 5, - "daemon": { - "host": "localhost", - "port": 13295, - "user": "testuser", - "password": "testpass" - }, - "redis": { - "host": "localhost", - "port": 6379 - } - }, - "mpos": { - "enabled": false, - "host": "localhost", - "port": 3306, - "user": "me", - "password": "mypass", - "database": "ltc", - "stratumAuth": "password" - } - }, - - "address": "VrcunuCcNUULMBoiw66v9SAdQq2m1FpP3C", - "blockRefreshInterval": 1000, - "txRefreshInterval": 20000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 600, - - - "ports": { - "6381": { - "diff": 8 - } - }, - - "daemons": [ - { - "host": "localhost", - "port": 13295, - "user": "testuser", - "password": "testpass" - } - ] -} From b08468ba8d25ad31bd1bc3c90f1ba3a267022062 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 2 Apr 2014 13:01:05 -0600 Subject: [PATCH 6/9] Added "emitInvalidBlocksHahes" option for those in MPOS mode that require it. --- .gitignore | 3 +- README.md | 3 ++ coins/365coin.json | 5 ++++ config_example.json | 61 +++++++++++++++++++++++++++++++++++++++ libs/mposCompatibility.js | 2 +- libs/paymentProcessor.js | 13 +++++---- libs/poolWorker.js | 6 ++-- libs/shareProcessor.js | 4 +-- 8 files changed, 84 insertions(+), 13 deletions(-) create mode 100644 coins/365coin.json create mode 100644 config_example.json diff --git a/.gitignore b/.gitignore index d35bbf7..88d9a09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ -.idea/ \ No newline at end of file +.idea/ +config.json \ No newline at end of file diff --git a/README.md b/README.md index 66f9f49..de2b6cd 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,9 @@ Description of options: detects those and disconnects them. */ "connectionTimeout": 600, //Remove workers that haven't been in contact for this many seconds + /* Sometimes you want the block hashes even for shares that aren't block candidates. */ + "emitInvalidBlockHashes": false, + /* If a worker is submitting a high threshold of invalid shares we can temporarily ban them to reduce system/network load. Also useful to fight against flooding attacks. */ "banning": { diff --git a/coins/365coin.json b/coins/365coin.json new file mode 100644 index 0000000..c208e44 --- /dev/null +++ b/coins/365coin.json @@ -0,0 +1,5 @@ +{ + "name": "365coin", + "symbol": "365", + "algorithm": "keccak" +} \ No newline at end of file diff --git a/config_example.json b/config_example.json new file mode 100644 index 0000000..b0fa531 --- /dev/null +++ b/config_example.json @@ -0,0 +1,61 @@ +{ + "logLevel": "debug", + "clustering": { + "enabled": true, + "forks": "auto" + }, + "blockNotifyListener": { + "enabled": false, + "port": 8117, + "password": "test" + }, + + "redisBlockNotifyListener": { + "enabled" : false, + "redisPort" : 6379, + "redisHost" : "hostname", + "psubscribeKey" : "newblocks:*" + }, + "website": { + "enabled": true, + "siteTitle": "Cryppit", + "port": 80, + "statUpdateInterval": 1.5, + "hashrateWindow": 300 + }, + "proxy": { + "enabled": false, + "ports": { + "80": { + "diff": 32, + "varDiff": { + "minDiff" : 8, + "maxDiff" : 512, + "targetTime" : 15, + "retargetTime" : 90, + "variancePercent" : 30 + } + }, + "6000": { + "diff": 32, + "varDiff": { + "minDiff" : 8, + "maxDiff" : 512, + "targetTime" : 15, + "retargetTime" : 90, + "variancePercent" : 30 + } + }, + "8080": { + "diff": 32, + "varDiff": { + "minDiff" : 8, + "maxDiff" : 512, + "targetTime" : 15, + "retargetTime" : 90, + "variancePercent" : 30 + } + } + } + } +} \ No newline at end of file diff --git a/libs/mposCompatibility.js b/libs/mposCompatibility.js index 4b75adb..26b30a2 100644 --- a/libs/mposCompatibility.js +++ b/libs/mposCompatibility.js @@ -70,7 +70,7 @@ module.exports = function(logger, poolConfig){ isValidBlock ? 'Y' : 'N', shareData.difficulty, typeof(shareData.error) === 'undefined' ? null : shareData.error, - typeof(shareData.solution) === 'undefined' ? '' : shareData.solution + shareData.blockHash ? shareData.blockHash : (shareData.blockHashInvalid ? shareData.blockHashInvalid : '') ]; connection.query( 'INSERT INTO `shares` SET time = NOW(), rem_host = ?, username = ?, our_result = ?, upstream_result = ?, difficulty = ?, reason = ?, solution = ?', diff --git a/libs/paymentProcessor.js b/libs/paymentProcessor.js index a9edd14..11ddc7f 100644 --- a/libs/paymentProcessor.js +++ b/libs/paymentProcessor.js @@ -160,7 +160,7 @@ function SetupForPool(logger, poolOptions, setupFinished){ var details = r.split(':'); return { category: details[0].category, - solution: details[0], + blockHash: details[0], txHash: details[1], height: details[2], reward: details[3], @@ -191,20 +191,20 @@ function SetupForPool(logger, poolOptions, setupFinished){ txDetails.forEach(function(tx, i){ var round = rounds[i]; - if (tx.error && tx.error.code === -5 || round.solution !== tx.result.blockhash){ + if (tx.error && tx.error.code === -5 || round.blockHash !== tx.result.blockhash){ /* Block was dropped from coin daemon even after it happily accepted it earlier. */ //If we find another block at the same height then this block was drop-kicked orphaned var dropKicked = rounds.filter(function(r){ - return r.height === round.height && r.solution !== round.solution && r.category !== 'dropkicked'; + return r.height === round.height && r.blockHash !== round.blockHash && r.category !== 'dropkicked'; }).length > 0; if (dropKicked){ logger.warning(logSystem, logComponent, 'A block was drop-kicked orphaned' - + ' - we found a better block at the same height, solution ' - + round.solution + " round " + round.height); + + ' - we found a better block at the same height, blockHash ' + + round.blockHash + " round " + round.height); round.category = 'dropkicked'; } else{ @@ -298,7 +298,7 @@ function SetupForPool(logger, poolOptions, setupFinished){ if (!workerShares){ logger.error(logSystem, logComponent, 'No worker shares for round: ' - + round.height + ' solution: ' + round.solution); + + round.height + ' blockHash: ' + round.blockHash); return; } @@ -486,6 +486,7 @@ function SetupForPool(logger, poolOptions, setupFinished){ if (toBePaid !== 0) finalRedisCommands.push(['hincrbyfloat', coin + '_stats', 'totalPaid', (toBePaid / magnitude).toFixed(coinPrecision)]); + finalRedisCommands.push(['bgsave']); callback(null, magnitude, workerPayments, finalRedisCommands); diff --git a/libs/poolWorker.js b/libs/poolWorker.js index fdcde2f..453ea08 100644 --- a/libs/poolWorker.js +++ b/libs/poolWorker.js @@ -118,11 +118,11 @@ module.exports = function(logger){ var shareData = JSON.stringify(data); - if (data.solution && !isValidBlock) - logger.debug(logSystem, logComponent, logSubCat, 'We thought a block solution was found but it was rejected by the daemon, share data: ' + shareData); + if (data.blockHash && !isValidBlock) + logger.debug(logSystem, logComponent, logSubCat, 'We thought a block was found but it was rejected by the daemon, share data: ' + shareData); else if (isValidBlock) - logger.debug(logSystem, logComponent, logSubCat, 'Block solution found: ' + data.solution); + logger.debug(logSystem, logComponent, logSubCat, 'Block found: ' + data.blockHash); if (isValidShare) diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index 938bd48..57df98e 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -61,10 +61,10 @@ module.exports = function(logger, poolConfig){ if (isValidBlock){ redisCommands.push(['rename', coin + '_shares:roundCurrent', coin + '_shares:round' + shareData.height]); - redisCommands.push(['sadd', coin + '_blocksPending', [shareData.solution, shareData.tx, shareData.height, shareData.reward].join(':')]); + redisCommands.push(['sadd', coin + '_blocksPending', [shareData.blockHash, shareData.txHash, shareData.height, shareData.reward].join(':')]); redisCommands.push(['hincrby', coin + '_stats', 'validBlocks', 1]); } - else if (shareData.solution){ + else if (shareData.blockHash){ redisCommands.push(['hincrby', coin + '_stats', 'invalidBlocks', 1]); } From 4904f050f5e6e56087acf6df91eba05916a3f9ab Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Wed, 2 Apr 2014 13:02:11 -0600 Subject: [PATCH 7/9] Delete config.json --- config.json | 61 ----------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 config.json diff --git a/config.json b/config.json deleted file mode 100644 index b0fa531..0000000 --- a/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "logLevel": "debug", - "clustering": { - "enabled": true, - "forks": "auto" - }, - "blockNotifyListener": { - "enabled": false, - "port": 8117, - "password": "test" - }, - - "redisBlockNotifyListener": { - "enabled" : false, - "redisPort" : 6379, - "redisHost" : "hostname", - "psubscribeKey" : "newblocks:*" - }, - "website": { - "enabled": true, - "siteTitle": "Cryppit", - "port": 80, - "statUpdateInterval": 1.5, - "hashrateWindow": 300 - }, - "proxy": { - "enabled": false, - "ports": { - "80": { - "diff": 32, - "varDiff": { - "minDiff" : 8, - "maxDiff" : 512, - "targetTime" : 15, - "retargetTime" : 90, - "variancePercent" : 30 - } - }, - "6000": { - "diff": 32, - "varDiff": { - "minDiff" : 8, - "maxDiff" : 512, - "targetTime" : 15, - "retargetTime" : 90, - "variancePercent" : 30 - } - }, - "8080": { - "diff": 32, - "varDiff": { - "minDiff" : 8, - "maxDiff" : 512, - "targetTime" : 15, - "retargetTime" : 90, - "variancePercent" : 30 - } - } - } - } -} \ No newline at end of file From 53283f502289f23c597b995342ff5c842932688a Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Wed, 2 Apr 2014 13:06:06 -0600 Subject: [PATCH 8/9] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de2b6cd..75c9990 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ npm update #### 2) Configuration ##### Portal config -Inside the `config.json` file, ensure the default configuration will work for your environment. +Inside the `config_example.json` file, ensure the default configuration will work for your environment, then copy the file to `config.json`. Explanation for each field: ````javascript @@ -232,7 +232,9 @@ Description of options: } }, - "mpos": { //Enabled this and shares will be inserted into share table in a MySQL database + /* Enabled mpos and shares will be inserted into share table in a MySQL database. You may + also want to use the "emitInvalidBlockHashes" option below if you require it. */ + "mpos": { "enabled": false, "host": "localhost", //MySQL db host "port": 3306, //MySQL db port From db99f49ec05857e3c814d63f7988216ca0753b80 Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 2 Apr 2014 14:09:57 -0600 Subject: [PATCH 9/9] Added unsupported algorithm error and fixed algo for helixcoin --- coins/helixcoin.json | 2 +- init.js | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/coins/helixcoin.json b/coins/helixcoin.json index 9fc6f85..65302ec 100644 --- a/coins/helixcoin.json +++ b/coins/helixcoin.json @@ -1,5 +1,5 @@ { "name": "Helixcoin", "symbol": "HXC", - "algorithm": "max" + "algorithm": "keccak" } \ No newline at end of file diff --git a/init.js b/init.js index 982b358..decf2cb 100644 --- a/init.js +++ b/init.js @@ -3,15 +3,18 @@ var path = require('path'); var os = require('os'); var cluster = require('cluster'); -var async = require('async'); -var posix = require('posix'); -var PoolLogger = require('./libs/logUtil.js'); -var BlocknotifyListener = require('./libs/blocknotifyListener.js'); +var async = require('async'); +var posix = require('posix'); +var PoolLogger = require('./libs/logUtil.js'); +var BlocknotifyListener = require('./libs/blocknotifyListener.js'); var RedisBlocknotifyListener = require('./libs/redisblocknotifyListener.js'); -var WorkerListener = require('./libs/workerListener.js'); -var PoolWorker = require('./libs/poolWorker.js'); -var PaymentProcessor = require('./libs/paymentProcessor.js'); -var Website = require('./libs/website.js'); +var WorkerListener = require('./libs/workerListener.js'); +var PoolWorker = require('./libs/poolWorker.js'); +var PaymentProcessor = require('./libs/paymentProcessor.js'); +var Website = require('./libs/website.js'); + +var algos = require('stratum-pool/lib/algoProperties.js'); + JSON.minify = JSON.minify || require("node-json-minify"); var portalConfig = JSON.parse(JSON.minify(fs.readFileSync("config.json", {encoding: 'utf8'}))); @@ -88,6 +91,12 @@ var buildPoolConfigs = function(){ var coinProfile = JSON.parse(JSON.minify(fs.readFileSync(coinFilePath, {encoding: 'utf8'}))); poolOptions.coin = coinProfile; configs[poolOptions.coin.name] = poolOptions; + + if (!(coinProfile.algorithm in algos)){ + logger.error('Master', coinProfile.name, 'Cannot run a pool for unsupported algorithm "' + coinProfile.algorithm + '"'); + delete configs[poolOptions.coin.name]; + } + }); return configs; };