
High performance Stratum poolserver in Node.js. One instance of this software can startup and manage multiple coin
pools, each with their own daemon and stratum ports :)
Notice
I am trying to make this useable software. On my list of up-front todos:
- Multiple PoWAUX coins on each main chain (ahmedbodi)
- Profit Switching
- Built-in stratum redundancy
Frontend and payment enhancements will be a separate repo. Merged Pooler
Why
The software that I forked was a wonderful beginning that never came to fruition. I hope to bring Node stratum into the
mainstream of merged mining.
Features
- Merged Mining Support
- Daemon RPC interface
- Stratum TCP socket server
- Block template / job manager
- P2P to get block notifications as peer node
- Optimized generation transaction building
- Connecting to multiple daemons for redundancy
- Process share submissions
- Session managing for purging DDoS/flood initiated zombie workers
- Auto ban IPs that are flooding with invalid shares
- POW (proof-of-work) & POS (proof-of-stake) support
- Transaction messages support
- Vardiff (variable difficulty / share limiter)
- When started with a coin daemon that hasn't finished syncing to the network it shows the blockchain download progress and initializes once synced
Hashing algorithms supported:
- ✓ SHA256 (Bitcoin, Freicoin, Peercoin/PPCoin, Terracoin, etc..)
- ✓ Scrypt (Litecoin, Dogecoin, Feathercoin, etc..)
- ✓ Scrypt-Jane (YaCoin, CopperBars, Pennies, Tickets, etc..)
- ✓ Scrypt-N (Vertcoin [VTC])
- ✓ Quark (Quarkcoin [QRK])
- ✓ X11 (Darkcoin [DRK], Hirocoin, Limecoin)
- ✓ X13 (MaruCoin, BoostCoin)
- ✓ NIST5 (Talkcoin)
- ✓ Keccak (Maxcoin [MAX], HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
- ✓ Skein (Skeincoin [SKC])
- ✓ Groestl (Groestlcoin [GRS])
May be working (needs additional testing):
- ? Blake (Blakecoin [BLC])
- ? Fugue (Fuguecoin [FC])
- ? Qubit (Qubitcoin [Q2C], Myriadcoin [MYR])
- ? SHAvite-3 (INKcoin [INK])
- ? Sha1 (Sha1coin [SHA], Yaycoin [YAY])
Not working currently:
- Groestl - for Myriadcoin
- Keccak - for eCoin & Copperlark
- Hefty1 (Heavycoin [HVC])
Requirements
- Node v0.10+
- Coin daemon for primary and auxillary coins
- Patience :)
Example Usage
Install as a node module by cloning repository
git clone https://github.com/sigwo/node-merged-pool
cd node-merged-pool
npm install
Module usage
=======
Create the configuration for your coin:
Possible options for algorithm
: sha256, scrypt, scrypt-jane, scrypt-n, quark, x11, keccak, blake,
skein, groestl, fugue, shavite3, hefty1, qubit, or sha1.
var myCoin = {
"name": "Dogecoin",
"symbol": "DOGE",
"algorithm": "scrypt",
"nValue": 1024,
"rValue": 1,
"txMessages": false,
"peerMagic": "fbc0b6db"
"peerMagicTestnet": "fcc1b7dc"
};
If you are using the scrypt-jane
algorithm there are additional configurations:
var myCoin = {
"name": "Freecoin",
"symbol": "FEC",
"algorithm": "scrypt-jane",
"chainStartTime": 1375801200,
"nMin": 6,
"nMax": 32
};
If you are using the scrypt-n
algorithm there is an additional configuration:
var myCoin = {
"name": "Execoin",
"symbol": "EXE",
"algorithm": "scrypt-n",
"timeTable": {
"2048": 1390959880,
"4096": 1438295269,
"8192": 1485630658,
"16384": 1532966047,
"32768": 1580301436,
"65536": 1627636825,
"131072": 1674972214,
"262144": 1722307603
}
};
If you are using the keccak
algorithm there are additional configurations (The rare normalHashing
keccak coins
such as Copperlark and eCoin don't appear to work yet - only the popular ones like Maxcoin are):
var myCoin = {
"name": "eCoin",
"symbol": "ECN",
"algorithm": "keccak",
"normalHashing": true
};
Create and start new pool with configuration options and authentication function
var Stratum = require('stratum-pool');
var pool = Stratum.createPool({
"coin": myCoin,
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc",
"rewardRecipients": {
"n37vuNFkXfk15uFnGoVyHZ6PYQxppD3QqK": 1.5,
"mirj3LtZxbSTharhtXvotqtJXUY7ki5qfx": 0.5,
"22851477d63a085dbc2398c8430af1c09e7343f6": 0.1
},
"blockRefreshInterval": 1000,
"jobRebroadcastTimeout": 55,
"connectionTimeout": 600,
"emitInvalidBlockHashes": false,
"tcpProxyProtocol": false,
"banning": {
"enabled": true,
"time": 600,
"invalidPercent": 50,
"checkThreshold": 500,
"purgeInterval": 300
},
"ports": {
"3032": {
"diff": 32,
"varDiff": {
"minDiff": 8,
"maxDiff": 512,
"targetTime": 15,
"retargetTime": 90,
"variancePercent": 30
}
},
"3256": {
"diff": 256
}
},
"daemons": [
{
"host": "127.0.0.1",
"port": 19332,
"user": "litecoinrpc",
"password": "testnet"
},
{
"host": "127.0.0.1",
"port": 19344,
"user": "litecoinrpc",
"password": "testnet"
}
],
"p2p": {
"enabled": false,
"host": "127.0.0.1",
"port": 19333,
"disableTransactions": true
}
}, function(ip, port , workerName, password, callback){
console.log("Authorize " + workerName + ":" + password + "@" + ip);
callback({
error: null,
authorized: true,
disconnect: false
});
});
Listen to pool events
pool.on('share', function(isValidShare, isValidBlock, data){
if (isValidBlock)
console.log('Block found');
else if (isValidShare)
console.log('Valid share submitted');
else if (data.blockHash)
console.log('We thought a block was found but it was rejected by the daemon');
else
console.log('Invalid share submitted')
console.log('share data: ' + JSON.stringify(data));
});
pool.on('log', function(severity, logKey, logText){
console.log(severity + ': ' + '[' + logKey + '] ' + logText);
});
Start pool
pool.start();
Credits
- zone117x - Head developer of the original stratum mining pool for node.js
- vekexasia - co-developer & great tester
- LucasJones - got p2p block notify working and implemented additional hashing algos
- TheSeven - answering an absurd amount of my questions, found the block 1-16 problem, provided example code for peer node functionality
- pronooob - knowledgeable & helpful
- Slush0 - stratum protocol, documentation and original python code
- viperaus - scrypt adaptions to python code
- ahmedbodi - more algo adaptions to python code and unomp dev
- steveshit - ported X11 hashing algo from python to node module
- KillerByte - for beginning this creation
Donations
Below is my donation address. The original dev addresses are listed because I felt scammy if I removed them. They no longer are supporting the current development
effort. Please donate to:
- BTC:
1BRUcdAdjdQoAgUwcN7nbNDzqhL92ub3xE
- Cryptsy Trade Key:
197f17af3751709b2c7f076a2d3393e064022e91
Original author (zone117x):
- BTC:
1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR
- LTC:
LKfavSDJmwiFdcgaP1bbu46hhyiWw5oFhE
- VTC:
VgW4uFTZcimMSvcnE4cwS3bjJ6P8bcTykN
- MAX:
mWexUXRCX5PWBmfh34p11wzS5WX2VWvTRT
- QRK:
QehPDAhzVQWPwDPQvmn7iT3PoFUGT7o8bC
- DRK:
XcQmhp8ANR7okWAuArcNFZ2bHSB81jpapQ
- DOGE:
DBGGVtwAAit1NPZpRm5Nz9VUFErcvVvHYW
- Cryptsy Trade Key:
254ca13444be14937b36c44ba29160bd8f02ff76
License
Released under the GNU General Public License v2
http://www.gnu.org/licenses/gpl-2.0.html