<p>I would like to first clarify a thing, before trying to answer, and it is also from the book: </p>

<blockquote>
  <p>unspent transaction output (UTXO) UTXO is an unspent transaction
  output that can be spent as an input in a new transaction.</p>
</blockquote>

<p>a UTXO is not an element per se, it is a description for a set of data in a transaction. UTXO's can be spent, or unspent. For transactions to become valid, they of course can only use unspents. So when using an UTXO from a previous transaction, spending all funds to a new address and a return address, the previous UTXO becomes part of two new UTXOs. And yes, the previous UTXO is spent, documented in the blockchain, and can't be used anymore. </p>

<p>When it comes to adding or removing UTXOs: here it is about mempool. The list of unspent tx is kept by the bitcoin client in memory. To see, how big UTXO database is, <a href="https://bitcoin.stackexchange.com/questions/35980/how-big-is-the-utxo-database">see here.</a> This is what you described as a separate pool. And in this sense </p>

<blockquote>
  <p>removed from the set of available (unspent) UTXO</p>
</blockquote>

<p>simply means, that when you have sent a transaction, this particular UTXO must be removed from the mempool. I am not 100% sure, but the mempool is needed to verify, if the tx is valid or not (aka spends only valid UTXO out of the mempool). See also page 119 in the book. </p>

<blockquote>
  <p>Would the output of the child transaction contain the same transaction
  ids as the its parent'output contained?</p>
</blockquote>

<p>Each tx references a previous tx, to specify from which transaction (the tx hash) and VOUT to take the funds. So a child tx would reference a parents tx inputs. However, if the child tx is then referenced by the next tx, you wouldn't see references from the parent tx. </p>

<p>Assuming you have (you see) these three TX_IDs and outpoints and values, </p>

<pre><code>7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 25000000 Satoshis
7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 16100000 Satoshis
6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 16050000 Satoshis
</code></pre>

<p>the wallet software would know, these are unspent outputs, and could be asked to use these as inputs for a new transaction of ~0.57BTC to a new address.</p>

<p>Besides the very good book from Andreas, I also recommend Ken Shirrif's blog entry, were he explains <a href="http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html" rel="nofollow noreferrer">how to manually sign a tx</a>. That makes things very clear as well. </p>

CC BY-SA 3.0
2018-01-30T23:41:34.727Z
The U in UTXO stands for Unspent. A UTXO is by definition unspent. Otherwise it's just a spent output.
Pieter Wuille
CC BY-SA 3.0
2018-01-31T13:43:03.690Z
Please correct me if I am wrong
A transaction contains both inputs and outputs. An unspent output of a transaction becomes part of UTXO pool. Once a node receives it removes the UTXO from its pool once it gets validated and broadcasts the transaction.  When other nodes also receives this transaction they do also remove corresponding UTXO from their pools.
Is it?
Learner
CC BY-SA 3.0
2018-01-31T22:31:28.590Z
Yes, tx contains inputs and outputs. A UTXO becomes part of the mempool. It gets removed from mempool, when it appears in a block. See also Pieter’s answer here: https://bitcoin.stackexchange.com/questions/46152/how-do-transactions-leave-the-memory-pool
pebwindkraft
CC BY-SA 3.0
2018-01-31T22:41:31.937Z
Also Murch here: https://bitcoin.stackexchange.com/questions/47926/how-is-the-mempool-incorporated-in-the-calculation-of-the-block-hash
pebwindkraft
CC BY-SA 3.0
2018-02-06T14:56:25.550Z
And found a good link on UTXO here: https://eprint.iacr.org/2017/1095.pdf
pebwindkraft
CC BY-SA 3.0
2018-01-30T19:25:48.250Z
2018-01-30T19:25:48.250Z
pebwindkraft
<p>As per my understanding from the book "Mastering bitcoin", a transaction output contains three things</p>

<ol>
<li>Amount - Bitcoin Value in Satoshis</li>
<li>Locking-Script-Size - Locking-Script length in bytes, to follow</li>
<li>Locking-Script -A script defining the conditions needed to spend the output</li>
</ol>

<p>Now let us say a transaction input points to UTXOs mentioned in one of the transaction output through transaction hash and a validation software is able satisfy the scriptPubKey(locking script) using script‐
Sig(unlocking script).</p>

<p>Questions regarding this case</p>

<ol>
<li>What would happen to the UTXOs mentioned in the output of parent transaction? Would it get vanished in the transaction or any change would happen?</li>
<li><blockquote>
  <p>Only a valid transaction that correctly satisfies the conditions of
  the UTXO results in the UTXO being marked as “spent” and removed from
  the set of available (unspent) UTXO.</p>
</blockquote></li>
</ol>

<p>This was a statement from the book, now is there any seperate pool of UTXOs or it just meant the transaction lying at the leaf nodes of merkel tree? 
And what does </p>

<blockquote>
  <p>removed from the set of available (unspent) UTXO.</p>
</blockquote>

<p>mean?</p>

<ol start="3">
<li>Would the output of the child transaction contain the same transaction  ids as the its parent'output contained?</li>
</ol>

<p>Assume when the spender tried to see what all he can spend i.e the transactions directed to its bitcoin address then these were the transaction output which he got</p>

