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//! - `std` - Standard-library support for key and random utilities (enabled by default)
16//! - `core` - Re-export and enable `stratum-core`
17//!
18//! ### Role-Specific Feature Bundles
19//! - `pool` - Everything needed for pool applications
20//! - `jd_client` - Everything needed for JD client applications
21//! - `jd_server` - Configuration helpers for JD server applications
22//! - `translator` - Everything needed for translator applications (includes SV1 and payout helpers)
23//! - `mining_device` - Configuration helpers for mining device applications
24//!
25//! ## Modules
26//!
27//! - [`network_helpers`] - High-level networking utilities for SV2 connections
28//! - [`config_helpers`] - Configuration management and parsing utilities
29//! - [`payout`] - Payout-mode parsing and coinbase-output construction/verification helpers
30
31/// Re-export all the modules from `stratum_core`
32#[cfg(feature = "core")]
33pub use stratum_core;
34
35/// High-level networking utilities for SV2 connections
36///
37/// Provides connection management, encrypted streams, and protocol handling.
38/// Originally from the `network_helpers_sv2` crate.
39#[cfg(feature = "network")]
40pub mod network_helpers;
41
42/// Configuration management helpers
43///
44/// Utilities for parsing configuration files, handling coinbase outputs,
45/// and setting up logging. Originally from the `config_helpers_sv2` crate.
46#[cfg(feature = "config")]
47pub mod config_helpers;
48
49/// Custom Mutex
50///
51/// A wrapper around std::sync::Mutex
52pub mod custom_mutex;
53/// Key utilities for cryptographic operations
54///
55/// Provides Secp256k1 key management, serialization/deserialization, and signature services.
56/// Supports both standard and no_std environments.
57pub mod key_utils;
58
59/// Utility methods used in apps.
60pub mod utils;
61
62/// Channel monitoring - expose channel data via HTTP JSON APIs
63#[cfg(feature = "monitoring")]
64pub mod monitoring;
65
66// Task orchestrator used in SRI apps.
67pub mod task_manager;
68/// Template provider type
69///
70/// Provides the type of template provider that will be used.
71pub mod tp_type;
72
73/// Creates a CoinbaseOutputConstraints message from a list of coinbase outputs
74pub mod coinbase_output_constraints;
75
76/// Shared payout-mode parsing and coinbase-output distribution helpers.
77#[cfg(feature = "payout")]
78pub mod payout;
79
80/// Fallback coordinator
81#[cfg(feature = "fallback-coordinator")]
82pub mod fallback_coordinator;
83
84/// Share synchronous primitives
85pub mod sync;
86
87/// Shared async channel cleanup helpers.
88pub mod channel_utils;