btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
477 stars 410 forks source link

Getting the address from a TxOutput #81

Closed FrozenPrincess closed 8 years ago

FrozenPrincess commented 8 years ago

Given an address, it's easy to get the script but for the life of me, I can't figure out how go the other way.

i.e. I have a TxOut and get the PkScript and want to convert that into an address. I realize not every PkScript is an address, but in my case I only care about pay-to-pubkey-hash outputs anyway

jrick commented 8 years ago

https://godoc.org/github.com/btcsuite/btcd/txscript#example-ExtractPkScriptAddrs

FrozenPrincess commented 8 years ago

Thank you!