Stratum

From Veriblock Wiki
Jump to: navigation, search

See: Main_Page


Overview

Repo: https://github.com/VeriBlock/stratum-veriblock

NodeCore version: nodecore-0.4.6-rc.5 or later (See beta link here: https://mirror1.veriblock.org/nodecore-0.4.6-rc.5.zip)

This reference implementation is derived from slush0's original Stratum work. The original project can be found here:

Modification was made to the stratum project to use Python 3.7, and the stratum-mining project customized to proxy VeriBlock NodeCore's UCP protocol and support the VeriBlock header format and hashing algorithm.

Included in this repository are the Stratum framework, custom VeriBlock Stratum implementation and a reference CPU miner.

TODO

  • Compatible miners (GPU, FPGA)
  • Implement persistent storage for a user's difficulty and submitted shares. Crypto-Expert provides numerous db implementations.
  • Some mechanism for payout transactions. This should not be part of the Stratum mining service, but rather an additional service that reads the share database.
    • With variable difficulty, payouts would be based on the combination of number of shares and target difficulty
    • Include some finality checks to ensure that mined blocks do not become orphaned
    • Payouts should be to specific miners that have reached a balance threshold as opposed to immediate payout for all contributors in the round

Features

  • Proxy that connects over NodeCore's UCP protocol and translates to Stratum protocol
  • Variable difficulty (VARDIFF) - Share mining target adjusts based on speed of share submission

Build - Stratum Server

The Stratum server components are written in Python.

By convention, all references to {ROOT} below represent the root folder of the repository.

Prerequisites

  • Python 3.7
  • pip
  • virtualenv (Recommended)

Build Steps

  1. (Optional) Create and activate a virtual environment
$ cd {ROOT}\stratum-server
$ virtualenv -p "C:\Python37\python.exe" venv
$ venv\Scripts\activate
  1. Install required packages
$ pip install -r requirements.txt
  1. Install Stratum framework package (from source)
$ cd {ROOT}\stratum-server\stratum
$ python setup.py install
  1. Install vBlake package (from source)
$ cd {ROOT}\stratum-server\vblake
$ python setup.py install

Build - Reference PoW Miner

The reference PoW miner is written in Java.

  1. Build with gradlew
$ cd {ROOT}\reference-miner
$ gradlew clean installDist

The executable script will be found at {ROOT}\reference-miner\build\install\nodecore-pow\bin

Configuration

Configuration of the stratum server can be done by modifying the file: {ROOT}\stratum-server\conf\config.py

Run

  1. Start NodeCore. NodeCore should be built and run from the source code feature branch feature/stratum
  2. Start a SOLO mining pool on NodeCore, by issuing the RPC command startsolopool via CLI or HTTP API.
  3. Run the Stratum server instance
$ cd {ROOT}\stratum-server
$ twistd -ny launcher.tac
  1. Run the reference PoW miner. The Stratum server will be running at 127.0.0.1:3333 and should be the value used to connect to in the miner.