A key generator for MeshCore nodes that creates Ed25519 keypairs with custom patterns. This tool generates MeshCore-compatible Ed25519 keys with various cosmetic patterns for personalized node identification.
-
MeshCore-Compatible: Generates Ed25519 keys in the exact format MeshCore expects
-
Multiple Pattern Modes: Support for various cosmetic pattern matching modes
-
Multi-Processing: Multi-processor support with smart thread management (75% of cores on all platforms)
-
Manual Worker Control: Override auto-detection with
--workersoption -
Health Monitoring: Automatic performance monitoring and worker restart
-
Watchlist Support: Monitor for additional patterns while searching
-
Flexible Output: Save keys in text or JSON format for MeshCore app import
-
Progress Bars: Visual progress tracking with tqdm (when not in verbose mode)
-
Verbose Mode: Control output detail level with
--verboseoption -
Memory Management: Configurable garbage collection and memory monitoring
- Python 3.7 or higher
- pip (Python package manager)
Option A: Basic installation (CPU-only, recommended for Windows):
pip install -r requirements-basic.txtManual installation:
pip install PyNaCl
pip install tqdm # Required for progress bars
pip install psutil # Optional, for enhanced health monitoring# Generate a key with default 8-char pattern
python meshcore_keygen.py
# Search for keys starting with specific hex prefix
python meshcore_keygen.py --first-two F8
# Generate key with 4-char pattern
python meshcore_keygen.py --pattern-4
# Search for keys with specific prefix
python meshcore_keygen.py --prefix F8A1
# Run for specific number of keys
python meshcore_keygen.py --keys 100 # 100 million keys
# Run for specific time
python meshcore_keygen.py --time 2 # 2 hours
# Enable verbose output for detailed progress
python meshcore_keygen.py --verbose # Show per-worker details (disables progress bar)
python meshcore_keygen.py -v # Short form for verbose modeSearch for keys starting with specific hex characters:
python meshcore_keygen.py --simple --first-two F8Search for keys starting with a specific hex prefix:
python meshcore_keygen.py --prefix F8A1
python meshcore_keygen.py --prefix F8
python meshcore_keygen.py --prefix ABCDEFSearch for keys where first N hex characters match last N hex characters:
# 2-char cosmetic pattern (first 2 == last 2 OR palindromic)
python meshcore_keygen.py --pattern-2
# 4-char cosmetic pattern (first 4 == last 4 OR palindromic)
python meshcore_keygen.py --pattern-4
# 6-char cosmetic pattern (first 6 == last 6 OR palindromic)
python meshcore_keygen.py --pattern-6
# 8-char cosmetic pattern (first 8 == last 8 OR palindromic) - DEFAULT
python meshcore_keygen.py --pattern-8Combine prefix with cosmetic pattern matching:
# Prefix + 8-char cosmetic pattern (default)
python meshcore_keygen.py --prefix F8 --pattern-8
# Prefix + 4-char cosmetic pattern
python meshcore_keygen.py --prefix F8 --pattern-4
# Prefix + 2-char cosmetic pattern
python meshcore_keygen.py --prefix F8 --pattern-2Note: --prefix can also be used alone to search for keys starting with a specific hex prefix without requiring a cosmetic pattern.
Legacy mode with optional first-two constraint:
python meshcore_keygen.py --four-char
python meshcore_keygen.py --four-char --first-two F8Control the number of worker processes:
python meshcore_keygen.py --workers 4 # Use 4 worker processes
python meshcore_keygen.py --workers 8 # Use 8 worker processesDefault: Auto-detects optimal count (75% of available CPU cores on all platforms, performance cores on Apple Silicon)
Control the batch size for worker processes:
python meshcore_keygen.py --batch-size 500K # 500K keys per batch
python meshcore_keygen.py --batch-size 2M # 2M keys per batchEnable or disable health monitoring:
python meshcore_keygen.py --health-check # Enable (default)
python meshcore_keygen.py --no-health-check # DisableControl how progress is displayed:
# Default: Progress bar with consolidated updates (when tqdm is available)
python meshcore_keygen.py --first-two F8
# Verbose mode: Detailed per-worker output (disables progress bar)
python meshcore_keygen.py --verbose # Enable verbose mode (per-worker details)
python meshcore_keygen.py -v # Short form for verbose modeMonitor for additional patterns while searching for your primary target:
# Use custom watchlist file
python meshcore_keygen.py --watchlist patterns.txt
# Auto-loads watchlist.txt if it exists in the same directory
python meshcore_keygen.py --first-two F8Create a watchlist.txt file with patterns to monitor:
# Watchlist patterns (one per line)
ABCD...EFGH # First 4 chars and last 4 chars
ABCD...ABCDEFGH # First 4 chars and last 8 chars
ABCDEFGH...ABCD # First 8 chars and last 4 chars
ABCD...EFGH|My cool pattern # With optional description
# This is a comment line
Keys are saved as separate text files:
meshcore_XXXXXXXX_public.txt- Public keymeshcore_XXXXXXXX_private.txt- Private key
Save keys in JSON format for MeshCore app import:
python meshcore_keygen.py --pattern-4 --jsonTest against known MeshCore keys:
python meshcore_keygen.py --test-compatibilityTest distribution of first two hex characters:
python meshcore_keygen.py --test-distribution 0.1 # 100K keysTest randomness and entropy:
python meshcore_keygen.py --test-entropy 10 # 10K keysTest MeshCore node ID format:
python meshcore_keygen.py --test-meshcore-id 1 # 1K keyspython meshcore_keygen.py --prefix F8This will search for keys starting with "F8".
python meshcore_keygen.py --prefix ABCDEFThis will search for keys starting with "ABCDEF" (6-character prefix).
python meshcore_keygen.py --first-two F8This will search for keys where the first two hex characters are "F8" (same as --prefix F8 for 2-character prefixes).
python meshcore_keygen.py --pattern-4This will search for keys where the first 4 hex characters match the last 4 hex characters.
python meshcore_keygen.py --prefix F8 --pattern-8This will search for keys starting with "F8" AND having an 8-char cosmetic pattern.
python meshcore_keygen.py --prefix ABCDEF --pattern-4This will search for keys starting with "ABCDEF" AND having a 4-char cosmetic pattern.
python meshcore_keygen.py --pattern-6 --time 2 --health-checkThis will search for 6-char cosmetic pattern keys for 2 hours with health monitoring enabled.
python meshcore_keygen.py --prefix F8 --workers 4 --keys 1This will search for keys starting with "F8" using 4 worker processes instead of the auto-detected optimal count.
python meshcore_keygen.py --first-two F8 --watchlist my_patterns.txtThis will search for keys starting with "F8" while also monitoring patterns in my_patterns.txt.
python meshcore_keygen.py --pattern-6 --verboseThis will search for 6-char cosmetic pattern keys with detailed per-worker progress and health monitoring information.
python meshcore_keygen.py --first-two F8This will search for keys starting with "F8" with clean, consolidated progress updates every 5 seconds.
- Visual progress bar showing current progress, rate, and estimated time remaining
- Consolidated progress updates every 5 seconds showing total attempts, rate, and elapsed time
- Key finds reported immediately when discovered
- Watchlist matches reported immediately when found
- Clean output for focused operation
- Per-worker progress updates with individual rates and ETAs
- Health monitoring details including memory/CPU usage
- Batch completion reports for each worker
- Performance degradation warnings
- Worker restart notifications
- Garbage collection information
When a matching key is found, the script will:
- Display the key information
- Verify the key compatibility
- Save the keys to files
- Show the MeshCore node ID
Example output:
Default Mode Progress:
Progress: 15,234,567 total attempts | 6,688 keys/sec | 2,278.5s elapsed
Verbose Mode Progress:
Worker 0: 3,234,567 attempts | 6,688 keys/sec | 483.7s | ETA: 2.1h
Worker 1: 3,245,678 attempts | 6,712 keys/sec | 483.7s | ETA: 2.1h
Worker 2: 3,256,789 attempts | 6,745 keys/sec | 483.7s | ETA: 2.0h
Worker 3: 3,267,890 attempts | 6,678 keys/sec | 483.7s | ETA: 2.1h
Key Discovery (Both Modes):
SUCCESS! Found matching Ed25519 key!
Total time: 45.2s (0.8m)
============================================================
Generated MeshCore Ed25519 Key:
----------------------------------------
Matching Pattern: F8A1B2C3
First 8 hex: F8A1B2C3
Last 8 hex: D4E5F678
Public Key (hex):
f8a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef12
Private Key (hex):
305e0b1b3142a95882915c43cd806df904247a2d505505f73dfb0cde9e666c4d656591bb4b5a23b6f47c786bf6cccfa0c4423c4617bbc9ab51dfb6f016f84144
Key Verification: ✓ PASS
Keys saved to:
Public: meshcore_F8A1B2C3_public.txt
Private: meshcore_F8A1B2C3_private.txt
Node ID: F8
⚠️ Keep your private key secure and never share it!
✓ This Ed25519 key should now work with MeshCore!
- Private Key: 64 bytes (128 hex characters)
- First 32 bytes: Clamped Ed25519 scalar
- Last 32 bytes: Random filler
- Public Key: 32 bytes (64 hex characters)
- Generated using
crypto_scalarmult_ed25519_base_noclamp
- Generated using
The script uses the correct Ed25519 algorithm that MeshCore expects:
- Generate 32-byte random seed
- SHA512 hash the seed
- Manually clamp the first 32 bytes (scalar clamping)
- Use
crypto_scalarmult_ed25519_base_noclampto get public key - Private key =
[clamped_scalar][random_filler]
- Multi-processing: Automatically detects optimal number of CPU cores
- Batch Processing: Configurable batch sizes for resource usage
- Health Monitoring: Automatic worker restart on performance degradation
- Memory Management: Configurable garbage collection (every 2 minutes) and memory monitoring
- Output Control: Verbose mode for debugging, clean mode for standard use
- CPU: Multi-core processor recommended
- Memory: 2GB+ RAM recommended
- Storage: Minimal disk space for key files
- OS: Windows, macOS, or Linux
-
"psutil not installed" warning
- Install with:
pip install psutil - Health monitoring will work without it, but with limited features
- Install with:
-
Performance issues
- Try reducing batch size:
--batch-size 500K - Disable health monitoring:
--no-health-check - Use clean output mode (default) for better performance
- Try reducing batch size:
-
Memory usage
- The script automatically manages memory with configurable garbage collection
- Health monitoring will restart workers if memory usage is high
- Garbage collection frequency can be adjusted as needed
-
Too much output
- Use default mode for clean output
- Use
--verboseonly when debugging or monitoring performance
-
Watchlist performance impact
- Large watchlists can reduce performance by ~27%
- Consider using a smaller curated watchlist for better performance
- Run without watchlist for improved speed
-
Progress bar not showing
- Ensure tqdm is installed:
pip install tqdm
- Ensure tqdm is installed:
The script includes several test functions to verify functionality:
If you encounter issues:
- Check that all dependencies are installed
- Try running with
--test-compatibilityto verify installation - Use smaller batch sizes if experiencing performance issues
- Ensure you have sufficient system resources
- Use
--verbosemode to debug performance or health monitoring issues - Check the troubleshooting section above for common solutions
- Private keys are sensitive: Never share your private key
- Generated keys are random: Each run produces different results
- Backup your keys: Save generated keys in a secure location
- Test before use: Verify keys work with your MeshCore setup
This project is open source. Please ensure you comply with any applicable licenses for dependencies.
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
Note: This tool generates cosmetic pattern keys for MeshCore nodes. The generated keys are Ed25519 keypairs that are compatible with the MeshCore protocol.