9 releases (stable)

new 2.0.0 Mar 28, 2025
1.2.3 Jan 8, 2025
1.2.1 Aug 13, 2024
1.1.0 May 24, 2024
0.1.1 Feb 15, 2024

#4 in #stratum

Download history 44/week @ 2024-12-05 72/week @ 2024-12-12 11/week @ 2024-12-19 1/week @ 2024-12-26 193/week @ 2025-01-02 116/week @ 2025-01-09 27/week @ 2025-01-16 29/week @ 2025-01-23 924/week @ 2025-01-30 1374/week @ 2025-02-06 1231/week @ 2025-02-13 1399/week @ 2025-02-20 1753/week @ 2025-02-27 1620/week @ 2025-03-06 916/week @ 2025-03-13 140/week @ 2025-03-20

4,609 downloads per month
Used in 6 crates

MIT/Apache

645KB
10K SLoC

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.

Dependencies

~11MB
~152K SLoC