Your address 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY is a P2SH mainnet address, with a 05 address prefix and represents the base58 encoding of the following data:
[05][20-byte hash][4-byte checksum]
So, the [05] prefix tells your wallet that your address represents a P2SH embedded script presage (20B).
On the other hand, a [00] prefix tells your wallet that the 20B digest represents a Public-Key-Hash, and that funds should be sent to a P2PKH (Pay-2-Public-Key-Hash) output.
The version number therefore gives your wallet the necessary information to produce the correct output type when sending funds, so that the recipient has the private keys (P2PKH) or presage (P2SH) to spend them.
The 05 prefix translates to a 3 in base58 encoding, which is why your addresses begin with 3. I cannot comment on what the embedded script type is though, since the P2SH has is simply the 20B hash-digest thereof. Perhaps a P2SH(P2WPKH) script type.
Amended Answer:
To determine the address version appropriate for a specific output from a transaction, simply look at the output script in question.
- P2PKH:
"hash160 [20B] equal" -> version 5
- P2SH:
"dup hash160 [20B] equalverify checksig" -> version 0
- P2WPKH:
"[00] [20B]" -> bech32 address
Thank you for response. Bx explorer returns address_hash as shown above, but my problem is how to correct determine version from bx response. Other blockexplorers like blockchain.info or bitpay insight shows right address, so there is a way to determine the right version. Miss I anything? – Ramirez – 2019-01-14T09:47:54.240
You mean how to decode the version from an address, such as 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY? Try bx address-decode 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY – James C. – 2019-01-14T09:50:31.097
No. I want to use bx fetch-tx result to generate address. It returns address_hash and bx base58check-encode returns address. But only with right version choosen it leads to the right address. My problem is to determine the right version. – Ramirez – 2019-01-14T09:55:16.370
I see. You have to examine the output scripts when you fetch the tx. The output script pattern (P2SH or P2PKH etc.) will tell you what version is required (05 or 00 etc.). BX doesn't recognise script patterns for you. Libbitcoin-System has internal methods which check for standard output script patterns, if you want to look into the Libbitcoin C++ library. – James C. – 2019-01-14T10:12:09.983
If this answer helped u, your up/downvote/check would be appreciated either way. Thank you. – James C. – 2019-01-14T19:05:13.847