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

Derive scriptPubKey from BIP32 key #117

Closed
Sjors opened this issue Jun 14, 2019 · 1 comment
Closed

Derive scriptPubKey from BIP32 key #117

Sjors opened this issue Jun 14, 2019 · 1 comment

Comments

@Sjors
Copy link
Contributor

Sjors commented Jun 14, 2019

Similar to #103, but it would produce bytes containing the scriptPubKey.

This is useful when composing a transaction, to directly generate a change output. Otherwise you have to derive a change address with wally_bip32_key_to_address / wally_bip32_key_to_addr_segwit and then parse it with wally_addr_segwit_to_bytes / wally_address_to_scriptpubkey (#112)

@jgriffiths
Copy link
Contributor

I think descriptors are the best way to accomplish this now that they are merged.

Given a (reusable) descriptor string such as "p2pkh(key)" and an input variable map of "key" -> "xpub..." from the bip32 key, both an address and scriptpubkey can be generated. This is assuming of course that the bip44 style descriptor and the root key aren't sufficient for some reason.

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
@Sjors @jgriffiths and others