Expand description
This crate provides all constants used in the SV2 protocol. These constants are essential for message framing, encryption, and protocol-specific identifiers across various SV2 components, including Mining, Job Declaration, and Template Distribution protocols.
It also includes definitions for key encryption settings and message types, ensuring consistency and accuracy when working with SV2’s binary protocol. These constants are used throughout the system to ensure that SV2 messages are formatted and interpreted correctly.
§Discriminants for Stratum V2 (sub)protocols
Discriminants are unique identifiers used to distinguish between different Stratum V2 (sub)protocols. Each protocol within the SV2 ecosystem has a specific discriminant value that indicates its type, enabling the correct interpretation and handling of messages. These discriminants ensure that messages are processed by the appropriate protocol handlers, thereby facilitating seamless communication across different components of the SV2 architecture. More info can be found on Chapter 03 of the Stratum V2 specs.
§Message Types
Message types in the SV2 protocol define the specific operations and data exchanges between participants. Each type corresponds to a distinct action or information transfer, facilitating communication in various contexts such as mining operations, job declarations, and template distribution. Properly identifying and handling these message types is crucial for maintaining protocol compliance and ensuring seamless interactions within the SV2 ecosystem. The message types are categorized into common types and those specific to each subprotocol, providing clarity on their intended use and interaction patterns.
§Channel Bits
The channel bits indicate whether a message is associated with a specific
channel. If the most significant bit of the extension_type (referred to as
channel_msg) is set, the message is related to a channel and includes a
channel_id. In this case, the first 4 bytes of the payload represent the
channel_id the message is destined for.
Constants§
- AEAD_
MAC_ LEN - Size of the MAC for supported AEAD encryption algorithm (ChaChaPoly).
- CHANNEL_
BIT_ ALLOCATE_ MINING_ JOB_ TOKEN - CHANNEL_
BIT_ ALLOCATE_ MINING_ JOB_ TOKEN_ SUCCESS - CHANNEL_
BIT_ CHANNEL_ ENDPOINT_ CHANGED - CHANNEL_
BIT_ CLOSE_ CHANNEL - CHANNEL_
BIT_ COINBASE_ OUTPUT_ CONSTRAINTS - CHANNEL_
BIT_ DECLARE_ MINING_ JOB - CHANNEL_
BIT_ DECLARE_ MINING_ JOB_ ERROR - CHANNEL_
BIT_ DECLARE_ MINING_ JOB_ SUCCESS - CHANNEL_
BIT_ IDENTIFY_ TRANSACTIONS - CHANNEL_
BIT_ IDENTIFY_ TRANSACTIONS_ SUCCESS - CHANNEL_
BIT_ MINING_ SET_ NEW_ PREV_ HASH - CHANNEL_
BIT_ NEW_ EXTENDED_ MINING_ JOB - CHANNEL_
BIT_ NEW_ MINING_ JOB - CHANNEL_
BIT_ NEW_ TEMPLATE - CHANNEL_
BIT_ OPEN_ EXTENDED_ MINING_ CHANNEL - CHANNEL_
BIT_ OPEN_ EXTENDED_ MINING_ CHANNEL_ SUCCES - CHANNEL_
BIT_ OPEN_ MINING_ CHANNEL_ ERROR - CHANNEL_
BIT_ OPEN_ STANDARD_ MINING_ CHANNEL - CHANNEL_
BIT_ OPEN_ STANDARD_ MINING_ CHANNEL_ SUCCESS - CHANNEL_
BIT_ PROVIDE_ MISSING_ TRANSACTIONS - CHANNEL_
BIT_ PROVIDE_ MISSING_ TRANSACTIONS_ SUCCESS - CHANNEL_
BIT_ RECONNECT - CHANNEL_
BIT_ REQUEST_ TRANSACTION_ DATA - CHANNEL_
BIT_ REQUEST_ TRANSACTION_ DATA_ ERROR - CHANNEL_
BIT_ REQUEST_ TRANSACTION_ DATA_ SUCCESS - CHANNEL_
BIT_ SETUP_ CONNECTION - CHANNEL_
BIT_ SETUP_ CONNECTION_ ERROR - CHANNEL_
BIT_ SETUP_ CONNECTION_ SUCCESS - CHANNEL_
BIT_ SET_ CUSTOM_ MINING_ JOB - CHANNEL_
BIT_ SET_ CUSTOM_ MINING_ JOB_ ERROR - CHANNEL_
BIT_ SET_ CUSTOM_ MINING_ JOB_ SUCCESS - CHANNEL_
BIT_ SET_ EXTRANONCE_ PREFIX - CHANNEL_
BIT_ SET_ GROUP_ CHANNEL - CHANNEL_
BIT_ SET_ NEW_ PREV_ HASH - CHANNEL_
BIT_ SET_ TARGET - CHANNEL_
BIT_ SUBMIT_ SHARES_ ERROR - CHANNEL_
BIT_ SUBMIT_ SHARES_ EXTENDED - CHANNEL_
BIT_ SUBMIT_ SHARES_ STANDARD - CHANNEL_
BIT_ SUBMIT_ SHARES_ SUCCESS - CHANNEL_
BIT_ SUBMIT_ SOLUTION - CHANNEL_
BIT_ SUBMIT_ SOLUTION_ JD - CHANNEL_
BIT_ UPDATE_ CHANNEL - CHANNEL_
BIT_ UPDATE_ CHANNEL_ ERROR - ELLSWIFT_
ENCODING_ SIZE - Size in bytes of the encoded elliptic curve point using ElligatorSwift encoding. This encoding produces a 64-byte representation of the X-coordinate of a secp256k1 curve point.
- ENCRYPTED_
ELLSWIFT_ ENCODING_ SIZE - Size in bytes of the encrypted ElligatorSwift encoded data, which includes the original ElligatorSwift encoded data and a MAC for integrity verification.
- ENCRYPTED_
SIGNATURE_ NOISE_ MESSAGE_ SIZE - Size in bytes of the encrypted signature noise message, which includes the SIGNATURE_NOISE_MESSAGE and a MAC for integrity verification.
- ENCRYPTED_
SV2_ FRAME_ HEADER_ SIZE - Size of the encrypted SV2 frame header, including the MAC.
- EXTENSION_
TYPE_ NO_ EXTENSION - Identifier for the extension_type field in the SV2 frame, indicating no extensions.
- INITIATOR_
EXPECTED_ HANDSHAKE_ MESSAGE_ SIZE - Size in bytes of the handshake message expected by the initiator, encompassing:
- MAC
- MESSAGE_
TYPE_ ALLOCATE_ MINING_ JOB_ TOKEN - MESSAGE_
TYPE_ ALLOCATE_ MINING_ JOB_ TOKEN_ SUCCESS - MESSAGE_
TYPE_ CHANNEL_ ENDPOINT_ CHANGED - MESSAGE_
TYPE_ CLOSE_ CHANNEL - MESSAGE_
TYPE_ COINBASE_ OUTPUT_ CONSTRAINTS - MESSAGE_
TYPE_ DECLARE_ MINING_ JOB - MESSAGE_
TYPE_ DECLARE_ MINING_ JOB_ ERROR - MESSAGE_
TYPE_ DECLARE_ MINING_ JOB_ SUCCESS - MESSAGE_
TYPE_ IDENTIFY_ TRANSACTIONS - MESSAGE_
TYPE_ IDENTIFY_ TRANSACTIONS_ SUCCESS - MESSAGE_
TYPE_ MINING_ SET_ NEW_ PREV_ HASH - MESSAGE_
TYPE_ NEW_ EXTENDED_ MINING_ JOB - MESSAGE_
TYPE_ NEW_ MINING_ JOB - MESSAGE_
TYPE_ NEW_ TEMPLATE - MESSAGE_
TYPE_ OPEN_ EXTENDED_ MINING_ CHANNEL - MESSAGE_
TYPE_ OPEN_ EXTENDED_ MINING_ CHANNEL_ SUCCES - MESSAGE_
TYPE_ OPEN_ MINING_ CHANNEL_ ERROR - MESSAGE_
TYPE_ OPEN_ STANDARD_ MINING_ CHANNEL - MESSAGE_
TYPE_ OPEN_ STANDARD_ MINING_ CHANNEL_ SUCCESS - MESSAGE_
TYPE_ PROVIDE_ MISSING_ TRANSACTIONS - MESSAGE_
TYPE_ PROVIDE_ MISSING_ TRANSACTIONS_ SUCCESS - MESSAGE_
TYPE_ RECONNECT - MESSAGE_
TYPE_ REQUEST_ TRANSACTION_ DATA - MESSAGE_
TYPE_ REQUEST_ TRANSACTION_ DATA_ ERROR - MESSAGE_
TYPE_ REQUEST_ TRANSACTION_ DATA_ SUCCESS - MESSAGE_
TYPE_ SETUP_ CONNECTION - MESSAGE_
TYPE_ SETUP_ CONNECTION_ ERROR - MESSAGE_
TYPE_ SETUP_ CONNECTION_ SUCCESS - MESSAGE_
TYPE_ SET_ CUSTOM_ MINING_ JOB - MESSAGE_
TYPE_ SET_ CUSTOM_ MINING_ JOB_ ERROR - MESSAGE_
TYPE_ SET_ CUSTOM_ MINING_ JOB_ SUCCESS - MESSAGE_
TYPE_ SET_ EXTRANONCE_ PREFIX - MESSAGE_
TYPE_ SET_ GROUP_ CHANNEL - MESSAGE_
TYPE_ SET_ NEW_ PREV_ HASH - MESSAGE_
TYPE_ SET_ TARGET - MESSAGE_
TYPE_ SUBMIT_ SHARES_ ERROR - MESSAGE_
TYPE_ SUBMIT_ SHARES_ EXTENDED - MESSAGE_
TYPE_ SUBMIT_ SHARES_ STANDARD - MESSAGE_
TYPE_ SUBMIT_ SHARES_ SUCCESS - MESSAGE_
TYPE_ SUBMIT_ SOLUTION - MESSAGE_
TYPE_ SUBMIT_ SOLUTION_ JD - MESSAGE_
TYPE_ UPDATE_ CHANNEL - MESSAGE_
TYPE_ UPDATE_ CHANNEL_ ERROR - NOISE_
FRAME_ HEADER_ LEN_ OFFSET - NOISE_
FRAME_ HEADER_ SIZE - Size of the Noise protocol frame header in bytes.
- NOISE_
FRAME_ MAX_ SIZE - NOISE_
HASHED_ PROTOCOL_ NAME_ CHACHA - If protocolName is less than or equal to 32 bytes in length, use protocolName with zero bytes appended to make 32 bytes. Otherwise, apply HASH to it. For name = “Noise_NX_Secp256k1+EllSwift_ChaChaPoly_SHA256”, we need the hash. More info can be found at this link.
- NOISE_
SUPPORTED_ CIPHERS_ MESSAGE - RESPONDER_
EXPECTED_ HANDSHAKE_ MESSAGE_ SIZE - SIGNATURE_
NOISE_ MESSAGE_ SIZE - Size in bytes of the SIGNATURE_NOISE_MESSAGE, which contains information and a signature for the handshake initiator, formatted according to the Noise Protocol specifications.
- SV2_
FRAME_ CHUNK_ SIZE - Maximum size of an SV2 frame chunk in bytes.
- SV2_
FRAME_ HEADER_ LEN_ END - SV2_
FRAME_ HEADER_ LEN_ OFFSET - SV2_
FRAME_ HEADER_ SIZE - Size of the SV2 frame header in bytes.
- SV2_
JOB_ DECLARATION_ PROTOCOL_ DISCRIMINANT - SV2_
MINING_ PROTOCOL_ DISCRIMINANT - SV2_
TEMPLATE_ DISTR_ PROTOCOL_ DISCRIMINANT