<blockquote>
  <p>is it possible to add transaction and its parent to the same block?</p>
</blockquote>

<p>Yes, as long as A exists in the mempool when B is submitted, it will be allowed in the mempool, and can be in the same block, see <a href="https://bitcoin.stackexchange.com/questions/23035/order-of-transactions-within-a-block/23070#comment35633_23070">Order of transactions within a block</a>. A transaction that consumes invalid unspent outputs (UTXOs) will be rejected before it enters the mempool.</p>

<p>If a miner mines a block with a transaction (in this case B) that has an invalid input (ie the UTXO it is spending does not exist), the block will be rejected when it is submitted because it is a block with invalid transactions.</p>

CC BY-SA 4.0
2018-08-20T14:02:10.950Z
2018-08-20T20:13:27.550Z
2018-08-20T20:13:27.550Z
JBaczuk
<blockquote>
  <p>I.e., is it possible to add transaction and its parent to the same block?</p>
</blockquote>

<p>Yes. The "parent" transaction must be earlier in block.</p>

CC BY-SA 4.0
2018-08-20T13:37:52.577Z
2018-08-20T13:37:52.577Z
amaclin
<p>I'm trying to understand bitcoin transactions verification specified <a href="https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages" rel="nofollow noreferrer">here</a>. Item 10 states, that parent transaction (mentioned as input for current) should be searched not only in already confirmed transactions (in main chain), but also in transaction pool (which contains unconfirmed transactions). This means, that transaction can become a candidate to be added to block even if it's parent is not in the blockchain. If this is true, than consider following situation:</p>

<ol>
<li>Transactions A and B are created in the same moment, A is parent of B.</li>
<li>Miner receives both of them, both are considered valid.</li>
<li>Miner adds only transaction B to block.</li>
</ol>

<p>If such block is mined, it will be invalid, because other nodes will fail to validate transaction B. But if we also insert transaction A in it, will validation succeed on other nodes? I.e., is it possible to add transaction and its parent to the same block?</p>

CC BY-SA 4.0
2018-08-21T09:46:08.933Z
Yes, you're right. I performed search using different search strings and did not see this post, thank you.
Anton Pantuykhin
<transactions><bitcoin-core><blockchain>
Bitcoin: can transaction and its parent be in the same block
Anton Pantuykhin
# Bitcoin: can transaction and its parent be in the same block

(Asked by: username_0 on 2018-08-20)

I'm trying to understand bitcoin transactions verification specified [here](https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages). Item 10 states, that parent transaction (mentioned as input for current) should be searched not only in already confirmed transactions (in main chain), but also in transaction pool (which contains unconfirmed transactions). This means, that transaction can become a candidate to be added to block even if it's parent is not in the blockchain. If this is true, than consider following situation:

1. Transactions A and B are created in the same moment, A is parent of B.
2. Miner receives both of them, both are considered valid.
3. Miner adds only transaction B to block.

If such block is mined, it will be invalid, because other nodes will fail to validate transaction B. But if we also insert transaction A in it, will validation succeed on other nodes? I.e., is it possible to add transaction and its parent to the same block?

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

> **Comments:**
> **username_0**: Yes, you're right. I performed search using different search strings and did not see this post, thank you.  

---

## 2 answers

### Answer by username_1 on 2018-08-20. Score: 1 | Accepted answer

> is it possible to add transaction and its parent to the same block?

Yes, as long as A exists in the mempool when B is submitted, it will be allowed in the mempool, and can be in the same block, see [Order of transactions within a block](https://bitcoin.stackexchange.com/questions/23035/order-of-transactions-within-a-block/23070#comment35633_23070). A transaction that consumes invalid unspent outputs (UTXOs) will be rejected before it enters the mempool.

If a miner mines a block with a transaction (in this case B) that has an invalid input (ie the UTXO it is spending does not exist), the block will be rejected when it is submitted because it is a block with invalid transactions.


---

### Answer by username_2 on 2018-08-20. Score: 1

> I.e., is it possible to add transaction and its parent to the same block?

Yes. The "parent" transaction must be earlier in block.


---

