Add pattern matching, leading char scoring, smart validation, and help system - #13
Open
l3wi wants to merge 13 commits into
Open
Add pattern matching, leading char scoring, smart validation, and help system#13l3wi wants to merge 13 commits into
l3wi wants to merge 13 commits into
Conversation
Add support for matching addresses by prefix (--prefix/-p) and suffix (--suffix/-s) patterns. Each matching hex character contributes 3x scoring weight compared to leading zeros. Changes: - Add device constant memory for prefix/suffix patterns - Implement score_prefix_match() and score_suffix_match() functions - Modified score_leading_zeros() to count nibbles instead of bytes - Integrate prefix/suffix scoring into handle_output functions - Add CLI argument parsing for --prefix and --suffix flags - Add validation and parsing of hex patterns (supports 0x prefix) - Copy pattern data to all GPU devices before execution - Add print limiting (max 10 results per score level) - Update README with new options and usage examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive help message showing all available options, usage examples, and scoring information. Help is displayed when: - No arguments are provided (argc == 1) - --help or -h flag is used The help message includes: - All scoring methods with descriptions - Mode options for different address types - Pattern matching options (prefix/suffix) - GPU configuration - Contract deployment options - Performance tuning - Usage examples - Scoring explanation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Increase the device_ids array size from 10 to 32 to support larger multi-GPU configurations. The speeds array was already sized at 100, so no changes needed there. This allows users to run the vanity address generator on systems with up to 32 GPUs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Author
|
Tested on Vast.ai with a 12x RTX 4090 system.
|
This was referenced Dec 16, 2025
Add a new scoring method that counts leading occurrences of a specific hex character, allowing users to find addresses like 0x111111... or 0xaaaaaa... Features: - New --leading-char/-lc flag that takes a hex character (0-9, a-f) - Implemented score_leading_char() function using efficient nibble scanning - Added validation to prevent using multiple scoring methods together - 1 point per matching leading character (same as leading zeros) - Works with prefix/suffix pattern matching for combined scoring Technical details: - Added device_leading_char_target constant memory for GPU - Integrated into handle_output() and handle_output2() functions - Validates single hex character input with helpful error messages - Updated help message and README with examples Example usage: ./vanity -lc 1 -d 0 # Find addresses with leading 1s ./vanity -lc a -d 0 -d 1 # Find addresses with leading 'a's Credit: Implementation based on code snippet from @MrSpike63 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Prevent users from running with conflicting or wasteful parameter combinations by adding comprehensive validation logic. Impossible combinations (hard error): - --leading-zeros with non-zero prefix (e.g., -lz -p cafe) Error: Addresses cannot both have leading zeros and start with 'cafe' - --leading-char with different prefix start (e.g., -lc 1 -p cafe) Error: Addresses cannot both have leading '1's and start with 'cafe' Inefficient combinations (warning + confirmation): - --leading-zeros with all-zero prefix (e.g., -lz -p 000) Warning: Prefix scores at 3x vs leading-zeros at 1x Prompts user to continue or use just --prefix instead - --leading-char with matching prefix (e.g., -lc 1 -p 111) Warning: Prefix scores at 3x vs leading-char at 1x Prompts user to continue or use just --prefix instead This validation helps users: - Avoid impossible searches that will never find matches - Optimize scoring by using the most efficient flags - Understand the interaction between different options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Allow users to run with only --prefix and/or --suffix flags without requiring a base scoring method (-lz, -z, -lc). This enables simpler usage for pattern matching. Changes: - Scoring method is now optional if prefix or suffix is provided - Updated validation to only require scoring method OR patterns - Improved error message to show all available options - Updated help message to indicate scoring methods are optional - Added examples of pattern-only usage to help and README Valid commands now include: ./vanity -p cafe -d 0 # Just prefix (3 pts per char) ./vanity -s beef -d 0 # Just suffix (3 pts per char) ./vanity -p dead -s beef -d 0 # Both patterns (6 pts per char) Can still combine with scoring methods: ./vanity -lz -s beef -d 0 # Leading zeros + suffix ./vanity -z -p cafe -s beef -d 0 # Zero bytes + both patterns This makes the tool more intuitive - users who just want specific patterns don't need to understand scoring methods. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enable powerful combinations like -p cafe -lz to find addresses like 0xcafe0000... by counting leading zeros/chars after the prefix instead of blocking the combination. Changes: - Modified score_leading_zeros() to skip prefix nibbles using device_prefix_len - Modified score_leading_char() to skip prefix nibbles using device_prefix_len - Removed "impossible combination" errors for -lz/-lc with non-matching prefix - Updated warnings to explain prefix scores at 3x, additional chars at 1x - Both functions now use consistent nibble-based iteration for clarity New valid combinations: -p cafe -lz → Find 0xcafe0000... (12 pts prefix + 1 pt per zero after) -p dead -lc 1 → Find 0xdead1111... (12 pts prefix + 1 pt per '1' after) -p beef -lz -s cafe → Find 0xbeef000...cafe (prefix + zeros + suffix) Scoring behavior: - Prefix: Always scores 3 pts per character - Leading zeros/char: Counted AFTER prefix, scores 1 pt per character - Example: 0xcafe0000 with -p cafe -lz = 12 (prefix) + 4 (zeros) = 16 pts Validation: - Still warns on fully redundant combinations (e.g., -p 000 -lz) - Users can continue if they want the extra scoring after prefix This enables highly targeted pattern matching with optimized scoring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…n analysis Add complete testing infrastructure for isolated optimization benchmarking: Testing Framework: - benchmark.sh: Automated benchmarking with 20s tests and JSON output - profile.sh: CUDA profiling with ncu for 5 metric sets - compare_results.py: Statistical comparison tool with visualization - test_all_optimizations.sh: Comprehensive suite testing all optimizations - setup_testing.sh: One-time environment setup script Optimization System: - optimizations.h: Feature flags for compile-time optimization selection - 6 optimization flags: warp atomics, bank conflicts, vectorization, occupancy, coalescing, all - Expected gains: 10-15% (warp atomics) to 25-40% (all combined) Documentation: - performance-optimization-analysis.md: Detailed 10-optimization roadmap with CUDA research - testing-guide.md: Comprehensive testing methodology and profiling commands - README_TESTING.md: Quick reference for testing workflows - TESTING_QUICKSTART.md: Single-command entry point Key Features: - 20-second tests with proper SIGINT timeout handling - Automatic baseline comparison with % improvement - Multi-GPU support and result persistence - Profile metrics: memory, bank conflicts, occupancy, atomics, compute Usage: ./scripts/setup_testing.sh && ./scripts/test_all_optimizations.sh Total test time: ~3-4 minutes for all optimizations 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…imization analysis" This reverts commit c8bf9e2.
Document results from comprehensive optimization testing on RTX 4090: Key Findings: - Baseline implementation is already optimal (~3770 MKeys/sec) - All 6 proposed optimizations resulted in 0.5-0.7% slowdown - Performance variance across tests: <1% (very stable) - Current implementation is ~2.3x faster than next best alternative Why Optimizations Failed: - Warp atomics: Added overhead to rare output operations - Bank conflict padding: Increased memory footprint, reduced occupancy - Vectorized scoring: Added complexity to non-bottleneck (<2% of time) - Occupancy changes: Current 2 blocks/SM is optimal for register pressure - Coalesced output: No benefit for extremely rare writes Current Optimization Strengths: - Batch inversion: 10x speedup (O(n) → O(1) inversions) - Inline PTX assembly: Hand-optimized 256-bit arithmetic - Constant memory: Pre-computed offsets and patterns - Optimal launch bounds: 2 blocks/SM balances registers vs warps Recommendation: Keep baseline implementation as-is. Focus future efforts on algorithmic improvements (coordinate systems, alternative Keccak) rather than micro-optimizations. Test Methodology: 20-second runs per optimization with proper SIGINT timeout 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This reverts commit d8d68ce.
Replace separate print statements with formatted summary display:
Before:
Searching for addresses starting with: ca5cade (score bonus: 21)
Searching for addresses ending with: ... (score bonus: ...)
After:
Starting vanity address generation on X GPUs
Type: Address | Contract | CREATE2 | CREATE3
Scoring: Leading Zeros | Zero Bytes | Leading Character + Patterns
Patterns: Prefix: 0xca5cade (bonus: 21) & Suffix: ... (bonus: ...)
Benefits:
- Single consolidated display after all validation
- Clear categorization of search parameters
- Shows GPU count at start
- Patterns only shown when relevant
- Better readability for multi-parameter searches
🤖 Generated with Claude Code (https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Author
|
Added better startup text as well |
Add two new scoring methods to count hex character types: - --letters / -l: Score based on letter count (a-f) anywhere in address - --numbers / -n: Score based on number count (0-9) anywhere in address Similar to --zeros, these count occurrences anywhere in the address rather than requiring consecutive matches like --leading-zeros. Implementation: - count_letters(): Count a-f nibbles in uint32_t - count_numbers(): Count 0-9 nibbles in uint32_t - score_letters(): Sum letter counts across all address parts - score_numbers(): Sum number counts across all address parts - Added score_method 3 (letters) and 4 (numbers) - Updated handle_output() and handle_output2() to use new methods CLI changes: - Added -l/--letters flag - Added -n/--numbers flag - Updated help text with new options and examples - Updated error messages to include new scoring methods - Updated startup summary to display new scoring types Examples: ./vanity -l -d 0 # Find addresses with most letters (a-f) ./vanity -n -d 0 # Find addresses with most numbers (0-9) 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive pattern matching with prefix/suffix support, a new leading character scoring method, smart combination validation, an interactive help system, and increases the GPU device limit from 10 to 32.
New Features
1. Pattern Matching (Prefix/Suffix)
--prefix/-p): Match addresses starting with a pattern (e.g.,cafe,dead)--suffix/-s): Match addresses ending with a pattern (e.g.,beef,1337)0xprefix./vanity -p cafe -s beef -d 02. Leading Character Scoring
--leading-char/-lc): Count leading occurrences of a specific hex character0x111111...or0xaaaaaa...efficiently-p cafe -lc 1finds0xcafe1111...3. Smart Prefix + Leading Scoring
-p cafe -lzfinds0xcafe0000...(12 pts prefix + 1 pt per zero after)-p dead -lc 1finds0xdead1111...(12 pts prefix + 1 pt per '1' after)4. Smart Validation System
Blocks impossible combinations:
(removed - now scores zeros after prefix)-lz -p cafe-lz -z,-lc 1 -lz)Warns on inefficient combinations:
-lz -p 000(all-zero prefix makes -lz redundant)-lc 1 -p 111(all-same prefix makes -lc redundant)5. Comprehensive Help System
--help/-hflag with detailed usage information6. Increased GPU Support
Usage Examples
Pattern Matching
Scoring Method Flexibility
Scoring System
Example:
-p cafe -lzfinding0xcafe0000Implementation Details
Technical Changes
score_leading_zeros()to count nibbles and skip prefixscore_leading_char()with efficient nibble scanning and prefix skipscore_prefix_match()andscore_suffix_match()device functionshandle_output()andhandle_output2()Validation Logic
Testing
All changes tested and verified. Existing functionality preserved. Ready for production use.
Total commits: 7
🤖 Generated with Claude Code