<p>To answer the title, utxos are entirely consumed and refered in transactions inputs.</p>
<blockquote>
<p>Now, How can John not spend 5 BTC anymore ?</p>
</blockquote>
<p>As long as the transaction spending it is in the most PoW block chain, no.</p>
<blockquote>
<p>The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ?</p>
</blockquote>
<p>If a valid transaction consumes it in a next block, it is marked as spent and not available anymore.</p>
<blockquote>
<p>how does it mark it as spent?</p>
</blockquote>
<p>By updating a database commonly refered to as &quot;the utxo set&quot; in which are recorded not-yet-spent UTXOs. See <a href="https://bitcoin.stackexchange.com/questions/28225/how-is-a-transaction-output-marked-as-spent/28260#28260">How is a Transaction Output Marked as Spent?</a> .</p>
<p>You likely want to give a look to questions regarding coin referencing and consumption by transactions, for example:</p>
<ul>
<li><a href="https://bitcoin.stackexchange.com/questions/99078/how-is-the-utxos-of-each-partially-spent-txin-determined">How is the UTXOs of each partially-spent TxIn determined?</a></li>
<li><a href="https://bitcoin.stackexchange.com/questions/96822/why-is-there-change-in-bitcoins">Why is there &quot;Change&quot; in Bitcoins?</a></li>
</ul>

CC BY-SA 4.0
2020-09-22T18:43:28.687Z
2020-09-22T18:43:28.687Z
Antoine Poinsot
<p>Let's say John gave 5 BTC to me. So, John took his unspent outputs and put it into inputs to create a transaction.  Let's say John already had a transaction which was holding exactly that amount of BTC.</p>
<p>Now, How can John not spend 5 BTC anymore ?  The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ? how does it mark it as spent?</p>

<bitcoin-core><blockchain><bitcoind>
how does bitcoin know which one is utxo?
Nika Kurashvili
# how does bitcoin know which one is utxo?

(Asked by: username_0 on 2020-09-22)

Let's say John gave 5 BTC to me. So, John took his unspent outputs and put it into inputs to create a transaction. Let's say John already had a transaction which was holding exactly that amount of BTC.

Now, How can John not spend 5 BTC anymore ? The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ? how does it mark it as spent?

**Tags:** bitcoin-core, blockchain, bitcoind


---

## 1 answers

### Answer by username_1 on 2020-09-22. Score: 2 | Accepted answer

To answer the title, utxos are entirely consumed and refered in transactions inputs.

> Now, How can John not spend 5 BTC anymore ?

As long as the transaction spending it is in the most PoW block chain, no.

> The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ?

If a valid transaction consumes it in a next block, it is marked as spent and not available anymore.

> how does it mark it as spent?

By updating a database commonly refered to as "the utxo set" in which are recorded not-yet-spent UTXOs. See [How is a Transaction Output Marked as Spent?](https://bitcoin.stackexchange.com/questions/28225/how-is-a-transaction-output-marked-as-spent/28260#28260) .

You likely want to give a look to questions regarding coin referencing and consumption by transactions, for example:

* [How is the UTXOs of each partially-spent TxIn determined?](https://bitcoin.stackexchange.com/questions/99078/how-is-the-utxos-of-each-partially-spent-txin-determined)
* [Why is there "Change" in Bitcoins?](https://bitcoin.stackexchange.com/questions/96822/why-is-there-change-in-bitcoins)


---

