user125454: Given a public Bitcoin wallet address 1BdYVvwoxTWMGqJS2Pg6NkVD7RnENVjSac; is pasted into a wallet to send Bitcoins to.  How does the wallet create an output to send coins to the public key associated with this address since it is impossible to derive from the public address?

user208: There are currently 3 types of addresses defined, and each directly encodes a specific scriptPubKey.

1... addresses. These are P2PKH addresses. To construct their scriptPubKey, use Base58Check decoding, verify the first byte of the result is 0, and then construct the script OP_DUP OP_HASH160 <byte 1-21 of the Base58Check decode> OP_EQUALVERIFY OP_CHECKSIG.
3... addresses. These are P2SH addresses. To construct their scriptPubKey, use Base58Check decoding, verify the first byte of the result is 5, and then construct the script OP_HASH160 <byte 1-21 of the Base58Check decode> OP_EQUAL.
bc1... addresses. These are native segwit addresses. To construct their scriptPubKey, follow the procedure documented in BIP173 and BIP350.

The prefixes characters/bytes are different for other networks, such as the Bitcoin testnet.
Ideally, you don't need to reimplement this yourself. There are several Bitcoin libraries out there that can do this for you, in various languages.

125454: <p>Given a public Bitcoin wallet address 1BdYVvwoxTWMGqJS2Pg6NkVD7RnENVjSac; is pasted into a wallet to send Bitcoins to.  How does the wallet create an output to send coins to the public key associated with this address since it is impossible to derive from the public address?</p>
 208: <p>There are currently 3 types of addresses defined, and each directly encodes a specific scriptPubKey.</p>
<ul>
<li><code>1...</code> addresses. These are P2PKH addresses. To construct their scriptPubKey, use <a href="https://en.bitcoin.it/wiki/Base58Check_encoding" rel="nofollow noreferrer">Base58Check</a> decoding, verify the first byte of the result is 0, and then construct the script <code>OP_DUP OP_HASH160 &lt;byte 1-21 of the Base58Check decode&gt; OP_EQUALVERIFY OP_CHECKSIG</code>.</li>
<li><code>3...</code> addresses. These are P2SH addresses. To construct their scriptPubKey, use Base58Check decoding, verify the first byte of the result is 5, and then construct the script <code>OP_HASH160 &lt;byte 1-21 of the Base58Check decode&gt; OP_EQUAL</code>.</li>
<li><code>bc1...</code> addresses. These are native segwit addresses. To construct their scriptPubKey, follow the procedure documented in BIP173 and BIP350.</li>
</ul>
<p>The prefixes characters/bytes are different for other networks, such as the Bitcoin testnet.</p>
<p>Ideally, you don't need to reimplement this yourself. There are several Bitcoin libraries out there that can do this for you, in various languages.</p>
