Should the collateral UTxO be an input to my smart contract transaction?

Hello! I have fairly recently carried out some trades using a popular DEX (Minswap) and I noticed that, in my transaction, there were no collateral UTxOs. I was able to initiate it because I used the Eternl Wallet. It shows that I have a collateral UTxO - which is one of my wallet’s internal change addresses - but that UTxO was not included in the transaction. Thus, the transaction had no collateral UTxOs. Is this normal? Are there any risks associated with this?

The collateral UTxO does not have to be a normal input to a transaction. Collateral inputs (and outputs) are set separately.

They are only relevant if the validation of a script in the inputs fails. Only then the collateral is taken. This should happen virtually never on Cardano (since Cardano smart contracts are designed so that you can evaluate beforehand if they will be successful – which is different on other chains where failure might be a normal and desired result of a script).

It is safe to have a transaction without collateral inputs (and outputs). If collateral is needed that would just be invalid and disregarded at all.

What is possible here is that whatever you were looking at had no information on collateral inputs and outputs, but just on normal inputs and outputs.

The other possibility is that the interaction did not even need collateral. A lot of dApp interactions just put assets and a datum on the address of a smart contract (to be picked up by some form of batcher later). Those do not need collateral. It is only needed when spending from a contract address. … which is why the “How do I set collateral?” often only come when they try to cancel a swap, not when they place it at the beginning.

Thank you for taking the time to write such a detailed and nuanced response! It answered more questions than I knew I had and I feel like I have a much more accurate understanding of the collateral system now.

Could you please link the sources for your information? I’d like to read more on the topic and I think they are likely to be useful for anyone else reading this thread.

Again thanks a lot!

High-level documentation is here: https://docs.cardano.org/smart-contracts/plutus/collateral-mechanism/

Should be a surprisingly good and up-to-date starting point. (I often fear the “Sources?” question because it’s often so scattered and more experience from many, many sources, but this one is good.)

1 Like