Skip to main content

Module wire

Module wire 

Source
Expand description

Stratum V1 on the wire, for both roles: newline-delimited JSON-RPC messages, and the share arithmetic a pool and a miner must agree on byte for byte — the coinbase a job describes, the block header a share commits to, its double SHA-256, and its difficulty.

Structs§

Job
One unit of work: what mining.notify carries.
Lines
Newline-delimited JSON values from one side of a connection.

Enums§

Message

Constants§

DIFF1
Difficulty 1: the target 0x00000000FFFF0000…, as a number.
EXTRANONCE1_SIZE
Bytes of extranonce1 the pool assigns each connection.
EXTRANONCE2_SIZE
Bytes of extranonce2 the pool asks miners to roll.
IO_TIMEOUT
MAX_BRANCHES
Merkle branches a job may carry (a block of 2^16 transactions).
MAX_COINBASE
Coinbase halves are at most this long.
MAX_COINBASE_MESSAGE
The coinbase message a pool job carries, in bytes.
MAX_LINE
One JSON-RPC line, at most.
NTIME_ROLL
How far past the job’s ntime a share may roll its timestamp, in seconds.

Functions§

difficulty
The difficulty a header hash meets: difficulty 1’s target over the hash as a number.
display_hex
A hash as block explorers and RPC show it: byte-reversed hex.
error
[code, message, null], Stratum’s error shape (20 other, 21 job not found, 22 duplicate, 23 low difficulty, 24 unauthorized worker, 25 not subscribed).
line
parse
parse_prev_display
A previous block hash as RPC writes it (64 hex digits), or zero when absent.
parse_u32_hex
pool_job
A pool’s job: a coinbase carrying the block height (BIP 34) and message, paying nothing to an OP_RETURN output, with room for the extranonces; no other transactions.
sha256d
u32_hex
A 32-bit field as Stratum writes it: big-endian hex of the number.