I was trying to find how to define address prefixes (like in XDN or Cryptonotecoin), but couldn't find any tools for that. Here's my solution. You may add the following code lines to any of existing Cryptonote coins (as Cryptonote forking repo won't compile due to empty constants).
1) Update CMakeList.txt:
+file(GLOB_RECURSE PREFIXGENERATOR prefixgenerator/*)
+add_executable(prefixgenerator ${PREFIXGENERATOR})
+target_link_libraries(prefixgenerator crypto common ${Boost_LIBRARIES})
2) Add a new file /src/prefixgenerator.cpp
#include
#include
#include "common/base58.h"
int main(int argc, char** argv) {
if (argc > 1) {
std::string s = argv[1];
for (uint64_t i = 0; i < (uint64_t)(-1); i++) {
std::string r = tools::base58::encode_addr(i, "test");
if (s == r.substr(0, s.size()))
std::cout << r << " 0x" << std::hex << i << std::dec << std::endl;
}
} else {
for (uint64_t i = 0; i < (uint64_t)(-1); i++) {
std::string r = tools::base58::encode_addr(i, "test");
std::cout << r << " 0x" << std::hex << i << std::dec << std::endl;
}
}
return 0;
}
3) Compile the updated repo
4) Run the util with the desired prefix:
./prefixgenerator PREFIX_YOU_WANT
or get all possible prefixes and grep the one you need:
./prefixgenerator | grep -E "REGEXP"
What the util does is trying every possible input to get you the prefix you wish to have. I hope this will help someone.
Thank you for your contribution! Your solution should be working, but it doesn't suit CryptoNote Starter repo well as it is quite complicated. Hence, we've implemented address prefix generator on
You may also find calculator for your coin emission speed compared to bitcoin's emission.