General Theory
Based on the JSON-RPC 2.0 Specification .
Request Object:
method - string
params - can be an array or object
id - string or number. Omit if this is a notification (meaning no response expected)
Response Object:
result - anything. Required on success, must be omitted if error
error - array [ErrNum, ErrMsg]. Required if error, must be omitted otherwise
id - simply return the id value received from the request object
Protocol Specification
mining.subscribe (miner to pool)
Request
{ id : 1, method : 'mining.subscribe', params : [EthAccount, OptionalClientIDString] }
Response
Success: { result : true }
or, Failure: { error : [ErrNum, ErrMsg] }
mining.notify (pool to miner)
Request
{ method : 'mining.notify', params : [Challenge, Target, Difficulty, PoolAddress] }
Response
mining.submit (miner to pool)
Request
{ id : 4, method : 'mining.submit', params : [nonce, minerEthAddress, digest, difficulty, challenge] }
Response
Success: { result : true }
or, Failure: { error : [ErrNum, ErrMsg] }
Sample Communication
Request:
{"id":1, "method":"mining.subscribe", "params":["0x......", "MVis Tokenminer v1.0.0"]}
Response:
{"id":1, "result":true}
or, an example error:
{"id":1,"error":[20,"Invalid ETH account"]}
Request:
{"method":"mining.notify", "params":["0x5b0ddd0f2534ed01e7f75c29fa3a35efadc72b225294151a03b88c2f81f9e74f", "1061807130275471351913039363427234684992478303410828700794234495969122", 26, "0x......"]}
Response:
-none-
Request:
{"id":4, "method":"mining.submit", "params":["0x7f3fd984d574c279613d48c0bb4f1289eb5d6b5aba90ae427225c41e07646191", "0x.......", "0x0000002057ec85645f5820ce68ef12c02c3b37174fe66155aaa873e679b60677", 2675645, "0x5b0ddd0f2534ed01e7f75c29fa3a35efadc72b225294151a03b88c2f81f9e74f"]}
Response:
{"id":4, "result":true}
or, an example error:
{"id":4, "error":[23,"Low difficulty share"]}
Implementation Resources
Stratum Proxy
- Conformant client written in Javascript
Mvis-Tokenminer
- Conformant client written in C++ / Boost Asio
stratum-pool - Server implementation written in Javascript.
Not necessarily 100% conformant to the above protocol specs, but still a useful resource. I borrowed from the code heavily.