<p>On the Cardano blockchain there are two stages where a transaction can fail.</p>
<p>In the first stage, there are some integrity checks that are run. Also the node checks if the UTxO-inputs of the transaction exist and are free to be spend. No scripts are run at this stage. If the validation fails, no fees are collected.</p>
<p>In the second stage, scripts are executed. If one of them fails, fees are collected. For this purpose, the transaction includes a collateral-UTxO.</p>
<p>In summary, no fees are collected for unpredictable failures and fees are collected for predictable failures. This protects against DoS with scripts that are expensive to execute and fail.</p>
<p>That being said, there can never be a complete protection against DoS in an open network. If the system is flooded by a huge amount of stage-1-invalid transactions, I guess that the Cardano distributed system would get into trouble. But I also think, that this type of attack are probably difficult and expensive to execute.</p>
<p>There is a nice article explaining the topic here:
<a href="https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/" rel="nofollow noreferrer">https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/</a></p>

CC BY-SA 4.0
2021-11-11T14:53:49.777Z
Thank you for the answer and the reference link. The approach makes sense in many ways.
Mr. D
CC BY-SA 4.0
2021-11-14T08:38:21.057Z
From what I understand nodes pull transactions when they are ready to process them, they are not pushed into the network, so this is an additional layer of DoS protection.
Scalextrix
CC BY-SA 4.0
2021-11-10T09:57:03.790Z
2021-11-10T09:57:03.790Z
Jey
<p>I've been hearing that in Cardano transaction fees are highly predictable (in contrast to Eth gas fees) and that <strong>failed transactions don't pay fees</strong>. This is in direct contradiction to the transaction fee equation in the official docs ( <a href="https://docs.cardano.org/explore-cardano/fee-structure" rel="nofollow noreferrer">https://docs.cardano.org/explore-cardano/fee-structure</a> ) which includes <strong>a minimal fee (a) to prevent DoS attacks</strong>.</p>
<p>So which is true? Are failed transactions free or do they always have to pay a min fee?</p>
<p>Edit: please elaborate how the system works in these cases for anybody who is reading to understand.</p>

<transaction>
Free failed transactions or DoS protection? Which is it?
# Free failed transactions or DoS protection? Which is it?

(Asked by: username_0 on 2021-11-10)

I've been hearing that in Cardano transaction fees are highly predictable (in contrast to Eth gas fees) and that **failed transactions don't pay fees**. This is in direct contradiction to the transaction fee equation in the official docs ( <https://docs.cardano.org/explore-cardano/fee-structure> ) which includes **a minimal fee (a) to prevent DoS attacks**.

So which is true? Are failed transactions free or do they always have to pay a min fee?

Edit: please elaborate how the system works in these cases for anybody who is reading to understand.

**Tags:** transaction

---

## 1 answers

### Answer by username_1 on 2021-11-10. Score: 2 | Accepted answer

On the Cardano blockchain there are two stages where a transaction can fail.

In the first stage, there are some integrity checks that are run. Also the node checks if the UTxO-inputs of the transaction exist and are free to be spend. No scripts are run at this stage. If the validation fails, no fees are collected.

In the second stage, scripts are executed. If one of them fails, fees are collected. For this purpose, the transaction includes a collateral-UTxO.

In summary, no fees are collected for unpredictable failures and fees are collected for predictable failures. This protects against DoS with scripts that are expensive to execute and fail.

That being said, there can never be a complete protection against DoS in an open network. If the system is flooded by a huge amount of stage-1-invalid transactions, I guess that the Cardano distributed system would get into trouble. But I also think, that this type of attack are probably difficult and expensive to execute.

There is a nice article explaining the topic here:
<https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/>

> **Comments:**
> **username_0**: Thank you for the answer and the reference link. The approach makes sense in many ways.  
> **username_2**: From what I understand nodes pull transactions when they are ready to process them, they are not pushed into the network, so this is an additional layer of DoS protection.  

---