<p>[&lt;7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 with 25000000 Satoshis>, \
&lt;7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 with 16100000 Satoshis>, \
&lt;6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 with 16050000 Satoshis>]</p>

<p>Please enlighten me if I am missing out on something.</p>

<transactions><blockchain><utxo><output><transaction-input>
what happens to UTXOs when a transaction output script is satisfied?
Learner
# what happens to UTXOs when a transaction output script is satisfied?

(Asked by: username_0 on 2018-01-30)

As per my understanding from the book "Mastering bitcoin", a transaction output contains three things

1. Amount - Bitcoin Value in Satoshis
2. Locking-Script-Size - Locking-Script length in bytes, to follow
3. Locking-Script -A script defining the conditions needed to spend the output

Now let us say a transaction input points to UTXOs mentioned in one of the transaction output through transaction hash and a validation software is able satisfy the scriptPubKey(locking script) using script‐
Sig(unlocking script).

Questions regarding this case

1. What would happen to the UTXOs mentioned in the output of parent transaction? Would it get vanished in the transaction or any change would happen?
2. > Only a valid transaction that correctly satisfies the conditions of
   > the UTXO results in the UTXO being marked as “spent” and removed from
   > the set of available (unspent) UTXO.

This was a statement from the book, now is there any seperate pool of UTXOs or it just meant the transaction lying at the leaf nodes of merkel tree?
And what does

> removed from the set of available (unspent) UTXO.

mean?

3. Would the output of the child transaction contain the same transaction ids as the its parent'output contained?

Assume when the spender tried to see what all he can spend i.e the transactions directed to its bitcoin address then these were the transaction output which he got

[<7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 with 25000000 Satoshis>, \
<7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 with 16100000 Satoshis>, \
<6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 with 16050000 Satoshis>]

Please enlighten me if I am missing out on something.

**Tags:** transactions, blockchain, utxo, output, transaction-input


---

## 1 answers

### Answer by username_1 on 2018-01-30. Score: 1

I would like to first clarify a thing, before trying to answer, and it is also from the book:

> unspent transaction output (UTXO) UTXO is an unspent transaction
> output that can be spent as an input in a new transaction.

a UTXO is not an element per se, it is a description for a set of data in a transaction. UTXO's can be spent, or unspent. For transactions to become valid, they of course can only use unspents. So when using an UTXO from a previous transaction, spending all funds to a new address and a return address, the previous UTXO becomes part of two new UTXOs. And yes, the previous UTXO is spent, documented in the blockchain, and can't be used anymore.

When it comes to adding or removing UTXOs: here it is about mempool. The list of unspent tx is kept by the bitcoin client in memory. To see, how big UTXO database is, [see here.](https://bitcoin.stackexchange.com/questions/35980/how-big-is-the-utxo-database) This is what you described as a separate pool. And in this sense

> removed from the set of available (unspent) UTXO

simply means, that when you have sent a transaction, this particular UTXO must be removed from the mempool. I am not 100% sure, but the mempool is needed to verify, if the tx is valid or not (aka spends only valid UTXO out of the mempool). See also page 119 in the book.

> Would the output of the child transaction contain the same transaction
> ids as the its parent'output contained?

Each tx references a previous tx, to specify from which transaction (the tx hash) and VOUT to take the funds. So a child tx would reference a parents tx inputs. However, if the child tx is then referenced by the next tx, you wouldn't see references from the parent tx.

Assuming you have (you see) these three TX\_IDs and outpoints and values,

```
7dbc497969c7475e45d952c4a872e213fb15d45e5cd3473c386a71a1b0c136a1:0 25000000 Satoshis
7f42eda67921ee92eae5f79bd37c68c9cb859b899ce70dba68c48338857b7818:0 16100000 Satoshis
6596fd070679de96e405d52b51b8e1d644029108ec4cbfe451454486796a1ecf:0 16050000 Satoshis

```

the wallet software would know, these are unspent outputs, and could be asked to use these as inputs for a new transaction of ~0.57BTC to a new address.

Besides the very good book from Andreas, I also recommend Ken Shirrif's blog entry, were he explains [how to manually sign a tx](http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html). That makes things very clear as well.

> **Comments:**
> **username_2**: The U in UTXO stands for Unspent. A UTXO is by definition unspent. Otherwise it's just a spent output.  
> **username_0**: Please correct me if I am wrong A transaction contains both inputs and outputs. An unspent output of a transaction becomes part of UTXO pool. Once a node receives it removes the UTXO from its pool once it gets validated and broadcasts the transaction.  When other nodes also receives this transaction they do also remove corresponding UTXO from their pools. Is it?  
> **username_1**: Yes, tx contains inputs and outputs. A UTXO becomes part of the mempool. It gets removed from mempool, when it appears in a block. See also username_2’s answer here: https://bitcoin.stackexchange.com/questions/46152/how-do-transactions-leave-the-memory-pool  
> **username_1**: Also Murch here: https://bitcoin.stackexchange.com/questions/47926/how-is-the-mempool-incorporated-in-the-calculation-of-the-block-hash  
> **username_1**: And found a good link on UTXO here: https://eprint.iacr.org/2017/1095.pdf  

---

