wallet(HD): native BIP39/BIP32 HD wallet - daemon side
Adds deterministic HD key derivation (path m/44'/2222'/0'/0/i, matching the TRIdock web wallet) wired into CWallet: HD seed stored in wallet.dat (encrypted with the wallet master key when the wallet is encrypted), keypool derived from the seed, and new RPC commands hdnew/hdrestore/hdshow/hdinfo. Crypto core verified standalone against the official BIP39 vector and triWallet.js addresses.
This commit is contained in:
+20
-1
@@ -429,6 +429,24 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
|
||||
|
||||
}
|
||||
else if (strType == "hdmnemonic")
|
||||
{
|
||||
std::string m;
|
||||
ssValue >> m;
|
||||
pwallet->LoadHDMnemonic(m);
|
||||
}
|
||||
else if (strType == "hdcmnemonic")
|
||||
{
|
||||
std::pair<uint256, std::vector<unsigned char> > cm;
|
||||
ssValue >> cm;
|
||||
pwallet->LoadCryptedHDMnemonic(cm.first, cm.second);
|
||||
}
|
||||
else if (strType == "hdchain")
|
||||
{
|
||||
int64_t n;
|
||||
ssValue >> n;
|
||||
pwallet->nHDChainIndex = n;
|
||||
}
|
||||
else if (strType == "version")
|
||||
{
|
||||
ssValue >> wss.nFileVersion;
|
||||
@@ -461,7 +479,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
static bool IsKeyType(string strType)
|
||||
{
|
||||
return (strType== "key" || strType == "wkey" ||
|
||||
strType == "mkey" || strType == "ckey");
|
||||
strType == "mkey" || strType == "ckey" ||
|
||||
strType == "hdmnemonic" || strType == "hdcmnemonic");
|
||||
}
|
||||
|
||||
DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
||||
|
||||
Reference in New Issue
Block a user