Skip to content

Conversation

@hackerby888
Copy link
Contributor

-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)

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)];
Copy link
Contributor

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;
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants