I want to know how the prefixes for EXT_PUBLIC_KEY and EXT_PRIVATE_KEY are derived. For example in bitcoin you have:

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,128);
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};

And I another cryptocurrency has:

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,25); 
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
base58Prefixes[SECRET_KEY]     = std::vector<unsigned char>(1,153); // 25 + 128
base58Prefixes[SECRET_KEY_OLD] = std::vector<unsigned char>(1,151);
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x1E)(0x56)(0x2D)(0x9A).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = list_of(0x1E)(0x56)(0x31)(0xBC).convert_to_container<std::vector<unsigned char> >();

Im trying to make a server that generates addresses from the Extended public key without exposing the private key on the latter cryptocurrency but I've been running into some problems. I want to understand how the EXT_PUBLIC_KEY is derived as for the development and how it is used to generate addresses. I'm trying to implement it into pywallet (https://github.com/ranaroussi/pywallet) but it seems to not support this kind of EXT_PUBLIC_KEY

  • Are you asking about the prefixes or the actual keys themselves? The code you posted is related to the prefixes and not at all anything to do with key derivation. – Andrew Chow Jun 24 '20 at 20:19
  • Sorry, the question has been edited. I was asking about the prefixes – MisterSir Jun 25 '20 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.