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 getting scriptPubKey #145

Open
soy-sauce-rice opened this issue Jul 20, 2018 · 1 comment
Open

support for getting scriptPubKey #145

soy-sauce-rice opened this issue Jul 20, 2018 · 1 comment

Comments

@soy-sauce-rice
Copy link

soy-sauce-rice commented Jul 20, 2018

Hello, I think this is a good library, I can use this library to generate address and signature transactions.
But I don't know if you have the function of get scriptPubKey.
Privkey and scriptPubkey are required for signing transactions.
I can get privkey from your program, but scriptPubkey needs to be obtained from the bitcoind program.
My approach is this:
1 Get pubkey and privkey with bitcointool
2 bitcoin-cli importprivkey <privkey>
3 bitcoin-cli validateaddress <pubkey>
So that I can get scriptPubkey.
Do you have an easy way to get scriptPubkey?

@xloem
Copy link
Collaborator

xloem commented Mar 27, 2021

script.h provides for building signatures (scriptpubkeys).

  • btc_script_build_p2pkh, btc_script_build_p2sh.
  • a btc_script_get_script_from_address func on the wallet_new branch looks like it is pending porting from c++ which i might be able to finish. it might be there to aid in debugging an error. it appears to be a slightly old version of code from bitcoin core's key_io.cpp

ecc_key.h appears to generate hashes for these sigs, from pubkeys. bitcointool outputs these hashes when asked for addresses.

  • btc_pubkey_get_hash160
  • btc_pubkey_getaddr_*

#100

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