<p>Besides the whole blockchain database there is actually another database continuosly updated in each full node: The UTXO pool memory.
When a transaction with a determined input sucesfully spend some transaction output, this outpus is removed from the UTXO pool memory. Otherwise the handle of the databases to find if a given UTXO hasn't been called by any input of any transaction included in the blockchain would be strenuous.
Remember that an UTXO can only be spent once and you have to enable the verify engine to quickly check whether an UTXO is still available for spending by any future input.</p>

CC BY-SA 3.0
2017-03-01T14:42:26.623Z
Your answer seems correct, but the last sentence is phrased a bit confusingly. I think you mean to say that a UTXO can only be spent once and you have to be able to quickly check whether a UTXO is still available for spending. The way your answer puts it, it sounds as if one could spend parts of a UTXO which is not correct though.
Murch
CC BY-SA 3.0
2017-03-04T05:06:47.007Z
You put it in a much more clearer way. Thank you!
Julio Moros
CC BY-SA 3.0
2017-03-04T05:09:20.920Z
The way it works here is that you just edit your post to improve it. That way we'll always have as good as possible answers to all questions. :)
Murch
CC BY-SA 3.0
2017-03-04T15:00:39.723Z
Thanks for the edit! :) Have you seen our [tour]?
Murch
CC BY-SA 3.0
2017-02-23T15:32:41.350Z
2017-03-04T14:13:00.560Z
2017-03-04T14:13:00.560Z
Julio Moros
<p><strong>UTXO can only be spent completely.</strong></p>

<p>This happens by claiming them in the Transaction Input Script and requires a valid signature corresponding to the address the UTXO is associated with. </p>

<p>The transaction inputs' value is then reassigned by the transaction to create new unspent transaction outputs. Usually, there are at least two outputs, one going to the recipient of the payment, and a <strong>change output</strong> going back to the wallet of the sender. The sum of the assigned outputs must be smaller than or equal to the sum of consumed inputs.</p>

<p>Any amount that doesn't get assigned to new outputs can be claimed by the successful miner as <strong>transaction fee</strong> in the Coinbase transaction of the block the transaction gets included in.</p>

<p>When a block gets found, all nodes in the network enact all the transactions on their UTXO set, marking the inputs as spent and replacing them with the newly minted unspent transaction outputs.</p>

CC BY-SA 3.0
2016-01-28T18:31:13.777Z
2016-01-28T18:31:13.777Z
Murch
<p>An output ("coin") is by definition either fully unspent or completely spent. There is nothing in between. A transaction has one or more inputs (which refer to the unspent outputs of earlier transaction) and it fully consumes them.</p>

<p>A transaction can also have 1 or more outputs. For each output a value is specified (number of Satoshis), so by being a little creative you can easily split or merge "coins".</p>

<p>This way Bitcoin "simply" needs to remember only the last outputs of a chain of transactions, there is no point in remembering (indexing) anything older. That's what the UTXO set is: Unspent Transaction Outputs database.</p>

