Your wallet holds a collection of UTXOs. When you send a transaction, a coin selection algorithm decides which ones to consume. This choice affects fees, privacy, and the long-term health of your wallet.
The problem is surprisingly deep. Say you want to send 65 ₳ and your wallet holds UTXOs of 5, 8, 10, 12, 15, 20, 30, and 50 ₳. There are multiple valid combinations: 50 + 20 (change: 5 ₳), 50 + 15 (exact match!), 30 + 20 + 15 (change: 0), 30 + 20 + 10 + 5 (change: 0), and many more. Each choice has consequences.
More inputs means a larger transaction in bytes, which means higher fees. But always picking the biggest UTXOs leaves behind a growing pile of tiny “dust” UTXOs that become uneconomical to spend. And linking UTXOs together in a single transaction reveals they belong to the same owner, affecting privacy.
This is why coin selection algorithms exist: to balance these competing goals automatically.
Three major approaches, each with distinct trade-offs.
Always picks the biggest available UTXOs until the target amount is covered. Simple, fast, predictable.
Randomly selects UTXOs to cover the amount, then tries to improve by swapping to produce a change output close to the wallet’s average UTxO size.
Tries to find a combination that exactly equals the target (no change needed). Falls back to other strategies when no exact match exists.
| Property | Largest First | Random Improve | Exact Match |
|---|---|---|---|
| Input count | Minimal | Variable | Variable |
| Fee efficiency | Good short-term | Balanced | Optimal (if found) |
| UTxO set health | Degrades over time | Maintains balance | Depends on fallback |
| Change output | Usually small | Targets average size | None (ideal case) |
| Privacy | Predictable pattern | Randomized | Minimal footprint |
| Computational cost | O(n log n) | O(n) | NP-hard |
Enter a send amount and see how each algorithm picks UTXOs from the same wallet.
When UTXOs become so small they cost more in fees to spend than they are worth, they are called “dust”. Bad coin selection creates dust. Good coin selection prevents it.
6 UTXOs · avg 30 ₳ · no dust
10 UTXOs · 6 dust · fragmented
On Cardano, every UTxO has a minimum ada requirement (minUTxO). A UTxO must hold enough ada to cover its on-chain storage cost. Dust UTXOs below this threshold cannot even be created. This is a protocol-level defense against UTxO set bloat, but smart coin selection is still essential to keep wallets efficient and fees low.
Every transaction links its inputs together. Coin selection directly impacts how much of your wallet structure you reveal on chain.
When multiple UTXOs are spent together in one transaction, an observer can conclude they belong to the same owner. This is called the “common input ownership heuristic”. The more UTXOs you combine per transaction, the more you reveal.
Largest First is the worst for privacy because it always picks the same UTXOs in the same order, making your spending patterns predictable. Random selection breaks this pattern and makes chain analysis harder.
Exact Match is the best for privacy in the rare cases where it works, because it uses only the inputs needed with no change output. A change output reveals that one of the two outputs goes back to you.
When a transaction has two outputs, chain analysts try to figure out which one is the payment and which is the change. Round amounts are usually payments (50 ₳). Odd amounts are usually change (13.847 ₳). Good wallets can mitigate this with techniques like multiple change outputs or change address rotation.
Cardano’s eUTxO model adds unique considerations to coin selection: native tokens, datum storage, and multi-asset UTXOs.
Multi-asset UTXOs make selection harder. A single UTxO on Cardano can carry ada plus multiple native tokens. When you want to send a specific token, the algorithm must also consider the ada bundled with it, and ensure the remaining ada covers minUTxO requirements.
Datum size affects fees. UTXOs locked at script addresses carry datums, which increase the transaction size. Coin selection must account for the byte cost of including datum-heavy UTXOs as inputs.
Cardano wallets (like Lace and Eternl) use variants of Random Improve, adapted for multi-asset selection. The algorithm first selects enough to cover the ada requirement, then ensures all requested tokens are also covered, and finally optimizes the change output to maintain a healthy UTxO distribution.
Cardano has a formal Improvement Proposal (CIP-2) that specifies coin selection algorithms. It defines the Random Improve strategy as the recommended approach and provides detailed guidance on handling multi-asset selection, change output optimization, and fallback strategies.
Optional. Score 3/3 to earn mastery badges. Your first attempt counts for the Polymath badge.