This is a general question, but let’s suppose a P2PKH transaction. P2PKH address starts with “1” and the sender incorporates it into the scriptPubKey as:
OP_DUP OP_HASH160 <PublicKeyHash> OP_EQUALVERIFY OP_CHECKSIG
Why does an address contain only the <PublicKeyHash>
instead of the full scriptPubKey? At the current scenario the wallet software needs to recognize the address and assemble the scriptPubKey itself.
If a user would also incorporate the Script code in the address, the wallet software would not have to understand it and would simply set the scriptPubKey equal to whatever the address contains.
This seems to me as very useful in terms of forward-compatibility for future types, where the wallet software doesn’t have to be upgraded to understand some new forms of transaction.