Module

Cardano.Collateral.Select

#maxCandidateUtxos

maxCandidateUtxos :: Int

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

#selectCollateral

selectCollateral :: Coin -> Int -> Coin -> 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 minRequiredCollateral Ada

  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