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

Possibility to obtain ypub / zpub from xpub? #28

Open
RubenWaterman opened this issue Sep 25, 2019 · 3 comments
Open

Possibility to obtain ypub / zpub from xpub? #28

RubenWaterman opened this issue Sep 25, 2019 · 3 comments

Comments

@RubenWaterman
Copy link

Since we have the plumbing available to create p2sh-segwit and bech32 addresses from an xpub. Would it be possible to also have the ability to derive a ypub or zpub from a given xpub?

@dan-da
Copy link
Owner

dan-da commented Sep 25, 2019

Should be possible I suppose. What's the use case?

@RubenWaterman
Copy link
Author

Funny enough, it's actually for your other package (hd-wallet-addr) as this one only checks the addresses that should be obtained from an extended public key (i.e. 1... for xpub, 3... for ypub and bc1... for zpub according to SLIP-0132). Because of Ledger's implementation of only using xpub's and derive the required addresses, I need to check the xpub, ypub and zpub of a given xpub (to see whether it has been used).

My thought was thus to use the hd-wallet-derive (which we already have implemented) to obtain the ypub and zpub from a given xpub and throw those into the hd-wallet-addr. I guess the better solution would be to implement a parameter (like --addr-type=p2sh-segwit in hd-wallet-derive) into hd-wallet-addr? I can open a pull request for that instead if that's your preferred way of going?

@dan-da
Copy link
Owner

dan-da commented Sep 26, 2019

If you can create a PR for hd-wallet-addrs, that would be great.

As I recall, there is some trickiness (a lot of setup) required to make a given key generate x, y, or z type addresses, as the bitcoin-php lib doesn't really support it cleanly yet. I opened an issue for it. You should be able to port over what I did in hd-wallet-derive though, or let me know if difficulties.

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

2 participants