Reconcile a Cardano collateral return after phase-two failure
A script transaction can reserve more collateral than it intends to forfeit. The collateral return output determines how the excess is represented if phase-two validation fails on chain.
Balance the failure branch
For the ADA-only example, five million lovelace are selected as collateral and one and a half million are declared as total collateral. The remaining three and a half million belong in the collateral return output.
collateral input = 5,000,000 lovelace
total collateral = 1,500,000 lovelace
collateral return = 3,500,000 lovelace
On the successful path, the collateral inputs are not consumed as collateral and the collateral return is not created. On the failure path processed by the ledger, account for consumed collateral and the return according to the body.
Distinguish local rejection from on-chain failure
A wallet or node can reject a bad transaction before block inclusion. That alone causes no collateral loss. Inspect the included transaction’s validity indication and actual UTxO changes before reporting a forfeiture. cips.cardano.org Cardano CIP-40