1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
//! # rustywallet-batch
//!
//! High-performance batch key and address generation for cryptocurrency wallets.
//!
//! This crate provides efficient APIs for generating large batches of private keys
//! and addresses with parallel processing, SIMD optimization, and memory-efficient streaming.
//!
//! ## Features
//!
//! - **Batch Generation**: Generate millions of keys and addresses efficiently
//! - **Address Generation**: Support for P2PKH, P2WPKH, and P2TR address types
//! - **Parallel Processing**: Utilize all CPU cores with rayon
//! - **Memory Streaming**: Process unlimited keys/addresses without memory exhaustion
//! - **Incremental Scanning**: Scan key ranges using EC point addition
//! - **SIMD Optimization**: Use SIMD instructions for faster processing
//! - **Memory-Mapped Output**: Write directly to files without buffering
//! - **Resume Capability**: Checkpoint and resume long-running operations
//! - **Configurable**: Flexible configuration for different use cases
//!
//! ## Batch Address Generation
//!
//! ```rust
//! use rustywallet_batch::address::{BatchAddressGenerator, BatchAddressType};
//! use rustywallet_address::Network;
//!
//! // Generate 1000 P2WPKH addresses in parallel
//! let generator = BatchAddressGenerator::new(BatchAddressType::P2WPKH, Network::BitcoinMainnet);
//! let addresses = generator.generate_vec(1000).unwrap();
//!
//! println!("Generated {} addresses", addresses.len());
//!
//! // Stream addresses for memory efficiency
//! for (key, addr) in generator.generate_stream(1_000_000).take(100) {
//! println!("{}: {}", key.to_hex(), addr);
//! }
//! ```
//!
//! ## Quick Start
//!
//! ```rust
//! use rustywallet_batch::prelude::*;
//!
//! // Generate 1000 keys in parallel
//! let keys = BatchGenerator::new()
//! .count(1000)
//! .parallel()
//! .generate_vec()
//! .unwrap();
//!
//! println!("Generated {} keys", keys.len());
//! ```
//!
//! ## Streaming Large Batches
//!
//! ```rust
//! use rustywallet_batch::prelude::*;
//!
//! // Stream keys without storing all in memory
//! let stream = BatchGenerator::new()
//! .count(1_000_000)
//! .generate()
//! .unwrap();
//!
//! for key in stream.take(100) {
//! println!("{}", key.unwrap().to_hex());
//! }
//! ```
//!
//! ## Memory-Mapped File Output
//!
//! ```no_run
//! use rustywallet_batch::mmap::{MmapBatchGenerator, OutputFormat};
//!
//! // Generate keys directly to file
//! let count = MmapBatchGenerator::new("keys.txt", 1_000_000)
//! .format(OutputFormat::Hex)
//! .parallel(true)
//! .generate()
//! .unwrap();
//!
//! println!("Generated {} keys to file", count);
//! ```
//!
//! ## Resumable Generation
//!
//! ```no_run
//! use rustywallet_batch::checkpoint::ResumableBatchGenerator;
//!
//! // Start or resume generation with checkpoints
//! let mut generator = ResumableBatchGenerator::new(
//! "my-job",
//! 10_000_000,
//! "keys.txt",
//! "checkpoint.json",
//! );
//!
//! generator.generate_with_progress(|progress| {
//! println!("Progress: {:.1}%", progress);
//! }).unwrap();
//! ```
//!
//! ## SIMD Optimization
//!
//! ```rust
//! use rustywallet_batch::simd::SimdBatchProcessor;
//!
//! // Check SIMD availability
//! println!("SIMD: {} ({})",
//! SimdBatchProcessor::is_available(),
//! SimdBatchProcessor::feature_name()
//! );
//!
//! // Generate with SIMD optimization
//! let processor = SimdBatchProcessor::new();
//! let keys = processor.parallel_generate(10_000);
//! ```
//!
//! ## Incremental Key Scanning
//!
//! ```rust
//! use rustywallet_batch::prelude::*;
//! use rustywallet_keys::prelude::PrivateKey;
//!
//! // Scan from a base key
//! let base = PrivateKey::from_hex(
//! "0000000000000000000000000000000000000000000000000000000000000001"
//! ).unwrap();
//!
//! let scanner = KeyScanner::new(base)
//! .direction(ScanDirection::Forward);
//!
//! for key in scanner.scan_range(10) {
//! println!("{}", key.unwrap().to_hex());
//! }
//! ```
//!
//! ## Configuration Presets
//!
//! ```rust
//! use rustywallet_batch::prelude::*;
//!
//! // Fast mode - maximum speed
//! let config = BatchConfig::fast();
//!
//! // Balanced mode - good speed with reasonable memory
//! let config = BatchConfig::balanced();
//!
//! // Memory efficient - minimal memory usage
//! let config = BatchConfig::memory_efficient();
//! ```
// Re-export main types at crate root
pub use ;
pub use ;
pub use BatchConfig;
pub use BatchError;
pub use ;
pub use BatchGenerator;
pub use ;
pub use ;
pub use SimdBatchProcessor;
pub use KeyStream;