Skip to content

Reference stratum to aid in development of MTP miners and pools.

License

Notifications You must be signed in to change notification settings

bu11ettrain/node-mtp-reference-stratum

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-mtp-reference-stratum

This is a reference MTP Stratum pool to aid in programmer development of Zcoin MTP (Merkle Tree Proof) miners and pools that use the MTP Stratum Protocol. It is not intended to be used in production as is.

This stratum has been developed and tested on Node v8.12 and Ubuntu 16.04

Usage

The MTP Stratum can be used as a module in a pool:

const StratumPool = require('mtp-reference-stratum').StratumPool;

const pool = new StratumPool({
    config: config,
    authorizeFn: authorizeFn
});

pool.on(StratumPool.EVENT_SHARE_SUBMITTED, function (e) {
    console.log(e);
});

pool.start();

Configuration

const config = {
    address: 'TBVKqLhVBt4aCwM5aPvUin5YU4ATHWUNpC', // pool wallet address
    daemon: {
        host: '127.0.0.1', // daemon ip/hostname
        rpcPort: 17101,    // rpc port
        user: 'rpcuser',   // rpc user name
        password: 'x'      // rpc password
    },
    port: {
        number: 3000,      // port number
        diff: 1            // difficulty
    }
}

AuthorizeFn

The authorize function is used to accept or deny worker authorizations.

function authorizeFn(worker, callback) {
    /* The "worker" argument is an instance of class.StratumWorker.js */
    if (worker.ipAddress === 'badguy') {
        callback({
            isAuthorized: false,
            error: [20, 'No bad guys allowed', null] // optional
        });
    }
    else {
        callback({
            isAuthorized: true
        });
    }
}

Start Script

There is a start script (start.js) included which contains further examples. It can also be run in order to get a Stratum going for test purposes. You will need to open and modify the config inside before running it.

> node start

Areas of Interest

  • lib/class.ShareProcessor.js - Processes shares, validates proofs, etc.
  • lib/class.Job.js - Contains header and block serialization.
  • lib/class.StratumClient.js - Contains server->client Stratum communications.
  • lib/class.StratumClientHandler.js - Contains client->server Stratum communications.

Resources

  • Zcoin - The first cryptocurrency to implement the Merkle Tree Proof POW algorithm.
  • What is MTP

License

Some components have been adapted from node-stratum-pool. The same GPL License is in use.

About

Reference stratum to aid in development of MTP miners and pools.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%