EIP-1571 Ethereum Stratum 2.0 protocol (EthereumStratum/2.0.0)

No call decision · Networking & nodes · EIP status Stagnant · created 2018-11-09

A proposal that defines an Ethereum-specific standard specification for the Stratum protocol, through which miners and mining pool servers exchange work. It reduces transmission volume by unifying messages into a compact JSON-RPC format.

Why it is needed

Ethereum has no official Stratum standard, and officially only supports the getWork method, where miners must keep polling the server. go-ethereum recently added a push mechanism, but this is mainly for pools running their own nodes, and most miners don't run nodes directly. In the absence of a standard, pool-specific variants have emerged, including NiceHash's EthereumStratum/1.0.0, forcing miners and mining software developers to guess which variant a pool uses every time they switch pools. Existing implementations are also verbose: even just mining.notify (about 240 bytes), sent once per block, generates roughly 1.88TB of traffic per month for a pool with 50,000 TCP connections. This disadvantages miners with slower internet connections in mining, which also affects the decentralization of mining.

What changes

Today

After EIP-1571

Who is affected

In depth

Message structure and JSON-RPC variations

All communication follows JSON-RPC 2.0, but each message is a single line of JSON text terminated by an LF (newline) character. Messages fall into three types: requests, which expect a response; responses to those; and notifications, which expect no response. To save bytes, there are deviations (defiances) from standard JSON-RPC 2.0: the jsonrpc field must always be omitted, and id cannot be null and must be an integer between 0 and 65535, string ids are not allowed.

Notation rules for saving bytes

JSON member names use only lowercase letters and numbers and cannot start with a digit. Arrays must consist of a single data type. Boolean values are represented as "0"/"1" instead of true/false. Hex values omit the 0x prefix and meaningless leading zeros and are written in lowercase only, though this rule does not apply to hashes and extranonce. All numbers without fractions are sent in hexadecimal.

Requests, responses, notifications, and error codes

A request has id, method, and optionally params, while a response has id and optionally error or result. A success response with no data to send can be sent without a result, like {"id": 2}, and mixing result and error together in a way that creates ambiguous interpretation is prohibited. Error codes follow a scheme of 2xx (accepted but with additional information, e.g. Stale 202), 3xx (authorization issues), 4xx (syntax/value errors, e.g. Bad nonce 406, Invalid Worker Name 215), and 5xx (internal server errors).

Why the client sends mining.hello first

An early draft considered having the server announce itself first immediately after connection, but this was dropped because it was pointed out to be vulnerable to traffic amplification attacks or DDoS using spoofed IPs. Instead, the client first sends a mining.hello request containing agent, host, port, and proto, and the server ensures transparency by responding with proto, encoding (gzip or plain), resume, timeout, maxerrors, and the node software version it uses (node).

Session resumption, termination, reconnection, and noop

mining.bye is a notification that formally ends a session; reconnecting afterward requires re-authenticating all workers without session resumption. Sending a previous session id with mining.subscribe triggers session resumption if the server supports it, reusing cached work, extranonce, and authenticated worker information as-is. mining.reconnect is used when the server moves the client to a different host/port, and it is recommended that host use a DNS name for TLS certificate CN verification. mining.noop acts as a ping to prevent timeouts when a solution hasn't been found for a long time.

Worker authentication and tokens

mining.authorize sends an array of ["<account>[.<MachineName>]", "password"] as params. Pools that allow anonymous mining ignore the password value. On successful authentication, the server issues a worker token (e.g. "w-123") unique within that session, and subsequent requests like mining.submit or mining.hashrate send only this token instead of the full account to reduce transmitted bytes. When resuming a session, the previously received token can be reused.

Keeping work lightweight with mining.set and extranonce

The server separately announces infrequently changing values via mining.set. For epoch, it sends the epoch number instead of the seed hash for a more compact transmission, and for target it sends the adjusted boundary hash itself rather than a difficulty exponent. algo defaults to ethash and anticipates variants like ethash1a and ProgPoW. extranonce assigns each miner a different search range (up to 6 bytes) to reduce duplicate work across the 2^64 nonce space. mining.set is sent only when these values change, so mining.notify, the per-block notification, stays lightweight, carrying only jobId, block number, headerhash, and staleness.

Hashrate reporting and current status

The client sends its measured hashrate and worker token via mining.hashrate, and the server may respond with a simple acknowledgment or a server-calculated hashrate, and may reject overly frequent requests with an error (220, Too many requests). The server can also periodically send a notification containing interval, hr, accepted (total accepted and how many were stale among them), and rejected values. This EIP's status is Stagnant, meaning it is no longer progressing and is not a confirmed, adopted standard.

Original EIP · ← EIPs