Skip to main content

stratum_apps/
lib.rs

1//! # Stratum Apps - SV2 Application Utilities
2//!
3//! This crate consolidates the essential utilities needed for building Stratum V2 applications.
4//! It combines the functionality from the original separate utility crates into a single,
5//! well-organized library with feature-based compilation.
6//!
7//! ## Features
8//!
9//! ### Core Features
10//! - `network` - High-level networking utilities (enabled by default)
11//! - `fallback-coordinator` - Runtime fallback coordination helpers (enabled by default)
12//! - `config` - Configuration management helpers (enabled by default)
13//! - `payout` - Shared payout-mode parsing and coinbase-output distribution helpers
14//! - `monitoring` - HTTP and Prometheus monitoring helpers (optional)
15//! - `asic-rs-telemetry` - Optional miner telemetry helpers powered by `asic-rs`
16//! - `std` - Standard-library support for key and random utilities (enabled by default)
17//! - `core` - Re-export and enable `stratum-core`
18//! - `bitcoin-core-sv2` - Re-export and enable `bitcoin_core_sv2`
19//!
20//! ### Role-Specific Feature Bundles
21//! - `pool` - Everything needed for pool applications
22//! - `jd_client` - Everything needed for JD client applications
23//! - `jd_server` - Configuration helpers and Bitcoin Core IPC runtime APIs for JD server
24//!   applications
25//! - `translator` - Everything needed for translator applications (includes SV1 and payout helpers)
26//! - `mining_device` - Configuration helpers for mining device applications
27//!
28//! ## Modules
29//!
30//! - [`network_helpers`] - High-level networking utilities for SV2 connections
31//! - [`config_helpers`] - Configuration management and parsing utilities
32//! - [`payout`] - Payout-mode parsing and coinbase-output construction/verification helpers
33
34/// Re-export all the modules from `stratum_core`
35#[cfg(feature = "core")]
36pub use stratum_core;
37
38/// Re-export all the modules from `bitcoin_core_sv2`
39#[cfg(feature = "bitcoin-core-sv2")]
40pub use bitcoin_core_sv2;
41
42/// High-level networking utilities for SV2 connections
43///
44/// Provides connection management, encrypted streams, and protocol handling.
45/// Originally from the `network_helpers_sv2` crate.
46#[cfg(feature = "network")]
47pub mod network_helpers;
48
49/// Configuration management helpers
50///
51/// Utilities for parsing configuration files, handling coinbase outputs,
52/// and setting up logging. Originally from the `config_helpers_sv2` crate.
53#[cfg(feature = "config")]
54pub mod config_helpers;
55
56/// Custom Mutex
57///
58/// A wrapper around std::sync::Mutex
59pub mod custom_mutex;
60/// Key utilities for cryptographic operations
61///
62/// Provides Secp256k1 key management, serialization/deserialization, and signature services.
63/// Supports both standard and no_std environments.
64pub mod key_utils;
65
66/// Utility methods used in apps.
67pub mod utils;
68
69/// Channel monitoring - expose channel data via HTTP JSON APIs
70#[cfg(feature = "monitoring")]
71pub mod monitoring;
72
73// Task orchestrator used in SRI apps.
74pub mod task_manager;
75/// Template provider type
76///
77/// Provides the type of template provider that will be used.
78pub mod tp_type;
79
80/// Creates a CoinbaseOutputConstraints message from a list of coinbase outputs
81pub mod coinbase_output_constraints;
82
83/// Shared payout-mode parsing and coinbase-output distribution helpers.
84#[cfg(feature = "payout")]
85pub mod payout;
86
87/// Fallback coordinator
88#[cfg(feature = "fallback-coordinator")]
89pub mod fallback_coordinator;
90
91/// Share synchronous primitives
92pub mod sync;
93
94/// Shared async channel cleanup helpers.
95pub mod channel_utils;