0

This question already has an answer here:

I want to parse a script with c++ to gain an output address from it. can anybody introduce a suitable library or a sample code which extract addresses from scripts ?

marked as duplicate by pebwindkraft, Raghav Sood, alcio, Andrew Chow May 1 '18 at 19:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You can look at the code for decodescript in the Bitcoin source. That outputs addresses (if they exist), so should do what you want – Raghav Sood Apr 29 '18 at 12:07
0

Have a look at libbtc (https://github.com/libbtc/libbtc).

There is a function btc_script_classify() which will return what script type it is (P2PK, P2PKH, P2SH, P2WPKH, P2WSH) and it will return data elements (usually the RIPEMD160 of the pubkey).

Not the answer you're looking for? Browse other questions tagged or ask your own question.