Parse scripts to extract address

0

1

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 ?

Saeed

Posted 2018-04-29T10:00:31.613

Reputation: 115

Question was closed 2018-05-01T19:49:51.730

You can look at the code for decodescript in the Bitcoin source. That outputs addresses (if they exist), so should do what you wantRaghav Sood 2018-04-29T12:07:35.330

Answers

1

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).

Jonas Schnelli

Posted 2018-04-29T10:00:31.613

Reputation: 5 465