CC BY-SA 3.0
2016-01-28T17:59:57.950Z
So, in addition to the Blockchain, there is a transaction chain? Hmmm, that's new to me :). Could you please elaborate this part? How can I track what is in the "head" of the transaction chain?
Henrique Barcelos
CC BY-SA 3.0
2016-01-28T18:49:59.107Z
@HenriqueBarcelos Transaction Chain: What he means is that whenever the money gets sent somewhere else only the latest transaction's output is relevant. Much like a one dollar bill might have switched owners a hundred times in the last month, but it's only relevant that it's now in your wallet. There is no dedicated data structure that collects this information in that form, but it just exists implicitly as the history of a transaction output in form of the related transactions spread out in the blocks of the blockchain.
Murch
CC BY-SA 3.0
2016-01-29T09:26:19.403Z
@HenriqueBarcelos Like Murch explains. I don't think transaction chain is an official word here, I just made it up. But thinking about it: when you look at the latest transaction you can jump back to the previous and the previous etc. Bit like a linked list (or chain) although in fact it's a graph since transactions generally have multiple input and outputs. Transaction graph is the term I have seen mentioned. I'll change the answer to use "a chain of transactions" to make it a bit more clear.
Jannes
CC BY-SA 3.0
2016-01-29T12:42:28.547Z
Fair enough, thank your for your clarifications (:
Henrique Barcelos
CC BY-SA 3.0
2016-01-28T17:49:23.947Z
2016-01-29T09:28:14.867Z
2016-01-29T09:28:14.867Z
Jannes
<p>Is a simple question, but I want to understand this at the low level.</p>

<p>Since the UTXO is a database with the yet-to-be-spent coins, how can I say that a given coin was already full spent? What would be a "half"-spent coin (if this is even possible)?</p>

CC BY-SA 3.0
2016-01-28T17:33:52.363Z
Bitcoin really doesn't have a notion of "coins" as individual objects.  There are only transactions which can be of arbitrary amounts.
Nate Eldredge
CC BY-SA 3.0
2016-01-28T17:39:10.377Z
Yeah, I "kind of" understand this, but how can the UXTO be built anyway?
Henrique Barcelos
<utxo><spending>
How is it possible to say that a bitcoin was fully spent?
Henrique Barcelos
# How is it possible to say that a bitcoin was fully spent?

(Asked by: username_0 on 2016-01-28)

Is a simple question, but I want to understand this at the low level.

Since the UTXO is a database with the yet-to-be-spent coins, how can I say that a given coin was already full spent? What would be a "half"-spent coin (if this is even possible)?

**Tags:** utxo, spending

> **Comments:**
> **username_1**: Bitcoin really doesn't have a notion of "coins" as individual objects.  There are only transactions which can be of arbitrary amounts.  
> **username_0**: Yeah, I "kind of" understand this, but how can the UXTO be built anyway?  

---

## 3 answers

### Answer by username_4 on 2016-01-28. Score: 6 | Accepted answer

An output ("coin") is by definition either fully unspent or completely spent. There is nothing in between. A transaction has one or more inputs (which refer to the unspent outputs of earlier transaction) and it fully consumes them.

A transaction can also have 1 or more outputs. For each output a value is specified (number of Satoshis), so by being a little creative you can easily split or merge "coins".

This way Bitcoin "simply" needs to remember only the last outputs of a chain of transactions, there is no point in remembering (indexing) anything older. That's what the UTXO set is: Unspent Transaction Outputs database.

> **Comments:**
> **username_0**: So, in addition to the Blockchain, there is a transaction chain? Hmmm, that's new to me :). Could you please elaborate this part? How can I track what is in the "head" of the transaction chain?  
> **username_3**: @username_0 Transaction Chain: What he means is that whenever the money gets sent somewhere else only the latest transaction's output is relevant. Much like a one dollar bill might have switched owners a hundred times in the last month, but it's only relevant that it's now in your wallet. There is no dedicated data structure that collects this information in that form, but it just exists implicitly as the history of a transaction output in form of the related transactions spread out in the blocks of the blockchain.  
> **username_4**: @username_0 Like username_3 explains. I don't think transaction chain is an official word here, I just made it up. But thinking about it: when you look at the latest transaction you can jump back to the previous and the previous etc. Bit like a linked list (or chain) although in fact it's a graph since transactions generally have multiple input and outputs. Transaction graph is the term I have seen mentioned. I'll change the answer to use "a chain of transactions" to make it a bit more clear.  
> **username_0**: Fair enough, thank your for your clarifications (:  

---

### Answer by username_2 on 2017-02-23. Score: 1

Besides the whole blockchain database there is actually another database continuosly updated in each full node: The UTXO pool memory.
When a transaction with a determined input sucesfully spend some transaction output, this outpus is removed from the UTXO pool memory. Otherwise the handle of the databases to find if a given UTXO hasn't been called by any input of any transaction included in the blockchain would be strenuous.
Remember that an UTXO can only be spent once and you have to enable the verify engine to quickly check whether an UTXO is still available for spending by any future input.

> **Comments:**
> **username_3**: Your answer seems correct, but the last sentence is phrased a bit confusingly. I think you mean to say that a UTXO can only be spent once and you have to be able to quickly check whether a UTXO is still available for spending. The way your answer puts it, it sounds as if one could spend parts of a UTXO which is not correct though.  
> **username_2**: You put it in a much more clearer way. Thank you!  
> **username_3**: The way it works here is that you just edit your post to improve it. That way we'll always have as good as possible answers to all questions. :)  
> **username_3**: Thanks for the edit! :) Have you seen our [tour]?  

---

### Answer by username_3 on 2016-01-28. Score: 1

**UTXO can only be spent completely.**

This happens by claiming them in the Transaction Input Script and requires a valid signature corresponding to the address the UTXO is associated with.

The transaction inputs' value is then reassigned by the transaction to create new unspent transaction outputs. Usually, there are at least two outputs, one going to the recipient of the payment, and a **change output** going back to the wallet of the sender. The sum of the assigned outputs must be smaller than or equal to the sum of consumed inputs.

Any amount that doesn't get assigned to new outputs can be claimed by the successful miner as **transaction fee** in the Coinbase transaction of the block the transaction gets included in.

When a block gets found, all nodes in the network enact all the transactions on their UTXO set, marking the inputs as spent and replacing them with the newly minted unspent transaction outputs.


---

