<p>Bitcoin Core maintains the set of unconfirmed transactions it knows about in the mempool. The mempool data structure tracks which UTXOs are consumed and created by those unconfirmed transactions. When a new transaction comes in, it will find outputs either in the UTXO set, or in the pending outputs in the mempool.</p>
<p>Naturally, any transaction that gets included in a block must only spend UTXOs that were created before it is spending them. Thus, any parent transactions must appear in the block before a corresponding child transaction.</p>

CC BY-SA 4.0
2024-10-28T18:00:09.143Z
2024-10-28T18:00:09.143Z
Murch
<p>If a UTXO is not added to the UTXO set before transaction is mined, how is a chain of unconfirmed transactions created? Where are the inputs taken from?</p>
<p>PS: I am making a blockchain from scratch. It would be really helpful if you can explain the transaction implementation considering all the possible cases.</p>

<transactions><utxo><mempool>
Are UTXOS added to the UTXO set instantly after a transaction is created or after the transaction is mined?
Ashank
# Are UTXOS added to the UTXO set instantly after a transaction is created or after the transaction is mined?

(Asked by: username_0 on 2024-10-28)

If a UTXO is not added to the UTXO set before transaction is mined, how is a chain of unconfirmed transactions created? Where are the inputs taken from?

PS: I am making a blockchain from scratch. It would be really helpful if you can explain the transaction implementation considering all the possible cases.

**Tags:** transactions, utxo, mempool


---

## 1 answers

### Answer by username_1 on 2024-10-28. Score: 0

Bitcoin Core maintains the set of unconfirmed transactions it knows about in the mempool. The mempool data structure tracks which UTXOs are consumed and created by those unconfirmed transactions. When a new transaction comes in, it will find outputs either in the UTXO set, or in the pending outputs in the mempool.

Naturally, any transaction that gets included in a block must only spend UTXOs that were created before it is spending them. Thus, any parent transactions must appear in the block before a corresponding child transaction.


---

