In this post Does the version prefix of an address force the type of transactions the address may treat?, I saw "the version byte doesn't actually appear in the final transaction."
I don't understand why? Could anyone can help to tell more detail about that?
The address prefix determines how a wallet will interperet the address. Let's look at an example.
Generate a P2PKH address
Take a public key, e.g.
Prepend the version prefix for
Base58Check encode it:
See How to Generate a Bitcoin Address — Step by Step for command line steps.
Bitcoin has 2 main address prefixes (mainnet):
P2PKH (Pay to Public Key Hash):
P2SH (Pay to Script Hash):
Addresses are just representations of the information necessary (
scriptPubKey) to create a transaction output, which is part of the transaction and which is validated and stored on the network. It is only used by wallet application software, addresses are not stored on the Blockchain in this format.
The wallet will determine, based on the address prefix, when it is decoded, how to construct this
P2PKH this would be in this form:
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
Where you will notice, the only info it needs is the
pubKeyHash which is contained in the decoded address (step 2 above). However, the format for a
OP_HASH160 <scriptHash> OP_EQUAL. If you used the wrong prefix, the wallet would create the wrong script and a tx will most likely burn those coins because no one will be able to guess keys/scripts that will successfully satisfy the