Crate const_sv2

Crate const_sv2 

Source
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