Skip to content
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

Support for ypub & zpub #26

Open
dspicher opened this issue Jan 20, 2022 · 5 comments
Open

Support for ypub & zpub #26

dspicher opened this issue Jan 20, 2022 · 5 comments

Comments

@dspicher
Copy link

Hi, first of all thanks a lot for this great library!

I was wondering whether you would consider adding support for the ypub and ypub versions of extended keys?

I would be happy to take a stab at this with a PR if you signal willingness to support this.

@darosior
Copy link
Owner

Hi, sorry to only see this now. My thoughts with regards to ypubs and zpubs are detailed in this PR adding support for them: #21.

TL;DR: i think people should migrate to proper output descriptors instead but i understand the need for interacting with legacy systems.

As mentioned there, i'm happy to take a PR implementing the conversion and stating in the doc that it should be avoided if possible. The PR linked above seems abandoned so feel free to take a stab at this!

@kanzure
Copy link

kanzure commented Aug 22, 2022

ENCODING_PREFIX in general does not support the electrum types, like Vpub: https://electrum.readthedocs.io/en/latest/xpub_version_bytes.html#specification

These are used in bip174 PSBTs.

That said, I do see your other message:

hardcoding of specific script types inside the encoding of an extended public key is an unscalable and terrible layer violation

@darosior
Copy link
Owner

In what PSBT field are script-related xpub prefixes used? The key of the PSBT_GLOBAL_XPUB field is explicitly defined as:

The 78 byte serialized extended public key as defined by BIP 32

The serialization defined by BIP 32 (including all prefixes defined there) is implemented in this library, so it shouldn't be incompatible with PSBTs?

That said, I do see your other message: [...]

Yes. Just to be clear: while i don't think it's a good idea and don't want to perpetrate this practice through this library, i do want to make it reasonably possible for downstream users to integrate with current and past tooling.
So i'm happy to have a compatibility layer to ypub, zpub, vpub, Vpub, Zpub, whateverpub as long as it's clearly stated it's bAd ™️.

@kanzure
Copy link

kanzure commented Aug 23, 2022

ok, sounds like electrum PSBT is just non-standard?

@darosior
Copy link
Owner

darosior commented Aug 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants