-
Notifications
You must be signed in to change notification settings - Fork 43
add -generate-vanity-address feature #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
wallet_utils.cpp
Outdated
| thread_local std::uniform_int_distribution<int> dist(0, sizeof(charset) - 2); | ||
| std::string str(55, 0); | ||
| for (size_t i = 0; i < 55; ++i) { | ||
| str[i] = charset[dist(gen)]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's best practice to use rd() here (from std::random_device) . std::mt19937 is considered unsafe for seed generator.
| auto currentTime = std::chrono::high_resolution_clock::now(); | ||
| auto durationSinceLastPrint = std::chrono::duration_cast<std::chrono::seconds>(currentTime - lastPrintTime).count(); | ||
| if (durationSinceLastPrint >= 1) { | ||
| lastPrintTime = currentTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can have data-race, if possible, just do the print on thread #0 only
-generate-vanity-address <EXPECTED_CHARS> <IS_SUFIX>
Generates a vanity address matching the expected characters using multiple threads, with an option to match as a suffix.
Example: ./qubic-cli -generate-vanity-address ABC 1 false (will generate an address starting with ABC)
./qubic-cli -generate-vanity-address XYZ 4 true (will generate an address ending with XYZ using 4 threads)