What is this query about "UtxoNotEnoughFragmented?

Here, I’m developing web service on cardano with php code via wallet-api v1 so all my code has been running but when i do transaction from destination to source address it gives me error with this message that “UtxoNotEnoughFragmented” as my account has 0 balance. but earlier I got this message like “You do not have enough money to send” but after sometime it continuously getting this Utxos errors.

{"status":"error","diagnostic":{"details":{"help":"Utxo is not enough fragmented to handle the number of outputs of this transaction. Query /api/v1/wallets/{walletId}/statistics/utxos endpoint for more information","missingUtxos":1}},"message":"UtxoNotEnoughFragmented"}

1 Like

About UTXO Fragmentation

As described in Sending Money to Multiple Recipients, it is possible to send ada to more than one destination. Cardano only allows a given UTXO to cover at most one single transaction output. As a result, when the number of transaction outputs is greater than the number the API returns a UtxoNotEnoughFragmented error which looks like the following

{
    "status": "error",
    "diagnostic": {
        "details": {
            "help": "Utxo is not enough fragmented to handle the number of outputs of this transaction. Query /api/v1/wallets/{walletId}/statistics/utxos endpoint for more information",
            "missingUtxos": 1
        }
    },
    "message": "UtxoNotEnoughFragmented"
}

To make sure the source account has a sufficient level of UTXO fragmentation (i.e. number of UTXOs),
please monitor the state of the UTXOs as described in Getting UTXO Statistics. The number of wallet UTXOs should be no less than the transaction outputs, and the sum of all UTXOs should be enough to cover the total transaction amount, including fees.

Contrary to a classic accounting model, there’s no such thing as spending part of a UTXO, and one has to wait for a transaction to be included in a block before spending the remaining change. This is very similar to using bank notes: one can’t spend a USD 20 bill at two different shops at the same time,
even if it is enough to cover both purchases — one has to wait for change from the first transaction before making the second one.

There’s no “ideal” level of fragmentation; it depends on one’s needs. However, the more UTXOs that are available, the higher the concurrency capacity of one’s wallet, allowing multiple transactions to be made at the same time.

Similarly, there’s no practical maximum number of UTXOs, but there is nevertheless a maximum transaction size. By having many small UTXOs, one is taking the risk of hitting that restriction, should too many inputs be selected to fill a transaction. The only way to work around this is to make multiple smaller transactions.