<p>I have found the error. The function is completely fine. I passed the wrong amount to the output...</p>

CC BY-SA 4.0
2022-09-26T04:49:53.657Z
2022-09-26T04:49:53.657Z
Tetiana Diachenko
<p>So back in the day when I received the <code>UTxO Balance Insufficient</code> error on Cardano-cli, it usually meant I didn't properly calculate the breakdown of the UTXO transitions in terms of transaction cost calculation, change, and UTXOs involved.</p>
<p>With that said, I think you should just double check the calculation for how the UTXOs are spent.</p>
<p>Since you're using the serialisation-lib I know that things can get very complex in that department so I recommend reaching out to teams like dcSpark who actively maintain and build with it.</p>
<p>Hope this helps (and if it doesn't hope help comes eventually)</p>

CC BY-SA 4.0
2022-09-24T21:01:56.603Z
2022-09-24T21:01:56.603Z
Pizza Knight
<p>I am building an NFT marketplace on Cardano.</p>
<p>To build my transactions I use cardano-serialization-lib. When I try to use <code>add_inputs_from()</code> with <code>LargestFirstMultiAsset</code> strategy to choose inputs for the transaction that sends an NFT to the Plutus contract address, I get a <code>UTxO Balance Insufficient</code>.</p>
<p>I definitely have the NFT UTxO in the wallet, and I also have around 100 tAda that isn't locked with any tokens.</p>
<p>Could it be related to minAdaValue? Because it will be greater for the output that goes to the contract (because of datum hash) than what is currently locked with the token...</p>

<plutus><cardano-serialization-lib><cip>
Coin Selection for Multiasset
# Coin Selection for Multiasset

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

I am building an NFT marketplace on Cardano.

To build my transactions I use cardano-serialization-lib. When I try to use `add_inputs_from()` with `LargestFirstMultiAsset` strategy to choose inputs for the transaction that sends an NFT to the Plutus contract address, I get a `UTxO Balance Insufficient`.

I definitely have the NFT UTxO in the wallet, and I also have around 100 tAda that isn't locked with any tokens.

Could it be related to minAdaValue? Because it will be greater for the output that goes to the contract (because of datum hash) than what is currently locked with the token...

**Tags:** plutus, cardano-serialization-lib, cip

---

## 2 answers

### Answer by username_0 on 2022-09-26. Score: 0 | Accepted answer

I have found the error. The function is completely fine. I passed the wrong amount to the output...


---

### Answer by username_1 on 2022-09-24. Score: 0

So back in the day when I received the `UTxO Balance Insufficient` error on Cardano-cli, it usually meant I didn't properly calculate the breakdown of the UTXO transitions in terms of transaction cost calculation, change, and UTXOs involved.

With that said, I think you should just double check the calculation for how the UTXOs are spent.

Since you're using the serialisation-lib I know that things can get very complex in that department so I recommend reaching out to teams like dcSpark who actively maintain and build with it.

Hope this helps (and if it doesn't hope help comes eventually)


---

