Module

Ctl.Internal.BalanceTx.Collateral.Select

#maxCandidateUtxos

maxCandidateUtxos :: Int

A constant that limits the number of candidate utxos for collateral selection, thus maintaining acceptable time complexity.

#minRequiredCollateral

#selectCollateral

selectCollateral :: Coin -> Int -> UtxoMap -> Maybe (List TransactionUnspentOutput)

Selects an utxo combination to use as collateral by generating all possible utxo combinations and then applying the following constraints:

  1. maxCollateralInputs protocol parameter limits the maximum cardinality of a single utxo combination.

  2. Collateral inputs must have a total value of at least 5 Ada (minRequiredCollateral).

  3. We prefer utxo combinations that require the lowest utxo min ada value for the corresponding collateral output, thus maintaining a sufficient totalCollateral.

  4. If two utxo combinations correspond to return outputs with the same utxo min ada value, we prefer the one with fewer inputs.

Modules