cardano-coin-selection¶
Coin selection algorithms for the Cardano blockchain.
This library provides a complete solution for selecting UTxO entries to fund transactions on Cardano, including multi-asset support, change generation, fee estimation, minting/burning, and collateral selection.
Modules¶
| Module | Purpose |
|---|---|
Cardano.CoinSelection |
High-level entry point combining balance and collateral selection |
Cardano.CoinSelection.Balance |
Random-Round-Robin algorithm for multi-asset UTxO sets |
Cardano.CoinSelection.Collateral |
Dual-strategy collateral selection |
Cardano.CoinSelection.UTxOIndex |
Asset-indexed UTxO set with efficient asset-indexed lookup |
Cardano.CoinSelection.UTxOSelection |
Selected/leftover state machine |
Cardano.CoinSelection.Context |
Type class for selection contexts |
Cardano.CoinSelection.Size |
Token bundle size assessment |
Quick links¶
- Getting Started -- installation and basic usage
- Tutorial -- step-by-step coin selection walkthrough
- Selection Strategies -- Optimal vs Minimal
- UTxO Index -- the core data structure
- References -- papers and blog posts
Design principles¶
The coin selection algorithm is designed around several key principles:
-
Self-organisation: the UTxO set should evolve over time to resemble the typical distribution of payments made by the wallet owner, increasing the likelihood that future selections succeed.
-
Privacy: change outputs should be roughly the same size and shape as user-specified outputs, making it harder for an observer to distinguish change from payments.
-
Efficiency: the algorithm must terminate in bounded time and produce selections that minimise fees.
-
Correctness: all selections satisfy a set of formally verified properties -- checked by the test suite via QuickCheck.