Code Monkey home page Code Monkey logo

ergostratumserver's Introduction

Stratum mining server for Ergo.

This project is based on Node stratum server with necessary modifications to support Ergo.

Requirements

  • Node v10+ (tested with v12+)
  • Ergo node
    • fully synced
    • wallet initialized and unlocked
    • mining = true in node's config

Simple Usage

  • Clone project

    git clone https://github.com/mhssamadani/ErgoStratumServer.git
    npm update
  • Update start.js file and set node address

    • change node url and port
    • user and password fields are not used
      "daemons": [
            {   //Main daemon instance
                "host": "88.198.13.202",// node's url
                "port": 9053, // node's port
                "user": "litecoinrpc", // anything, not used
                "password": "testnet" // anything, not used
            }
            ...
    
  • Run start.js

    node start.js

Mapping

Note that Ergo node generates the candidate block and this process cannot be outsourced to miners.

Here is the mapping between Stratum parameters and thier usage in the ergo implementation; This is a sparse list passed to miner/proxy however network overhead is negligible.

Stratum Parameter Used Parameter in ergo implementation Size Encoding
Job ID Job ID Variable size (1-10 Characters) passed as integer with no encoding
prevHashReversed height Variable size (1-10 Characters) passed as integer with no encoding
generationTransaction[0] msg 64 Characters 32 Byte encoded as hex
generationTransaction[1] '' empty
merkleBranch '' empty
version version 8 Characters 4 Byte big endian encoded version passed as hex
nbits b Variable Size (1-78 Characters) Big integer stored in a string without any encoding
curtime '' empty
clean job clean jobs 5 character boolean with 'true' or 'false' value

ย 

Here is the Autolykos v2 variable sizes:

parameter size
nonce 8 Bytes
height 4 Bytes
M 8192 Bytes
j in J 4 Bytes
i 4 Bytes
f 31 Bytes
N 2^26 init size, will change in future blocks
k 32

Methods

All methods are same as Stratum v1 methods; just for clarification see the details of these two methods:

  • Subscribe: with this method we set two parameters called extraNonce1 and extraNonce2Size. Miner must find a nonce (8 Bytes) for current block which starts with extraNonce1 and extended with extraNonce2Size bytes

    • for example if extraNonce1 is FADD9871 and extraNonce2Size is 4, miner must find a nonce in range [FADD987100000000 - FADD9871FFFFFFFF]
  • Set difficulty: in order to update difficulty mining.set_difficulty method is used in stratum. If zero, b is used as is; otherwise, for any number greater that zero, proxy multiplies this value to b and passes it to miner.

Configurations (for pool operators)

For details see the comments in the start.js file. Don't mess with these parameters if you are not a pool operator and only using this server for your node.

not used:

  • "coin"
  • "address"
  • "rewardRecipients"
  • "p2p"

used:

  • "blockRefreshInterval"
  • "jobRebroadcastTimeout"
  • "connectionTimeout"
  • "emitInvalidBlockHashes"
  • "tcpProxyProtocol"
  • "banning"
  • "ports"
  • "daemons"

Reference

  1. Stratum V1 Docs
  2. Ergo Node Setup
  3. Ergo Stratum Proxy

ergostratumserver's People

Contributors

aciddude avatar ahmedbodi avatar bart-is avatar bitbandi avatar bluecircle avatar bmatusiak avatar bolkin avatar bricecarpentier avatar chrisfranko avatar cremator avatar danielzuwala avatar darcymei avatar darkcoinproject avatar dogui1718 avatar earlz avatar hashunlimited avatar jonnybravo0311 avatar lucasjones avatar mhssamadani avatar minkcrypto avatar romanornr avatar sirsavary avatar stackout avatar suchpool avatar valera-rozuvan avatar vekexasia avatar zargarzadehm avatar zone117x avatar

Watchers

 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.