Skip to main content

Crate stratum

Crate stratum 

Source

Structs§

Authorize
Configure
ConfigureResponse
Difficulty
Difficulty is a fraught metric. It is derived from the network target, where the difficulty equals the current network target divided by the network target defined in the genesis block. The target principally represents a 256-bit number but the block header contains a compact representation called nbits (or CompactTarget). This is inherently lossy. Furthermore difficulty, which used to be only for human consumption has made itself into the stratum protocol to define the target (inverse of difficulty) a miner’s share has to meet. It is used to tune the frequency of a miner’s share submission and for accounting how much work has been completed. This struct aims to define it’s edges and make it easier to work with but it is inherently lossy and imprecise. If someone stumbles accross this comment and sees a better way to reconcile these different types, please open an issue or PR.
Extranonce
JobId
MerkleNode
Stratum uses the the natural big-endian hex encoding of a hash but for some reason all double sha256d::Hash are displayed in little-endian hex in Bitcoin. To ensure correct serialization/deserialization and display this wrapper type was created.
Nbits
Nonce
Notify
Ntime
PrevHash
The prevhash has a pretty insane encoding: It swaps every 4-byte word from big-endian into little-endian and then hex encodes.
SetDifficulty
StratumErrorResponse
Submit
Subscribe
SubscribeResult
SuggestDifficulty
Username
Version

Enums§

Event
Id
InternalError
Message
StratumError

Functions§

format_si
merkle_branches
Constructs the merkle branches from all non-coinbase transactions that should be included in the block.
merkle_root
Calculates the merkle root by reassembling the coinbase transaction and rebuilding the merkle tree from the merkle branches. This is definitely a target for some optimization in the future.
parse_si

Type Aliases§

Result