Stratum protocol changes for ZCash

slush0 edited this page Sep 21, 2016 · 24 revisions
Clone this wiki locally

mining.subscribe()

{"id": 1, "method": "mining.subscribe", "params": ["CONNECT_HOST", CONNECT_PORT, "MINER_USER_AGENT", "SESSION_ID"]}\n
{"id": 1, "result": ["NONCE_1", "SESSION_ID"], "error": null}\n

CONNECT_HOST is host string used by miner. For example "zcash.slushpool.com".

CONNECT_PORT is port used by miner (integer). For example 3337.

MINER_USER_AGENT is free-form string specifying type of mining software and its version. Recommended syntax is "poclbm-zcash/1.0".

SESSION_ID in request may be NULL indicating that miner wants to start new session.

SESSION_ID in response may be NULL indicating that pool does not support session resuming.

NONCE_1 is first part of the block header nonce (in hex).

By protocol, Zcash's nonce is 32 bytes long. The miner will pick NONCE_2 such that len(NONCE_2) = 32 - len(NONCE_1). Please note that Stratum use hex encoding, so you have to convert NONCE_1 from hex to binary before.

mining.authorize()

{"id": 2, "method": "mining.authorize", "params": ["WORKER_NAME", "WORKER_PASSWORD"]}\n
{"id": 2, "result": true, "error": null}\n

mining.set_target()

{"id": null, "method": "mining.set_target", "params": ["TARGET"]}\n

For displaying purposes to users, miner can use powLimit as defined in zcashd/src/chainparams.cpp for recalculating targets to integer difficulty as used in bitcoin miners.

mining.notify()

{"id": null, "method": "mining.notify", "params": ["JOB_ID", "VERSION", "PREVHASH", "MERKLEROOT", "RESERVED", "TIME", "BITS", CLEAN_JOBS]}\n

VERSION is used as a switch for the subsequent parameters. The currently-specified parameters following it are only valid for VERSION == 4.

mining.submit()

{"id": 4, "method": "mining.submit", "params": ["WORKER_NAME", "JOB_ID", "TIME", "NONCE_2", "EQUIHASH_SOLUTION"]}\n
{"id": 4, "result": true, "error": null}\n

NONCE_2 is the second part of the block header nonce.

client.reconnect()

{"id": 0, "method": "client.reconnect", "params": ["HOST", PORT, WAIT_TIME]}\n

If client.reconnect is sent without parameters, the miner is to assume it's to reconnect to the same port and URL.

mining.suggest_target() (client-to-server, optional)

{"id": 3, "method": "mining.suggest_target", "params": ["TARGET"]}\n