Coder Social home page Coder Social logo

waosman / node-mtp-reference-stratum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mintpond/node-mtp-reference-stratum

0.0 1.0 0.0 39 KB

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

License: GNU General Public License v2.0

JavaScript 100.00%

node-mtp-reference-stratum's Introduction

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.

node-mtp-reference-stratum's People

Contributors

jcthepants avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.