0

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?

2

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? .

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

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.