<p>Each transaction draws on a set of [1..n] <em>Unspent Transaction Outputs</em> to spend. These we call the <strong>inputs</strong> of a transaction.<br>
The transaction then assigns the total value of the inputs to [0..n] new <em>Unspent Transaction Outputs</em>. Each UTXO is associated with the creating transaction and uniquely numbered among that set. The most common script that makes up a UTXO is "pay-to-pubkeyhash", where an UTXO can only be spent in combination with a valid signature by it's recipient.</p>

<p>The value of the outputs must be smaller or equal to the value of the inputs. The difference of those two totals can be claimed by the miner as transaction fee.</p>

<p>To come back to your example:</p>

<p>Transaction A1:<br>
Alice -> 5BTC -> Bob (Transaction A1, output 0)<br>
Alice -> 5BTC -> David (Transaction A1, output 1)</p>

<p>(Alice needs to put in at least 10BTC for that transaction.)</p>

<p>Bob wants to spend his money:<br>
Bob -> spend(Transaction A1, output 0, signature) -> new recipient.</p>

<p>Since each UTXO is uniquely identifiable, they cannot both try to access the same UTXO.</p>

CC BY-SA 3.0
2015-02-18T15:51:52.100Z
2015-02-18T15:51:52.100Z
Murch
<blockquote>
  <p>Is the UTXO associated with output and Tx id?</p>
</blockquote>

<p>Yes, you're exactly right, each UTXO is basically just a tuple (txid, output_index). Then when that output is going to be spent, you refer to it by listing the tuple as an input. </p>

<p>Essentially, that's why they're called "Unspent Transaction Outputs" (UTXOs), not "Unspent Transactions". </p>

<p>For example, look at this random transaction output I pulled of of the block chain:</p>

<pre><code>txid: 564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6
output: 1
scriptPubKey: 76a9148ab215e3d638357551f5e6e7e3384b56bb355a6c88ac
</code></pre>

<p>(Note that 1 is the index, meaning it's actually the second output)</p>

<p>Then when the transaction is spent, the input references this previously unspent transaction output. </p>

<pre><code>ID of spending TX: 57149f629790e61a5fbab9e27041858ada6348aa17323c15b9da9659b90717bb
input:
  "txid" : "564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6",
  "vout" : 1,
  "scriptSig": 48304502205b6d49f0e473e5b6134c9ba55dcfdd9e010a226fb29f89e9f4ff1a2b568a1d4c022100af290372ed889ffff948662d7a5b1f2d6eb29dbdcad260ab53f99aba6b6e46e50121020f4db25f5bd35cb2c541ecdbcdb0e7c0be890cb4e25895612f8a1cbb32216ff0
</code></pre>

CC BY-SA 3.0
2015-02-18T20:09:39.470Z
2015-02-18T20:18:19.713Z
2015-02-18T20:18:19.713Z
morsecoder
<p>Since the output can be spend only once, I am confused by transactions containing multiple recipients. For example, if Alice transfers 5 BTC to Bob and 5 BTC to David in the same transactions. In the future, Bob refers to the Alice's transaction, also David can refer to the same transaction. I understand that outputs are numbered in Alice's transaction to Bob and Eve. Therefore the output number and transaction id Tx id uniquely determines whether there is double spend happening or not.</p>

<p>Am I correct? Is the UTXO associated with output and Tx id?</p>

CC BY-SA 3.0
2015-02-18T16:02:18.400Z
Near duplicate of http://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list/
Nick ODell
<doublespend><utxo>
Using Transaction with multiple outputs
Curious
# Using Transaction with multiple outputs

(Asked by: username_0 on 2015-02-18)

Since the output can be spend only once, I am confused by transactions containing multiple recipients. For example, if Alice transfers 5 BTC to Bob and 5 BTC to David in the same transactions. In the future, Bob refers to the Alice's transaction, also David can refer to the same transaction. I understand that outputs are numbered in Alice's transaction to Bob and Eve. Therefore the output number and transaction id Tx id uniquely determines whether there is double spend happening or not.

Am I correct? Is the UTXO associated with output and Tx id?

**Tags:** doublespend, utxo

> **Comments:**
> **username_1**: Near duplicate of http://bitcoin.stackexchange.com/questions/11411/in-getrawtransaction-what-is-the-vout-integer-in-the-vin-list/  

---

## 2 answers

### Answer by username_2 on 2015-02-18. Score: 1

Each transaction draws on a set of [1..n] *Unspent Transaction Outputs* to spend. These we call the **inputs** of a transaction.  
The transaction then assigns the total value of the inputs to [0..n] new *Unspent Transaction Outputs*. Each UTXO is associated with the creating transaction and uniquely numbered among that set. The most common script that makes up a UTXO is "pay-to-pubkeyhash", where an UTXO can only be spent in combination with a valid signature by it's recipient.

The value of the outputs must be smaller or equal to the value of the inputs. The difference of those two totals can be claimed by the miner as transaction fee.

To come back to your example:

Transaction A1:  
Alice -> 5BTC -> Bob (Transaction A1, output 0)  
Alice -> 5BTC -> David (Transaction A1, output 1)

(Alice needs to put in at least 10BTC for that transaction.)

Bob wants to spend his money:  
Bob -> spend(Transaction A1, output 0, signature) -> new recipient.

Since each UTXO is uniquely identifiable, they cannot both try to access the same UTXO.


---

### Answer by username_3 on 2015-02-18. Score: 0

> Is the UTXO associated with output and Tx id?

Yes, you're exactly right, each UTXO is basically just a tuple (txid, output\_index). Then when that output is going to be spent, you refer to it by listing the tuple as an input.

Essentially, that's why they're called "Unspent Transaction Outputs" (UTXOs), not "Unspent Transactions".

For example, look at this random transaction output I pulled of of the block chain:

```
txid: 564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6
output: 1
scriptPubKey: 76a9148ab215e3d638357551f5e6e7e3384b56bb355a6c88ac

```

(Note that 1 is the index, meaning it's actually the second output)

Then when the transaction is spent, the input references this previously unspent transaction output.

```
ID of spending TX: 57149f629790e61a5fbab9e27041858ada6348aa17323c15b9da9659b90717bb
input:
  "txid" : "564bb87efc20751dde182b678e848ceaa75ac54fd2eab33808842f40e953f7e6",
  "vout" : 1,
  "scriptSig": 48304502205b6d49f0e473e5b6134c9ba55dcfdd9e010a226fb29f89e9f4ff1a2b568a1d4c022100af290372ed889ffff948662d7a5b1f2d6eb29dbdcad260ab53f99aba6b6e46e50121020f4db25f5bd35cb2c541ecdbcdb0e7c0be890cb4e25895612f8a1cbb32216ff0

```


---

