Merge #926: Change extended key version bytes to BIP32

77613d9 Revert changing BIP32 version bytes to maintain existing Dash versions
6ce0d3e Change to BIP32 values
fe6174b Comments and add regnet EXT_COIN_TYPE
c874a0f Update testnet/regtest EXT_COIN_TYPE
This commit is contained in:
Andy Freer 2016-08-02 00:00:24 +02:00 committed by Holger Schinzel
parent 36c28fad1b
commit d2c6b2a74e
2 changed files with 43 additions and 41 deletions

View File

@ -133,10 +133,10 @@ public:
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,16);
// Dash private keys start with '7' or 'X'
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,204);
// Dash BIP32 pubkeys start with 'dpub'
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x02)(0xFD)(0xA9)(0x26).convert_to_container<std::vector<unsigned char> >();
// Dash BIP32 prvkeys start with 'dprv'
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x02)(0xFD)(0xA4)(0xEA).convert_to_container<std::vector<unsigned char> >();
// Dash BIP32 pubkeys start with 'xpub' (Bitcoin defaults)
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
// Dash BIP32 prvkeys start with 'xprv' (Bitcoin defaults)
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
// Dash BIP44 coin type is '5'
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80000005);
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
@ -236,17 +236,17 @@ public:
vSeeds.push_back(CDNSSeedData("dashdot.io", "testnet-seed.dashdot.io"));
vSeeds.push_back(CDNSSeedData("masternode.io", "test.dnsseed.masternode.io"));
// Testnet dash addresses start with 'y'
// Testnet Dash addresses start with 'y'
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
// Testnet dash script addresses start with '8' or '9'
// Testnet Dash script addresses start with '8' or '9'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
// Testnet private keys start with '9' or 'c' (Bitcoin defaults)
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
// Testnet dash BIP32 pubkeys start with 'DPUB'
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x3A)(0x59)(0xEA)(0x14).convert_to_container<std::vector<unsigned char> >();
// Testnet dash BIP32 prvkeys start with 'DPRV'
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x3A)(0x58)(0xF3)(0x42).convert_to_container<std::vector<unsigned char> >();
// Testnet dash BIP44 coin type is '5' (All coin's testnet default)
// Testnet Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
// Testnet Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
// Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80000001);
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
@ -341,16 +341,18 @@ public:
0,
0
};
// Regtest dash addresses start with 'y'
// Regtest Dash addresses start with 'y'
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
// Regtest dash script addresses start with '8' or '9'
// Regtest Dash script addresses start with '8' or '9'
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
// Regtest private keys start with '9' or 'c' (Bitcoin defaults)
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
// Regtest dash BIP32 pubkeys start with 'DPUB'
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x3A)(0x59)(0xEA)(0x14).convert_to_container<std::vector<unsigned char> >();
// Regtest dash BIP32 prvkeys start with 'DPRV'
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x3A)(0x58)(0xF3)(0x42).convert_to_container<std::vector<unsigned char> >();
// Regtest Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
// Regtest Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
// Regtest Dash BIP44 coin type is '1' (All coin's testnet default)
base58Prefixes[EXT_COIN_TYPE] = boost::assign::list_of(0x80000001);
}
};
static CRegTestParams regTestParams;

View File

@ -38,44 +38,44 @@ struct TestVector {
TestVector test1 =
TestVector("000102030405060708090a0b0c0d0e0f")
("dpubZ9169KDAEUnyoBhjjmT2VaEodr6pUTDoqCEAeqgbfr2JfkB88BbK77jbTYbcYXb2FVz7DKBdW4P618yd51MwF8DjKVopSbS7Lkgi6Y7Ckb8",
"dprvLJcNFzfZn6ywEjid4Ver3tsK3puSZFZr3oxCtC1cPdxVsZzjQwGPHvpLxZ83zP37V35uVQNG7GYHjxtkEUWhUKrFTt1bEj49EvPzRfWNPQH",
("xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8",
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
0x80000000)
("dpubZBGW92WdKjuxwnqSwXKfNcLuxffArXhpWof4cw4ie3Db32UJ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Dz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76",
0);
TestVector test2 =
TestVector("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542")
("dpubZ9169KDAEUnynoD4qvXJwmxZt3FFA5UdWn1twnRReE9AxjCKJLNFY1uBoegbFmwzA4Du7yqnu8tLivhrCCH6P3DgBS1HH5vmf8MpNZPvMv6",
"dprvLJcNFzfZn6ywEMDxAej8W6b5J23sEspfjPjwB8kSN25NAZ1vb63KipywJcu7AtbCj5qLEgpiPNaUqVcrGtuQ5hB1vJ5qP4xspB2Dndk4mqU",
("xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB",
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
0)
("dpubZCGqR2u7iVd4K4oMyhuC1aN6EzzVs3xv4wmG7bSsie18eheHsbiKgrUSP7eV3rxRNNi4zCqYJDjJt68Y5LyWidsxTUjxBS59ncUUoiV7Hou",
"dprvLMt7XiMXG7p1kcpFJS71Ztzbeyo7wrJxHZVJLwmtSRwKrXTuAMPPsfZBt8AuoxS38k5A8hESpXzcC1FfqBQT1vLQvUVtmZ8cwavn9q2tk8V",
("xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH",
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwS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F2K3wAX24mNhJaHzMteW2Qirnae83QEpKQRztTBRGRWA6FxyauCLkVtW3SxqHTfTkWm4ry8PSTHYGSJuoMXNrtYkhZTfLdWhK",
("xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL",
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2VbFWc",
2)
("dpubZJmvx44SPcNJcm7AvMzdo843H56Np2bTAQgRpZ4t9pEoJNQR4JX7VuxWYMHWvR8xDZx2Z7MWAsoamdUnH8gzjjMXVuiSFN9X8Hgo6Zfpw3T",
"dprvLUPD4jWqwEZG4K84F6CTMSgYh3tztpwVP2QU3uPtscAzWCE2M4CBgj3G3PFuMMqZvouBFavH7ZbCockUrhogLX1A7mJranzcF837YG1usdU",
("xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt",
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
0);
void RunTest(const TestVector &test) {