code cleanup Added jobManager.blockHashHex which should generate the expected block hash but it seems to not work properly Moved check for the share difficulty after the block check since it's useless to make the check there. Changed emit event from client to client.connected and added client.disconnected Changed share emit data. Now we pass the client instance to everyone listening to the share event. Added mining.get_transaction to the handled events of stratumclient. It looks like bfgminer uses this. changed StratumClient.sendDifficulty to StratumCLient.sendAndSetDifficulty which will also perform a check on the given difficulty and broadcasts the sendDifficulty message to the client Only if the new difficulty is different from the previous one. Code cleanup and comments |
||
|---|---|---|
| example | ||
| libs | ||
| node_modules | ||
| scripts | ||
| .gitignore | ||
| index.js | ||
| LICENSE | ||
| README.md | ||
| TODOLIST.md | ||
node-stratum
Under development
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 port :)
Why
This server was built to be more efficient and easier to setup, maintain and scale than existing stratum poolservers which are written in python. Compared to the spaghetti state of the latest stratum-mining python server, this software should also have a lower barrier to entry for other developers to fork and add features or fix bugs.
Features (mostly untested)
- Daemon interface
- Stratum TCP socket server
- Block template / job manager
- Optimized generation transaction building
- Process share submissions
- Supports algos: scrypt, scrypt-jane, quark
To do
- Proof-of-stake support
- Payment processing module
- Vardiff
- Statistics module
- Integrate with PostgreSQL database
- Web frontend
Requirements
- node v0.10+
- coin daemon
- PostgreSQL
- npm dependencies
Installation
-
Clone repository
git clone https://github.com/zone117x/node-stratum.git cd node-stratum -
For each coin you would like to start a pool server for, create a file in the "coins" directory titled "(name of coin).json" Example configuration for dogecoin.json:
{ "name": "Dogecoin", "symbol": "doge", "algorithm": "scrypt", "reward": "POW", "address": "DDt79i6P3Wro3SD3HSnkRLpMgUGUGdiNhS", "stratumPort": 3334, "difficulty": 8, "daemon": { "host": "localhost", "port": 8332, "user": "test", "password": "test" } }- Supported
"algorithm"options:"sha256""scrypt""scrypt-jane""quark" - Supported
"reward"options:"POW""POS" - Ensure the
daemonproperties are configured correctly for RPC communication
- Supported
-
[Optional, recommended] Setting up blocknotify
-
Inside
config.jsonmake sureblockNotifyListener.enabledis set to true -
Set the
blockNotifyListener.portandblockNotifyListener.password -
For the blocknotify arguments in your daemon startup parameters or conf file, use:
[path to blockNotify.js] [pool host]:[pool blockNotifyListener port] [blockNotifyListener password] [coin symbol set in coin's json config] %s"- Example:
dogecoind -blocknotify="blockNotify.js localhost:8117 mySuperSecurePassword doge %s" - If your daemon is on a different host you will have to copy over
blockNotify.js
- Example:
-
-
To start the poolserver run:
node init.js
Credits
- Slush0 - stratum protocol, documentation and original python code
- viperaus - scrypt adaptions to python code
- ahmedbodi - more algo adaptions to python code
- TheSeven - being super knowledgeable & helpful
- vekexasia - lots of help with research and development
Donations
BTC: 1KRotMnQpxu3sePQnsVLRy3EraRFYfJQFR
License
Released under the GNU General Public License v2