Git Product home page Git Product logo

ref-stratum-firo's Introduction

ref-stratum-zcoin

This Reference Stratum is a simple implementation used as a basis for testing, experimentation, and demonstration purposes. It is not intended for production use.

This project has been developed and tested on Node v10.17 and Ubuntu 16.04

Install

NodeJS v10 (Ubuntu)

# Optional: uninstall current version
sudo apt-get remove node
sudo apt-get remove nodejs

# Install version 10.x
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y

Dependencies

# (ubuntu) build essentials required to compile MTP verification
sudo apt-get install build-essentials

# Dependencies may require that you have a Github personal access token to install.
npm config set @mintpond:registry https://npm.pkg.github.com/mintpond
npm config set //npm.pkg.github.com/:_authToken <PERSONAL_ACCESS_TOKEN>

Creating a personal access token

Download from Github

git clone https://github.com/MintPond/ref-stratum-zcoin

# install
cd ref-stratum-zcoin
npm install

Install in a Project

npm config set @mintpond:registry https://npm.pkg.github.com/mintpond
npm config set //npm.pkg.github.com/:_authToken <PERSONAL_ACCESS_TOKEN>

npm install @mintpond/ref-stratum-zcoin --save

Usage

The stratum can be used as a module in a pool:

const Stratum = require('@mintpond/ref-stratum-zcoin').Stratum;

class MyStratum extends Stratum {
    /* Override */
    canAuthorizeWorker(client, callback) {
        // implement your own logic
        if (client.minerAddress === 'bad') {
            // do not authorize worker
            callback(null/*error*/, false/*isAuthorized*/);
        }
        else {
            // authorize worker
            callback(null/*error*/, true/*isAuthorized*/);
        }
    }
}

const stratum = new MyStratum({
    coinbaseAddress: 'TC6qME2GhepR7656DgsR72pkQDmhfTDbtV', // address that receives block reward
    blockBrand: '/@mintpond/ref-stratum/', // Branding string added to every block found
    host: "0.0.0.0", // address the stratum will listen on
    port: {
        number: 3000, // port the stratum will listen on
        diff: 1024    // stratum difficulty
    },
    rpc: {
        host: '172.16.3.102', // Zcoin daemon RPC host
        port: 17001,          // Zcoin daemon RPC port
        user: 'rpcuser',      // Zcoin daemon RPC user
        password: "x"         // Zcoin daemon RPC password
    },
    jobUpdateInterval: 55,    // Broadcast job updates every n seconds
    blockPollIntervalMs: 250  // Check for new blocks every n milliseconds
});

stratum.on(Stratum.EVENT_SHARE_SUBMITTED, ev => {
    console.log(ev.share);    
});

stratum.init();

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

  • ClientReader - Handles messages received from a client.
  • ClientWriter - Handles sending messages to a client.
  • Coinbase - Creates coinbase transaction and includes founder rewards.
  • Share - Processes shares, validates proofs, creates blocks.
  • Socket - Handles binary BOS serialization and deserialization.
  • algorithm - Contains MTP constants and hash verification.

Resources

  • Zcoin - The first cryptocurrency to implement the Merkle Tree Proof POW algorithm.
  • MintPond Mining Pool - Zcoin mining pool.

ref-stratum-firo's People

Contributors

jcthepants 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.