-
Notifications
You must be signed in to change notification settings - Fork 198
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
WIP: descriptor request using "getkeys" #73
Conversation
1b88b55
to
08deeb4
Compare
Needs rebase as #66 has been merged. |
08deeb4
to
db2fd90
Compare
@achow101 rebased, but I'm not happy with |
db2fd90
to
8747c9b
Compare
I removed the code that inferred Testnet from the BIP32 derivation, instead relying on I'm just leaving the |
8747c9b
to
fe56390
Compare
fe56390
to
d91c71e
Compare
Regarding global variables, I'm not sure what the right approach is. I guess if we translate this to gRPC we could use However some methods don't need the fingerprint argument because it's in the descriptor. Unless we just require this redundantly: Do we also want testnet to be global? |
Can we mark this as WIP if the Core branch is unmerged? |
d91c71e
to
50d074c
Compare
I narrowed the scope a bit, so hopefully it doesn't have to stay in WIP limbo:
The only backwards incompatible changes are:
$ ./hwi.py --testnet --fingerprint 00000000 getkeys --desc "wpkh(00000000/84'/1'/0'/0/*)"
["wpkh([00000000/84'/1'/0']tpub.../0/*"]
./hwi.py --testnet --fingerprint 00000000 displayaddress --desc "wpkh(00000000/84'/1'/0'/0/0)" |
1ffe395
to
6b645b3
Compare
hwilib/commands.py
Outdated
displayaddr_parser.add_argument('--sh_wpkh', action='store_true', help='Display the p2sh-nested segwit address associated with this key path') | ||
displayaddr_parser.add_argument('--wpkh', action='store_true', help='Display the bech32 version of the address associated with this key path') | ||
group = displayaddr_parser.add_mutually_exclusive_group() | ||
group.add_argument('--desc', help='Pseudo-descriptor for which to return a descriptor with keys, e.g. wpkh(00000000/84h/1h/0h/0/*). Alternatively, use --path with --sh_wpkh / --wpkh') |
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.
what is "psuedo" about the option?
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.
I'm calling it a pseudo-descriptor, because there's no public key in it. The goal of a pseudo-descriptor like wpkh(00000000/84h/1h/0h/0/*)
is to ask for an actual descriptor wpkh(00000000/84h/1h/0h/tpub..../0/*)
with a public key inserted in the right place. That's not covered in @sipa's document: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md
Ideally I would just call that a descriptor as well, but I don't know if that makes sense in the scheme of things.
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.
On further thought, I think these are ok. Might want to call them something like "descriptor requests" or something, and say exactly what info must reside in the requests, and what's missing.
I don't follow why |
@achow101 I made everything a named argument, because it's easier to translate to an RPC. |
How does that make it easier to translate to an RPC? I really dislike having command line switches for things that are required. It implies that the parameter is optional and has a default value, but it's actually required. It's an extra couple of characters that you now have to always type. |
I'm still trying to figure out how this mapping would work. I see it's still possible to use a special purpose So I'll change |
6b645b3
to
ba6c6c2
Compare
just leaving this here since I went to the stale branch: bitcoin/bitcoin#14912 |
Thanks, I closed that PR and updated the description above. The branch wasn't stale by the way, but the PR discussion and description was out of date. |
ba6c6c2
to
cc1e835
Compare
|
I extracted the descriptor class and I'm no longer sure if descriptor requests are the right approach. Ultimately we're only asking the device for a key at a certain derivation path. That key is the same regardless of what descriptor it's used in. So it makes more sense for Bitcoin Core to just directly ask for the key using It's still important for Bitcoin Core to know which kinds of things the device can sign, especially if we start adding more complicated stuff like multisig. Perhaps Something similar to descriptors, but perhaps with wildcards, e.g.: |
Todo:
Implements
getkeys
as proposed here.Update 2019/02/02: this used to include #117, which I've moved to a new PR