Stratum is how Bitcoin miners connect with mining pools.
See here for a description of Stratum and here for Stratum extensions. Extensions are necessary to support ASIC Boost.
forked from https://github.com/kbnchk/go-Stratum
use master for now, eventually ill do a 1.0.0 release
go get github.com/0xf0xx0/stratum@master
- Implement everything to get up to stratum 1.1 support
- work out all the bugs
- streaming support?
- 310
- mining.configure
- mining.authorize
- mining.subscribe
- mining.set_difficulty
- mining.suggest_difficulty
- mining.set_version_mask
- mining.notify
- mining.submit
- mining.ping
- mining.set_extranonce
- mining.extranonce.subscribe
- mining.suggest_target
- mining.get_transactions
- client.get_version
- client.reconnect
- client.show_message
Some methods are client-to-server, others are server-to-client. Some methods require a response, others do not.
| method | type |
|---|---|
| mining.configure | request / response |
| mining.authorize | request / response |
| mining.subscribe | request / response |
| mining.extranonce.subscribe | request / response |
| mining.submit | request / response |
| mining.ping | request / response |
| mining.suggest_difficulty | notification |
| mining.suggest_target | notification |
| mining.get_transactions | request / response |
| method | type |
|---|---|
| mining.set_difficulty | notification |
| mining.set_version_mask | notification |
| mining.notify | notification |
| mining.set_extranonce | notification |
| mining.ping | request / response |
| client.get_version | request / response |
| client.reconnect | notification |
| client.show_message | notification |
TODO: replace all this with a link to bip-41
Stratum uses json. There are three message types: notification, request, and response.
Notification is for methods that don't require a response.
{
method: string, // one of the methods above
params: [json...] // array of json values
}
Request is for methods that require a response.
{
"id": integer or string, // a unique id
"method": string, // one of the methods above
"params": [json...] // array of json values
}
Response is the response to requests.
{
"id": integer or string, // a unique id, must be the same as on the request
"result": json, // could be anything
"error": null or [
unsigned int, // error code
string // error message
]
}
The first message that is sent in classic Stratum. For extended Stratum,
mining.configure comes first and then mining.authorize.
Sent by the client after mining.authorize.
Sent by the server after responding to mining.subscribe and every time
the difficulty changes.
Sent by the server whenever the block is updated. This happens periodically as the block is being built and when a new block is discovered.
The first message that is sent in extended Stratum. Necessary for ASICBoost. The client sends this to tell the server what extensions it supports.
Sent by the server to notify of a change in version mask. Requires the
version-rolling extension.
Sent by the client when a new share is mined. Modified by version-rolling.
Sent by either the server or client at any time. Expects a boolean response.