user124876: I am a noob. Currently, I am reading Mastering Bitcoin book. If I understand correctly, output of a bitcoin transaction is just a locking script with this format:
scriptPubKey: "OP_DUP OP_HASH160 (PubKHash of reciever) OP_EQUALVERIFY OP_CHECKSIG"

My Question is: What prevents miners from modifying PubKHash section of the above script and changing it to their addresses and stealing bitcoins from sender?

user24925: The outputs of a transaction are signed by the inputs. Changing the outputs would cause it to become invalid, and it would not be able to be included in a valid block.

124876: <p>I am a noob. Currently, I am reading Mastering Bitcoin book. If I understand correctly, output of a bitcoin transaction is just a locking script with this format:</p>
<pre><code>scriptPubKey: &quot;OP_DUP OP_HASH160 (PubKHash of reciever) OP_EQUALVERIFY OP_CHECKSIG&quot;
</code></pre>
<p>My Question is: What prevents miners from modifying PubKHash section of the above script and changing it to their addresses and stealing bitcoins from sender?</p>
 24925: <p>The outputs of a transaction are signed by the inputs. Changing the outputs would cause it to become invalid, and it would not be able to be included in a valid block.</p>
