Expand description
Simple UTXO coin selection for eCash (XEC) transactions.
Strategy: largest-first. Pick the biggest UTXOs until we have enough to cover the target amount + estimated fee. Produces change output if there’s surplus above a dust threshold.
This is a cold-path construction utility (Tier-2). It allocates internally but the public output is caller-buffered via return values.
Structs§
- Coin
Selection - Result of coin selection.
Constants§
- BASE_
FEE_ SATS - Estimated transaction fee in satoshis for a simple P2PKH tx. ~1 input + 2 outputs ≈ 226 bytes × 1 sat/byte = 226 sats. We use a conservative estimate.
- DUST_
THRESHOLD_ SATS - Minimum output value (in satoshis) below which we skip creating a change output. For XEC: 546 satoshis = 5.46 XEC dust threshold.
- PER_
INPUT_ FEE_ SATS - Per-input fee contribution in satoshis (~148 bytes per additional input).
Functions§
- select_
token_ utxos - Select UTXOs that contain a specific SLP/ALP token. Returns the token UTXOs + plain XEC UTXOs needed to cover the fee.
- select_
utxos - Select UTXOs to cover
target_satsusing largest-first strategy.