Skip to main content

Crate channels_sv2

Crate channels_sv2 

Source
Expand description

§Stratum V2 Channels

channels_sv2 provides primitives and abstractions for Stratum V2 (Sv2) Channels.

This crate implements the core channel management functionality for both mining clients and servers, including standard, extended, and group channels, and share accounting mechanisms.

§Features

  • Channel primitives for SV2 mining protocol
  • Channel management for mining servers and clients
  • Standard, extended, and group channel support
  • Share accounting
  • Server-side job lifecycle management
  • client module is no_std compatible. To enable it build the crate with no_std feature.

Re-exports§

pub use extranonce_manager::MAX_EXTRANONCE_LEN;
pub use vardiff::classic::VardiffState;
pub use vardiff::Vardiff;

Modules§

bip141
Provides functionality to strip coinbase_tx_prefix and coinbase_tx_suffix from bip141 marker, flag and witness data.
chain_tip
Chain Tip
client
Sv2 channels - Mining Clients Abstractions.
extranonce_manager
Extranonce prefix allocation for downstream SV2 channels.
merkle_root
outputs
Utilities to deserialize outputs.
server
Sv2 channels - Mining Servers Abstraction.
target
Helper functions related to Target
vardiff

Constants§

MAX_FUTURE_BLOCK_TIME
Mirrors Bitcoin Core’s MAX_FUTURE_BLOCK_TIME (src/chain.h): a block timestamp more than 2 hours in the future is consensus-invalid.
MAX_SEEN_SHARES_CAP
Upper clamp on the seen-shares budget derived by seen_shares_budget, in hashes.
MIN_SEEN_SHARES_CAP
Lower clamp applied to the seen-shares budget derived by seen_shares_budget.
SEEN_SHARES_MARGIN
Safety margin applied on top of the expected share rate when bounding the accepted-share dedup cache (seen_shares).
VERSION_ROLLING_MASK
Version rolling mask as per BIP323: only these general-purpose bits may differ between a job’s advertised version and a share’s version. All other bits of a share’s version must match the job’s version exactly.
WORST_CASE_TIP_MINUTES
Worst-case chain-tip lifetime, in minutes, assumed when bounding the accepted-share dedup cache (seen_shares).

Functions§

seen_shares_budget
Returns the maximum number of accepted-share hashes retained for duplicate detection, given the channel’s expected share rate: