<p>You can find a great quick read on this topic here: <a href="https://cips.cardano.org/cips/cip2/#algorithms" rel="nofollow noreferrer">https://cips.cardano.org/cips/cip2/#algorithms</a> (or a big long one here <a href="https://iohk.io/en/blog/posts/2018/07/03/self-organisation-in-coin-selection/" rel="nofollow noreferrer">https://iohk.io/en/blog/posts/2018/07/03/self-organisation-in-coin-selection/</a>)</p>
<p>Basically it's the job of the wallet <em>(or whoever composes the transaction)</em> to implement such a selection strategy.</p>
<p>Two of those strategies proposed are &quot;Largest-First&quot; <em>(similar to what you mentioned)</em> and another is &quot;Random-Improve&quot;.</p>
<p>If you're interested, here's how the cardano-serialization-lib implemented the algorithms in practice in rust: <a href="https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L329" rel="nofollow noreferrer">https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L329</a></p>
<p>While Cardano Wallet gives priority to Random-Improve, there might be cases where you need to use Largest First, e.g. when creating multi-asset transactions with this lib <em>(<a href="https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L370" rel="nofollow noreferrer">https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L370</a>)</em>.</p>
<p>When you create the transaction yourself, eg through the Cardano CLI, you can also freely select which utxo to spend.</p>

CC BY-SA 4.0
2022-01-18T00:04:34.187Z
2022-01-18T00:04:34.187Z
sean
<p>I believe it's the same as with paying with cash: you have in principle the option of paying with the largest bill you have, so you make sure the amount is covered and you don't have to do a lot of maths, of getting rid of all the small coins you need to spend to reach the desired amount so you don't have to carry them in your pocket, or even of paying with the bill that is closest to the amount you have to pay to make it easy for the one giving you the change. As far as I know, wallets usually implement heuristics combining (at least the) first two options, so not just one strategy. I don't think it makes that much of a difference though, in the end money is money.</p>

CC BY-SA 4.0
2022-01-18T00:01:17.300Z
2022-01-18T00:01:17.300Z
Mihai Codescu
<p>As you perform transactions on the blockchain, you generate unspent transaction outputs of various sizes. When you create a new transaction, how are the UTXOs prioritised, i.e. which ones will be used first? Is it possible to specify which of your UTXOs you want to use? If I have one large UTXO and one small UTXO and I want to make a transaction with:</p>
<p>large UTXO &gt; transaction value &gt; small UTXO</p>
<p>Will the large UTXO automatically be used, or may I end up using both, and therefore leaving only a single UTXO as a result?</p>

CC BY-SA 4.0
2022-01-22T13:55:29.820Z
Welcome to Cardano SE! As a new user be sure to take the [Tour].
gRebel
<plutus-pioneer-program><eutxo>
PPP Cohort 3 - Q&A Week1: How are eUTXOs prioritised?
# PPP Cohort 3 - Q&A Week1: How are eUTXOs prioritised?

(Asked by: username_0 on 2022-01-17)

As you perform transactions on the blockchain, you generate unspent transaction outputs of various sizes. When you create a new transaction, how are the UTXOs prioritised, i.e. which ones will be used first? Is it possible to specify which of your UTXOs you want to use? If I have one large UTXO and one small UTXO and I want to make a transaction with:

large UTXO > transaction value > small UTXO

Will the large UTXO automatically be used, or may I end up using both, and therefore leaving only a single UTXO as a result?

**Tags:** plutus-pioneer-program, eutxo
> **Comments:**
> **username_1**: Welcome to Cardano SE! As a new user be sure to take the [Tour].  

---

## 2 answers

### Answer by username_2 on 2022-01-18. Score: 3

You can find a great quick read on this topic here: <https://cips.cardano.org/cips/cip2/#algorithms> (or a big long one here <https://iohk.io/en/blog/posts/2018/07/03/self-organisation-in-coin-selection/>)

Basically it's the job of the wallet *(or whoever composes the transaction)* to implement such a selection strategy.

Two of those strategies proposed are "Largest-First" *(similar to what you mentioned)* and another is "Random-Improve".

If you're interested, here's how the cardano-serialization-lib implemented the algorithms in practice in rust: <https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L329>

While Cardano Wallet gives priority to Random-Improve, there might be cases where you need to use Largest First, e.g. when creating multi-asset transactions with this lib *(<https://github.com/Emurgo/cardano-serialization-lib/blob/6a8c67a0fdb2ac6d72132d9693b87a6734f3fed5/rust/src/tx_builder.rs#L370>)*.

When you create the transaction yourself, eg through the Cardano CLI, you can also freely select which utxo to spend.


---

### Answer by username_3 on 2022-01-18. Score: 0

I believe it's the same as with paying with cash: you have in principle the option of paying with the largest bill you have, so you make sure the amount is covered and you don't have to do a lot of maths, of getting rid of all the small coins you need to spend to reach the desired amount so you don't have to carry them in your pocket, or even of paying with the bill that is closest to the amount you have to pay to make it easy for the one giving you the change. As far as I know, wallets usually implement heuristics combining (at least the) first two options, so not just one strategy. I don't think it makes that much of a difference though, in the end money is money.


---

