<p>That is correct. For a UTxO to be consumed it first has to exist on the blockchain. For it to exist on the blockchain the transaction that created it must exist in a block that has been confirmed by the network.</p>

CC BY-SA 4.0
2021-05-13T14:26:46.923Z
2021-05-13T14:26:46.923Z
nalyd88
<p>You can only grab the gift once it's confirmed on the ledger. Search for <code>awaitTxConfirmed</code> in the source code.</p>
<p>That effect may have configurable level of confirmation in the future as indicated in the <a href="https://github.com/input-output-hk/plutus/blob/cc953b36ec9681cc28edf1accf08f48a31238e69/plutus-contract/src/Plutus/Contract/Effects/AwaitTxConfirmed.hs" rel="nofollow noreferrer">source code</a>.</p>

CC BY-SA 4.0
2021-05-13T14:06:25.530Z
2021-05-13T14:06:25.530Z
Matthias Sieber
<p>It is possible, at least with a recent version of cardano-cli (don't know about earlier ones, but I assume it would work too) to issue two transactions sequentially where the output of tx n is used as the input of tx n + 1. Both transactions will be put into the same block.</p>
<p><a href="https://cardanoscan.io/block/5723141" rel="nofollow noreferrer">Here's</a> a block where I've done so a few days ago, the first two transactions are by me. You can see that the second tx uses the first one as input.</p>
<p>Edit: In the context of plutus smart contracts however, I think Matthias is correct.</p>

CC BY-SA 4.0
2022-10-06T08:06:24.977Z
This isn't a limitation of Plutus scripts in general, but the plutus-contract library. Transaction chaining is possible with and without Plutus scripts involved.
james
CC BY-SA 4.0
2021-05-20T10:50:44.607Z
2021-05-20T11:22:14.647Z
2021-05-20T11:22:14.647Z
tycl
<p>In the <a href="https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week02/src/Week02/Gift.hs" rel="noreferrer">Gift.hs</a> example from the second lecture in Plutus Pioneers Program, when I give ada, a UTxO is produced. When I want to grab that ada in the same block, it fails (There is no input or output when simulated in the palyground). But when I wait for one block and then try to grab, It succeeds.</p>
<p>My conclusion is we cannot produce and consume a UTxO in the same block. We can only consume a UTxO from the next block onward. Am I right or...?</p>

<plutus><utxo>
When a UTxO becomes available for consumption?
# When a UTxO becomes available for consumption?

(Asked by: username_0 on 2021-05-13)

In the [Gift.hs](https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week02/src/Week02/Gift.hs) example from the second lecture in Plutus Pioneers Program, when I give ada, a UTxO is produced. When I want to grab that ada in the same block, it fails (There is no input or output when simulated in the palyground). But when I wait for one block and then try to grab, It succeeds.

My conclusion is we cannot produce and consume a UTxO in the same block. We can only consume a UTxO from the next block onward. Am I right or...?

**Tags:** plutus, utxo

---

## 3 answers

### Answer by username_1 on 2021-05-13. Score: 7 | Accepted answer

That is correct. For a UTxO to be consumed it first has to exist on the blockchain. For it to exist on the blockchain the transaction that created it must exist in a block that has been confirmed by the network.


---

### Answer by username_2 on 2021-05-13. Score: 3

You can only grab the gift once it's confirmed on the ledger. Search for `awaitTxConfirmed` in the source code.

That effect may have configurable level of confirmation in the future as indicated in the [source code](https://github.com/input-output-hk/plutus/blob/cc953b36ec9681cc28edf1accf08f48a31238e69/plutus-contract/src/Plutus/Contract/Effects/AwaitTxConfirmed.hs).


---

### Answer by username_3 on 2021-05-20. Score: 1

It is possible, at least with a recent version of cardano-cli (don't know about earlier ones, but I assume it would work too) to issue two transactions sequentially where the output of tx n is used as the input of tx n + 1. Both transactions will be put into the same block.

[Here's](https://cardanoscan.io/block/5723141) a block where I've done so a few days ago, the first two transactions are by me. You can see that the second tx uses the first one as input.

Edit: In the context of plutus smart contracts however, I think Matthias is correct.

> **Comments:**
> **username_4**: This isn't a limitation of Plutus scripts in general, but the plutus-contract library. Transaction chaining is possible with and without Plutus scripts involved.  

---

