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

bip32 should support ypub, zpub etc. #148

Open
benma opened this issue Oct 10, 2019 · 9 comments
Open

bip32 should support ypub, zpub etc. #148

benma opened this issue Oct 10, 2019 · 9 comments

Comments

@benma
Copy link
Contributor

benma commented Oct 10, 2019

The bip32 library only works with xpub/xprv.

If you want to use xpub/ypub/zpub etc. (see https://github.com/satoshilabs/slips/blob/master/slip-0132.md), the library gives you a hard time currently.

I currently work around it by using only the xprv/xpub versions, and then force overwriting the version bytes when serializing.

It would be great to keep the bip32 API flexible enough so that one can provide custom version bytes.

@evd0kim
Copy link

evd0kim commented Nov 2, 2020

@benma hey. could you share your code?

I'm also replacing version bytes but I have

OverflowError: Invalid unsigned integer

Obviously doing something wrong.

@benma
Copy link
Contributor Author

benma commented Nov 3, 2020

@evd0kim
Copy link

evd0kim commented Nov 3, 2020

@benma

Thanks a lot!

@Fonta1n3
Copy link

Fonta1n3 commented Nov 3, 2020

My opinion is libwally should not do this. bip32 has nothing to do with slip0132.

@benma
Copy link
Contributor Author

benma commented Nov 3, 2020

@Fonta1n3 what is the disadvantage in supporting it?

Note that Zpub, Ypub etc. are already pervasively used by Electrum and compatible wallets. If it is not supported by the library, weird workarounds like the one I linked above are necessary.

@evd0kim
Copy link

evd0kim commented Nov 3, 2020

@Fonta1n3

Actually I couldn't manage libwally working with zpub even with substituting version bytes. I would be grateful if you could say how I can import zpub and derive native segwit addresses.

@Fonta1n3
Copy link

Fonta1n3 commented Nov 4, 2020

@Fonta1n3

Actually I couldn't manage libwally working with zpub even with substituting version bytes. I would be grateful if you could say how I can import zpub and derive native segwit addresses.

This is what i use to convert:

https://github.com/Fonta1n3/FullyNoded/blob/master/FullyNoded/Helpers/Xpub%20Converter/XpubConverter.swift

@benma
Copy link
Contributor Author

benma commented Nov 4, 2020

@Fonta1n3 are you using libwally-core in this project? If so, I don't understand why you prefer to re-implement xpub encoding almost completely than having it be supported upstream.

@evd0kim
Copy link

evd0kim commented Nov 4, 2020

@Fonta1n3 Thank you. I see I have to replace checksum also.

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