Skip to content

Conversation

@achow101
Copy link
Member

@achow101 achow101 commented Aug 22, 2018

This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using importmulti. This allows the walletprocesspsbt to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet.

In order to make this easier to use, a new field hdmasterkeyfingerprint has been added to getaddressinfo. Additionally I have removed hdmasterkeyid as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. CKeyMetadata has also been extended to store key origin info to facilitate this.

@instagibbs
Copy link
Member

Nice! strong concept ACK

@achow101
Copy link
Member Author

Fixed a bug where the keymetadata wasn't being written to the wallet file. Also added a test for that case.

@achow101
Copy link
Member Author

Rebased and also changed the keymeta stuff to add the hd master key id at key generation and when the wallet is first loaded.

Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member

Choose a reason for hiding this comment

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

why not? This is quite standard.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's fairly standard to use h or H as the indicator, not just '. In fact, the BIP uses H, but as a subscript. ' is not actually used as the indicator for hardened in the BIP even though that is what everyone uses.

The main reason for allowing this is so that you don't have to do any annoying escaping stuff for the ' when entering the keypaths on the command line.

@achow101
Copy link
Member Author

achow101 commented Sep 4, 2018

Rebased

@laanwj
Copy link
Member

laanwj commented Sep 13, 2018

Concept ACK, thanks for working on this

@meshcollider
Copy link
Contributor

Changes since @sipa's are just nit-fixes, a new test, and a missing brace bugfix 👍

@meshcollider meshcollider merged commit cb3511b into bitcoin:master Feb 14, 2019
meshcollider added a commit that referenced this pull request Feb 14, 2019
cb3511b Add release notes for importing key origin info change (Andrew Chow)
4c75a69 Test importing descriptors with key origin information (Andrew Chow)
02d6586 Import KeyOriginData when importing descriptors (Andrew Chow)
3d235df Implement a function to add KeyOriginInfo to a wallet (Andrew Chow)
eab63bc Store key origin info in key metadata (Andrew Chow)
345bff6 Remove hdmasterkeyid (Andrew Chow)
bac8c67 Add a method to CWallet to write just CKeyMetadata (Andrew Chow)
e7652d3 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow)
c45415f Refactor keymetadata writing to a separate method (Andrew Chow)

Pull request description:

  This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet.

  In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this.

Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@c45415f

Test Plan:
  ninja
  ninja check
  ninja check-functional

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6004
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Creates new files util/bip32.h and util/bip32.cpp for containing
BIP 32 stuff.
Moves FormatKeyPath from descriptor.cpp to util/bip32.
Adds a wrapper around it to prepent the 'm' for when just the
BIP 32 style keypath is needed.

Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@e7652d3

Depends on D6004

Test Plan:
  ../configure --enable-deprecated-build-system
  make check

  ninja
  ninja check
  test_runner.py

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6204
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Deprecated return results that were scheduled to be removed in v0.21

Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@345bff6

Test Plan:
  ninja
  ninja check-functional

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5933
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@bac8c67

Depends on D6204

Test Plan:
  ninja

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6227
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Store the master key fingerprint and derivation path in the
key metadata. hdKeypath is kept to indicate the seed and for
backwards compatibility, but all key derivation path output
uses the key origin info instead of hdKeypath.

Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@eab63bc

Depends on D6227

Test Plan:
  ninja
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6228
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@3d235df

Depends on D6228

Test Plan:
  ninja

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6229
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
Summary:
Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@02d6586

Depends on D6229

Test Plan:
  ninja
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6230
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 22, 2020
…e notes

Summary:
Test is separated from the rest of the changes to make review easier.

Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@4c75a69
bitcoin/bitcoin@cb3511b

Depends on D6230

Test Plan:
  ninja
  ninja check
  ninja check-functional

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6215
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
Partial backport of Core [[bitcoin/bitcoin#14021 | PR14021]]
bitcoin/bitcoin@c45415f

Test Plan:
  ninja
  ninja check
  ninja check-functional

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D6004
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Sep 28, 2021
…portmulti

cb3511b Add release notes for importing key origin info change (Andrew Chow)
4c75a69 Test importing descriptors with key origin information (Andrew Chow)
02d6586 Import KeyOriginData when importing descriptors (Andrew Chow)
3d235df Implement a function to add KeyOriginInfo to a wallet (Andrew Chow)
eab63bc Store key origin info in key metadata (Andrew Chow)
345bff6 Remove hdmasterkeyid (Andrew Chow)
bac8c67 Add a method to CWallet to write just CKeyMetadata (Andrew Chow)
e7652d3 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (Andrew Chow)
c45415f Refactor keymetadata writing to a separate method (Andrew Chow)

Pull request description:

  This PR allows for key origin data as defined by the descriptors document to be imported to the wallet when importing a descriptor using `importmulti`. This allows the `walletprocesspsbt` to include the BIP 32 derivation paths for keys that it is watching that are from a different HD wallet.

  In order to make this easier to use, a new field `hdmasterkeyfingerprint` has been added to `getaddressinfo`. Additionally I have removed `hdmasterkeyid` as was planned. I think that this API change is fine since it was going to be removed in 0.18 anyways. `CKeyMetadata` has also been extended to store key origin info to facilitate this.

Tree-SHA512: 9c7794f3c793da57e23c5abbdc3d58779ee9dea3d53168bb86c0643a4ad5a11a446264961e2f772f35eea645048cb60954ed58050002caee4e43cd9f51215097
vijaydasmp added a commit to vijaydasmp/dash that referenced this pull request Sep 28, 2021
vijaydasmp added a commit to vijaydasmp/dash that referenced this pull request Sep 28, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.