Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

Adds a new database record ("hdpubkey") reflected by class CHDPubKey.

  • Results in no longer storing derived child private keys in the database
  • Only the extended child public key will be stored
  • If the private key gets requested, it will be derived on the fly

Dump functions are unchanged, will result in deriving the keys on the fly.
Not backward compatible. Ideally combined with HD chain split #9294.

@jonasschnelli jonasschnelli added this to the 0.14.0 milestone Dec 7, 2016
@instagibbs
Copy link
Member

Can you explain a bit of motivation for this?

@jonasschnelli
Copy link
Contributor Author

Can you explain a bit of motivation for this?

Sure. Sorry for leaving that out in the main description.

1.) Reduce amount of stored data in wallet.dat
2.) Don't expose each child private key in wallet.dat
3.) Lays groundwork for public key derivation in conjunction with a signing device.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here should be different compared to the FEATURE_HD.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPC added to the already translated string? Yes/No here?

@maflcko
Copy link
Member

maflcko commented Dec 8, 2016 via email

@jonasschnelli
Copy link
Contributor Author

I think this means salvagewallet no longer works for hd wallets as it
previously did.

Right. This is a good point.
However, I think we should do the following also for "normal" wallets.

  1. We already recover the hdchain (child key counter, private key id thats used for the HD master key).
  2. Don't abort if a privat-key is corrupted, instead...
  3. Recreate all keys up to the child-key-counter (CHDChain object)

Before implementing this, I think some Concept ACKs/NACKs would be required.
@sipa, @gmaxwell: thoughts?

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonasschnelli Still interested in pushing this forward?

Needs rebase.

Should have a test.

assert(secret.VerifyPubKey(pubkey));

// store metadata
mapKeyMetadata[pubkey.GetID()] = metadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could stay in GenerateNewKey?


// store metadata
mapKeyMetadata[pubkey.GetID()] = metadata;
if (!nTimeFirstKey || metadata.nCreateTime < nTimeFirstKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After rebase use UpdateTimeFirstKey(). Also could stay in GenerateNewKey?


bool CWallet::LoadHDPubKey(const CHDPubKey &hdPubKey)
{
AssertLockHeld(cs_wallet); // mapKeyMetadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong comment.


bool CWallet::AddHDPubKey(const CExtPubKey &extPubKey)
{
AssertLockHeld(cs_wallet); // mapKeyMetadata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong comment.

@sipa
Copy link
Member

sipa commented Mar 6, 2018

@jonasschnelli I think this is generally the direction to go in, and it's also part of what my idea for refactoring accomplishes in a different way (https://gist.github.com/sipa/125cfa1615946d0c3f3eec2ad7f250a2). Do you think this is worth pursuing on its own?

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 8, 2018

There hasn't been much activity lately and the patch still needs rebase, so I am closing this for now. Please let me know when you want to continue working on this, so the pull request can be re-opened.

@DrahtBot DrahtBot closed this Nov 8, 2018
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants