roles_logic_sv2

Crates.ioroles_logic_sv2
lib.rsroles_logic_sv2
version4.0.0
created_at2024-02-15 15:48:06.31391+00
updated_at2025-09-25 00:29:18.441521+00
descriptionCommon handlers for use within SV2 roles
homepagehttps://stratumprotocol.org
repositoryhttps://github.com/stratum-mining/stratum
max_upload_size
id1141274
size145,532
SV2-bot (SV2-bot)

documentation

https://docs.rs/roles_logic_sv2

README

roles_logic_sv2

crates.io docs.rs rustc+ license codecov

roles_logic_sv2 provides the core logic and utilities for implementing roles in the Stratum V2 (Sv2) protocol, such as miners, pools, and proxies. It abstracts message handling, channel management, job creation, and routing logic, enabling efficient and secure communication across upstream and downstream connections.

Main Components

  • Channel Logic: Manages the lifecycle and settings of communication channels (standard, extended, and group ones) between roles.
  • Handlers: Provides traits for handling logic of Sv2 protocol messages.
  • Job Management: Facilitates the creation, validation, and dispatching of mining jobs.
  • Parsers: Handles serialization and deserialization of Sv2 messages via binary_sv2.
  • Routing Logic: Implements message routing and downstream/upstream selector utilities. Useful for advanced proxy implementations with multiplexing of Standard Channels across different upstreams.
  • Utilities: Provides helpers for safe mutex locking, mining-specific calculations, and more.

Usage

To include this crate in your project, run:

cargo add roles_logic_sv2

This crate can be built with the following feature flags:

  • prop_test: Enables property-based testing features for template distribution logic, leveraging dependencies' testing capabilities such as template_distribution_sv2 crate.
  • disable_nopanic: Disables the nopanic logic in scenarios where code coverage tools might conflict with it.
Commit count: 3337

cargo fmt