Self-contained coin-selection library extracted from cardano-wallet — balance-aware coin selection, collateral selection, and UTxO index/selection structures, with its own lightweight primitive types (Coin, TokenBundle, TokenMap, …) and zero Cardano-ecosystem dependencies (Hackage only).
This first release also makes the library run in the browser.
✨ Highlights
- Coin selection in the browser. The exact same Haskell implementation, compiled to
wasm32-wasi, runs fully client-side — no JavaScript reimplementation of the algorithm to drift or go unaudited. Try it live:
→ https://cardano-foundation.github.io/cardano-coin-selection/demo/ - Native ≡ WASM, enforced in CI. A
coin-selectexecutable runs the same deterministic selection on both targets, and CI asserts the native andwasmtimeoutputs are byte-identical on every commit. - Portable by construction. A dependency audit found only one WASM-hostile package (
memory, swapped toramunderarch(wasm32)); everything else is pure Hackage. See the WASM portability notes. - Lean for consumers. Generators and test helpers live in an internal sublibrary, so depending on
cardano-coin-selectiondoes not pullhspec/QuickCheck/pretty-simpleinto your build. - Library surface:
Cardano.CoinSelection—Balance,Collateral,UTxOIndex,UTxOSelection— plus the primitive types.
📦 Asset
-
coin-select.wasm— the selection executable compiled towasm32-wasi. Plain-text stdin/stdout contract:# stdin # stdout utxo a 2000000 selected a 2000000 utxo b 3000000 selected b 3000000 output addr 4500000 change 500000Run it under
wasmtime coin-select.wasm, or load it in a browser with@bjorn3/browser_wasi_shim(that's what the live demo does).
📚 Docs
0.1.0 (2026-06-23)
Features
- add coin selection library and primitive types (d7695ae)
- add equipartition functions, NonRandom module, and dev tooling (29043ab)
- add Gen modules, test utilities, and 3 test specs (d38eaa3)
- add interactive coin selection ui (f0225ec)
- add text stdin coin selection executable (49eed16)
- add wasm smoke executable (9f91d64)
- make coin selection choices visible (11ac7f9)
- port BalanceSpec and CoinSelectionSpec test suites (#5) (ee353e3)
- scaffold purescript spa wasm loader (664a5d4)
Bug Fixes
- align documentation with actual source code (9372afb)
- migrate mkdocs gh-deploy to mkdocs-deploy wrapper (c1214e1), closes #7
- remove cabal-fmt from dev shell (e7628b8)
- restore UTxOIndex and UTxOSelection generators (059e600)
- sync release-please with cabal version (81a3c63)
Documentation
- add browser run instructions (7a80825)