Crates.io | codec_sv2 |
lib.rs | codec_sv2 |
version | 1.3.0 |
source | src |
created_at | 2021-06-14 17:27:23.989541 |
updated_at | 2024-10-17 12:52:40.568657 |
description | Sv2 data format |
homepage | https://stratumprotocol.org |
repository | https://github.com/stratum-mining/stratum |
max_upload_size | |
id | 410020 |
size | 82,307 |
codec_sv2
codec_sv2
provides the message encoding and decoding functionality for the Stratum V2 (Sv2)
protocol, handling secure communication between Sv2 roles. This crate abstracts the complexity of
message encoding/decoding with optional Noise protocol support, ensuring both regular and encrypted
messages can be serialized, transmitted, and decoded consistently and reliably.
Encoder: Encodes Sv2 messages with or without Noise protocol support.
Decoder: Decodes Sv2 messages with or without Noise protocol support.
Handshake State: Manages the current Noise protocol handshake state of the codec.
To include this crate in your project, run:
cargo add codec_sv2
This crate can be built with the following feature flags:
noise_sv2
: Enables support for Noise protocol encryption and decryption.with_buffer_pool
: Enables buffer pooling for more efficient memory management.with_serde
: builds binary_sv2
and
buffer_sv2
crates with serde
-based encoding and
decoding. Note that this feature flag is only used for the Message Generator, and deprecated
for any other kind of usage. It will likely be fully deprecated in the future.This crate provides two examples demonstrating how to encode and decode Sv2 frames:
Unencrypted Example: Encode and decode standard Sv2 frames, detailing the message serialization and transmission process for unencrypted communications.
Encrypted Example: Encode and decode Sv2 frames with Noise protocol encryption, detailing the entire encryption handshake and transport phase and serialization and transmission process for encrypted communications.