EIPs Explained

EIP-1571 · Stagnant · Interface · 2018-11-09

EIP-1571: EthereumStratum/2.0.0

A proposed, compact JSON-over-TCP Stratum protocol for Ethereum proof-of-work miners and mining pools, aiming to replace the many incompatible Stratum flavours in use.

What problem does it solve?

Proof-of-work miners rarely ran a full node; they connected to a mining pool that handed out work and collected results. Pools used "Stratum", a persistent TCP connection carrying line-based JSON messages. But Ethereum never had an official Stratum spec, so each pool spoke its own dialect, and mining software had to guess which one it was talking to.

The messages were also wordy. The spec estimates a typical mining.notify at about 240 bytes, which adds up quickly at one job per block across tens of thousands of connections, and hurts miners on poor connections.

EthereumStratum/2.0.0 proposes one well-defined, byte-frugal protocol, built mainly on NiceHash's EthereumStratum/1.0.0.

How it works

  • Messages are JSON-RPC 2.0, one per line ending in \n, but trimmed: the jsonrpc member is always omitted, id must be an integer 0–65535, and numbers are sent as lowercase hex without 0x or leading zeros.
  • Handshake: the client sends mining.hello (agent, host, port, protocol). The server replies with its protocol, whether it will gzip all further messages, whether sessions can be resumed, an idle timeout and max error count.
  • Session: mining.subscribe starts or resumes a session; mining.authorize registers each worker (account.machine) and returns a short token used in later messages.
  • Setup: mining.set sends values that rarely change (epoch number instead of seed hash, target, algorithm, and an extranonce prefix that gives each miner its own nonce range).
  • Work: mining.notify sends job id, block number, header hash and a "previous shares are stale" flag. mining.submit returns job id, the nonce suffix (without the extranonce) and the worker token.
  • Extras: mining.hashrate reporting, mining.noop, mining.reconnect and mining.bye.

Sample code

A typical exchange (one JSON object per line):

{"id":0,"method":"mining.hello","params":{"agent":"ethminer-0.17","host":"pool.example","port":"4d2","proto":"EthereumStratum/2.0.0"}}
{"id":0,"result":{"proto":"EthereumStratum/2.0.0","encoding":"plain","resume":"1","timeout":"b4","maxerrors":"5","node":"Geth/v1.8.18"}}
{"id":1,"method":"mining.subscribe"}
{"id":2,"method":"mining.authorize","params":["0xYourAccount.rig1","x"]}
{"id":2,"result":"w-123"}
{"method":"mining.set","params":{"epoch":"dc","target":"0112e0be826d694b2e62d01511f12a6061fbaec8bc02357593e70e52ba","algo":"ethash","extranonce":"af4c"}}
{"method":"mining.notify","params":["bf0488aa","6526d5","645cf20198c2f3861e947d4f67e3ab63b7b2e24dcc9095bd9123e7b33371f6cc","0"]}
{"id":31,"method":"mining.submit","params":["bf0488aa","68765fccd712","w-123"]}
{"id":31}

Here the full nonce is the extranonce plus the submitted suffix: af4c68765fccd712.

Things to know

  • Status is Stagnant. Pools and miners continued to use a mix of dialects.
  • Ethereum mainnet stopped using proof-of-work at the Merge (EIP-3675), so this protocol is no longer relevant to Ethereum itself; it may still interest other Ethash-based chains.
  • Unlike earlier Stratum flavours, the client speaks first (mining.hello) to avoid letting the server be used for traffic amplification attacks.
  • Extranonces must keep their leading zeros ("01ac" and "1ac" give different nonce ranges), and pools may use at most 6 hex characters.

#mining #stratum #pool #proof-of-work #protocol

Details

Authors
Andrea Lanfranchi (@AndreaLanfranchi), Pawel Bylica (@chfast), Marius Van Der Wijden (@MariusVanDerWijden)
Status
Stagnant
Type
Standards Track / Interface
Created
2018-11-09

Machine-readable: Markdown · JSON