-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[Wallet] Simple HD/BIP32 support #7273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The main benefits of this PR:
|
print "encrypt wallet" | ||
self.nodes[0].encryptwallet("test") | ||
bitcoind_processes[0].wait() | ||
del bitcoind_processes[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Is there a compelling reason to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encrypting the wallet does stop the process,... i think this is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Riky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Riky
concept ACK |
bool WriteHDCryptedMasterSeed(const uint256& hash, const std::vector<unsigned char>& vchCryptedSecret); | ||
bool EraseHDMasterSeed(const uint256& hash); | ||
bool WriteHDChain(const CHDChain& chain); | ||
bool WriteHDAchiveChain(const uint256& hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? Achive -> Active?
Note to test: If encrypting wallet fails for any reason at any late stage, the wallet should retain all unencrypted data. |
EncryptSeeds(vMasterKeyIn); | ||
|
||
std::vector<HDChainID> chainIds; | ||
GetAvailableChainIDs(chainIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return value is ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oky
Concept ACK |
@@ -395,6 +395,8 @@ std::string HelpMessage(HelpMessageMode mode) | |||
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE)); | |||
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)"), | |||
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE))); | |||
strUsage += HelpMessageOpt("-usehd", _("Use hierarchical deterministic key derivation (HD wallets) (default: true)")); | |||
strUsage += HelpMessageOpt("-hdseed", _("Use the given 256bit (64 char hex) as HD master seed (default: <generate random seed>)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should make this clear it only happens upon first run of the wallet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should make this clear it only happens upon first run of the wallet.
I agree, -hdseed
as startup parameter is somehow not ideal. Not seeding the wallet at first start, would require an additional rpc command (something generatehdwallet
, seedwallet
, etc.).
Or an additional "bitcoin-wallet
" tool that could allow generating and manipulating wallet.dat files.
But because I fear lack of reviewer, I don't want to make this PR more complex for now.
42d2a1a
to
915b69d
Compare
Rebased and fixed reported nits. |
return false; | ||
|
||
Erase(std::make_pair(std::string("hdmasterseed"), hash)); | ||
Erase(std::make_pair(std::string("hdmasterseed"), hash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double deletion?
- master seeds are kept seperated and can be encrypted
915b69d
to
3494217
Compare
Rebased and fixed some nits. |
Concept ACK. I think on-ramping users to this safely/transparently will be the most difficult part. Warning users that the flag they've set can't be properly used until a new wallet is created(or some migration happens) is a must imo. There needs to be a tool/process to help with that migration, most likely with a backup/cloning step. |
@jonasschnelli Is it ok to delete the |
I deleted the branch. There is still some useful stuff in this branch (thinks like child key derivation by keypath-string) that could be re-used later. |
Most simplest HD feature.
ment as a starting point, have concrete plans to extend this, but don't want to overload this PR
getnewaddress "" true
(last parametertrue
= "show details") returns an object if the new address was hd derived:(same for
getaddressesbyaccount
)