Closed lsching17 closed 6 years ago
@matejcik Currently there is no way how to pass type of requested pubkey via GetPublicKey
message. Wallet solves this for Segwit accounts (BIP-49) by deserializing xpub, changing it's version and serializing back to text.
Quick solution would to be to detect first two elements of the path and do the conversion from xpub prefix to another one (according to table here:) https://github.com/satoshilabs/slips/blob/master/slip-0132.md#registered-hd-version-bytes
@prusnak that sounds about right. The key material is still the same, right? So basically it's only a matter of sticking the right word at start?
This is too difficult for bitcoin novice: how to convert xpub to zpub in bash or python?
So basically it's only a matter of sticking the right word at start?
not sticking, deserializing, changing the version and serializing back
Can the library add support to generate xpub, ypub, zpub in the future?
Yes, will update this in the future.
Added script_type
param to GetPublicKey
in the following commit: https://github.com/trezor/trezor-common/commit/a01a9cef9e8690e998839be719880925c5991231
Implemented in https://github.com/trezor/python-trezor/commit/555bb62e3f7f5a9fcaca301f10ab9f977c87a8dd
Next firmware release will contain this feature.
T2 firmware implemented in https://github.com/trezor/trezor-core/commit/ebdd8c9b07537351c7dedec4db6e1fcbeb0426ef
T1 firmware implemented in https://github.com/trezor/trezor-mcu/commit/efeedbe69b7fa9845462775c7a528c4f1838b7d8
There is an example for generate segwit address
trezorctl get_address --coin Bitcoin --script-type segwit --address "m/84'/0'/0'/0/0"
There is another example to generate xpub
trezorctl get_public_node --coin Bitcoin --address "m/44'/0'/0'"
So, how to generate pub key for p2shsegwit and segwit (e.g. zpub)? if "m/84'/0'/0'/0/0" is passed, "zpub" is still returned.