Skip to content

[Wallet] Simple HD/BIP32 support#7273

Closed
jonasschnelli wants to merge 3 commits intomasterfrom
2016/01/hdsimple
Closed

[Wallet] Simple HD/BIP32 support#7273
jonasschnelli wants to merge 3 commits intomasterfrom
2016/01/hdsimple

Conversation

@jonasschnelli
Copy link
Contributor

Most simplest HD feature.

  • Use BIP32/hd key derivation by default for new wallets (m/0'/0')
  • Only private key derivation is supported (no pubkey-only-wallets for now)
  • No on the fly generation of private keys (keypools get still refilled, all derived private keys are touching the database, but deterministic)
  • Internal support for multiple hd keychains (potential allows simple key rotation feature)
  • Supports encrypted wallets
  • RPC- and unit-tests included
  • Currently now way to create a hd keychain for existing wallets (upcoming feature if/once this got merged)

ment as a starting point, have concrete plans to extend this, but don't want to overload this PR

getnewaddress "" true (last parameter true = "show details") returns an object if the new address was hd derived:

{
  "address": "n1EU7TC4YqVYGQYy5eav1APHhS3z3Jrgf4",
  "keypath": "m/0'/230'"
}

(same for getaddressesbyaccount)

@jonasschnelli jonasschnelli added this to the 0.13.0 milestone Jan 2, 2016
@jonasschnelli
Copy link
Contributor Author

The main benefits of this PR:

  • A wallet.dat backup, regardless of it's age, can be used to recover all private keys.
  • Basic groundwork for detaching the private-keys from the wallet (allow signing over hardware wallets, etc.)

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link

Choose a reason for hiding this comment

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

Riky

Copy link

Choose a reason for hiding this comment

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

Riky

@jgarzik
Copy link
Contributor

jgarzik commented Jan 2, 2016

concept ACK

Copy link
Member

Choose a reason for hiding this comment

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

Typo? Achive -> Active?

@luke-jr
Copy link
Member

luke-jr commented Jan 15, 2016

Note to test: If encrypting wallet fails for any reason at any late stage, the wallet should retain all unencrypted data.

Copy link
Member

Choose a reason for hiding this comment

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

Return value is ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link

Choose a reason for hiding this comment

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

Oky

Copy link

Choose a reason for hiding this comment

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

Oky

Copy link

Choose a reason for hiding this comment

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

Oky

Copy link

Choose a reason for hiding this comment

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

Oky

Copy link

Choose a reason for hiding this comment

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

Oky

Copy link

Choose a reason for hiding this comment

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

Oky

@pointbiz
Copy link

Concept ACK

src/init.cpp Outdated
Copy link
Member

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.

Copy link
Contributor Author

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.

@jonasschnelli
Copy link
Contributor Author

Rebased and fixed reported nits.

return false;

Erase(std::make_pair(std::string("hdmasterseed"), hash));
Erase(std::make_pair(std::string("hdmasterseed"), hash));
Copy link
Member

Choose a reason for hiding this comment

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

double deletion?

@jonasschnelli
Copy link
Contributor Author

Rebased and fixed some nits.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants