<p>I am wondering if ie. miner cannot change outputs from transaction. We have example of transaction:</p>
<pre><code>      {
&quot;version&quot;: 1,
&quot;locktime&quot;: 0,
&quot;vin&quot;: [
{
&quot;txid&quot;:
&quot;7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18&quot;,
&quot;vout&quot;: 0,
&quot;scriptSig&quot; :
&quot;3045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204
b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e3813[ALL]
0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d1
72787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf&quot;,
&quot;sequence&quot;: 4294967295
}
],
&quot;vout&quot;: [
{
&quot;value&quot;: 0.01500000,
&quot;scriptPubKey&quot;: &quot;OP_DUP OP_HASH160
ab68025513c3dbd2f7b92a94e0581f5d50f654e7 OP_EQUALVERIFY OP_CHECKSIG&quot;
},
{
&quot;value&quot;: 0.08450000,
&quot;scriptPubKey&quot;: &quot;OP_DUP OP_HASH160
7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 OP_EQUALVERIFY OP_CHECKSIG&quot;,
}
]
}
</code></pre>
<p>I signed UTXO from txr <code>7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18</code> by my <code>private key</code>. I put this <code>signature</code> to <code>scriptSig</code> and added my targets addresses to <code>vout</code> and send transaction to bitcoin network. How can I be sure that anyone can't change <code>vout</code> values? Maybe I am wrong and my <code>scriptSig</code> includes additional data from transaction. How this scriptSig is created?</p>

CC BY-SA 4.0
2021-05-28T16:25:18.447Z
As a very simple way to understand what's happening (and I'm not making this an answer because it lacks detail) there is a signature for each input that signs the outputs according to the requirements to claim that particular input. So if you modify any output, all signatures for inputs that require signatures will be invalid and the transaction cannot claim those inputs.
David Schwartz
CC BY-SA 4.0
2021-05-28T16:39:28.200Z
David you mean that `scriptSign` contains data from `vout`. Other words, data what I am signing are tx, vin, vout? Am I right?
MMC
CC BY-SA 4.0
2021-05-28T18:01:11.600Z
That's correct. The signature binds that input to that output and, assuming you use the standard scripts, varying either the input or the output invalidates the signature.
David Schwartz
<transactions><security><output><input-script>
How can I be sure that anyone (i.e miner) will not change outputs from transaction?
MMC
# How can I be sure that anyone (i.e miner) will not change outputs from transaction?

(Asked by: username_0 on 2021-05-28)

I am wondering if ie. miner cannot change outputs from transaction. We have example of transaction:

```
      {
"version": 1,
"locktime": 0,
"vin": [
{
"txid":
"7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18",
"vout": 0,
"scriptSig" :
"3045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204
b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e3813[ALL]
0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d1
72787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf",
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.01500000,
"scriptPubKey": "OP_DUP OP_HASH160
ab68025513c3dbd2f7b92a94e0581f5d50f654e7 OP_EQUALVERIFY OP_CHECKSIG"
},
{
"value": 0.08450000,
"scriptPubKey": "OP_DUP OP_HASH160
7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 OP_EQUALVERIFY OP_CHECKSIG",
}
]
}

```

I signed UTXO from txr `7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18` by my `private key`. I put this `signature` to `scriptSig` and added my targets addresses to `vout` and send transaction to bitcoin network. How can I be sure that anyone can't change `vout` values? Maybe I am wrong and my `scriptSig` includes additional data from transaction. How this scriptSig is created?

**Tags:** transactions, security, output, input-script

> **Comments:**
> **username_1**: As a very simple way to understand what's happening (and I'm not making this an answer because it lacks detail) there is a signature for each input that signs the outputs according to the requirements to claim that particular input. So if you modify any output, all signatures for inputs that require signatures will be invalid and the transaction cannot claim those inputs.  
> **username_0**: username_1 you mean that `scriptSign` contains data from `vout`. Other words, data what I am signing are tx, vin, vout? Am I right?  
> **username_1**: That's correct. The signature binds that input to that output and, assuming you use the standard scripts, varying either the input or the output invalidates the signature.  

---

## 0 answers

