-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc, wallet: addhdseed, infer seed when importing descriptor with xpub #23544
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
bce34bd
to
bc3da28
Compare
bc3da28
to
d7f1068
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK! Thanks for continuing this work |
So cool! 🚀 I tried testing this as far as I could. First Node: Created an empty wallet.
✔️
Now on to second node, since I don't have any HWW: Created an empty wallet:
✔️
Now back to first node, to combine into descriptor:
I tried various formats/syntax for
|
@Rspigler in your examples the descriptors you importing are missing a derivation rule after the xpub, e.g. Btw, you could try running the Trezor or ColdCard emulator, it'll work with HWI. |
Those were silly mistakes, sorry. Tried this:
But still received (The first descriptor is different because I re-compiled on Node 1) |
That's still the wrong format. The final |
d7f1068
to
96913f9
Compare
Thanks for being patient with me. Still getting errors but will continue to work on this myself rather than crowd the PR. |
Key management will be done entirely by KeyManager, so DescriptorScriptPubKeyMan does not need key loading functions.
We will need access to a function that sets up a singular DescriptorSPKM, so refactor this out of the multiple DescriptorSPKM setup function.
Descriptor wallets store an HD master key that is used for new automatically generated descriptors. sethdseed is an existing RPC that can be repurposed to allow the users to set that HD key whenever they want. Also fixes the whitespace of sethdseed. Best to review this with --ignore-all-space
d097b70
to
7841583
Compare
🐙 This pull request conflicts with the target branch and needs rebase. |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
This is very out of date and it's not on my priority list at the moment. Happy to review if someone else takes it over. |
Builds on top of #25907 and one commit from #22341.
First this PR introduces a descriptor wallet RPC
addhdseed
. Similar to its legacy wallet counterpartsethdseed
it either generates a fresh random seed, for use on a blank wallet, or the user can provide a WIF. Unlikesethdseed
this RPC call does not add keys / fill the keypool.This allows a user to create a blank wallet (
createwallet
), provide it with a seed (addhdseed
) and then craft custom descriptors. (An alternative approach would to add anodescriptors
argument tocreatewallet
, but this RPC seems useful anyway)An example use case of this is setting up a multisig between Core and a hardware wallet. After adding the seed to an otherwise empty wallet, the user would call
getxpub m/87'/0'/0'
. They would then combine thisxpub
and origin info with the one from their hardware wallet (e.g. usinghwi --fingerprint .... getxpub m/87'/0'/0'
and craft a descriptor likewsh(sorted_multi(2, [...../87'/0'/0']our_xpub, [..../87'/0'/0']their_xpub))
, and import that. The resulting wallet will be able to sign its part of the transaction.The second part of this PR enables to ability descriptors, such as in the multisig example above, in such a way that any
fingerprint
+xpub
that is covered by our hd seed(s) can be signed for.