user123557: We know that a P2PKH script looks as follows:
scriptPubKey: OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <Signature> <PubKey>

Since full nodes are maintaing UTXO sets, wouldn't it save space to omit the OP_DUP and have the user provide their public key twice instead, like so? And would that create any sort of security issues?
scriptPubKey: OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <Signature> <PubKey> <PubKey>


user208: Unfortunately, that would not be secure. Imagine an output with scriptPubkey OP_HASH160 <hash(P1)> OP_EQUALVERIFY OP_CHECKSIG. Now anyone can spend such an output by generating their own key P2, and spending with scriptSig <sig with P2> <P2> <P1>.

123557: <p>We know that a P2PKH script looks as follows:</p>
<pre><code>scriptPubKey: OP_DUP OP_HASH160 &lt;PubKeyHash&gt; OP_EQUALVERIFY OP_CHECKSIG
scriptSig: &lt;Signature&gt; &lt;PubKey&gt;
</code></pre>
<p>Since full nodes are maintaing UTXO sets, wouldn't it save space to omit the <code>OP_DUP</code> and have the user provide their public key twice instead, like so? And would that create any sort of security issues?</p>
<pre><code>scriptPubKey: OP_HASH160 &lt;PubKeyHash&gt; OP_EQUALVERIFY OP_CHECKSIG
scriptSig: &lt;Signature&gt; &lt;PubKey&gt; &lt;PubKey&gt;
</code></pre>
 208: <p>Unfortunately, that would not be secure. Imagine an output with scriptPubkey <code>OP_HASH160 &lt;hash(P1)&gt; OP_EQUALVERIFY OP_CHECKSIG</code>. Now anyone can spend such an output by generating their own key <code>P2</code>, and spending with scriptSig <code>&lt;sig with P2&gt; &lt;P2&gt; &lt;P1&gt;</code>.</p>
