<p><strong>EDIT nov-02-2021: I misspoke earlier, details at the bottom.</strong></p>
<p>Cardano is not intrinsically flashloan-attackless. Functional programming and formal verification help you a lot with the distance between spec and implementation, but do not give you anything with the distance between reality and spec. Reality (edge cases, attackers, things you failed to foresee) will be what gets you if your devs didn't let a simple bug through. Any proof engineer will tell you that <strong>false sense of security</strong> is a risk <em>introduced by</em> formal verification</p>
<p>It's tricky because we only use one word: &quot;exploit&quot; - when what we mean is either exploits at the software implementation level or exploits at the mechanism design level, but not both. The literature is infused with ambiguity, one must read diligently if they want to disambiguate this.</p>
<p>If you make progress on this, charge someone a lot of money.</p>
<p>EDIT: Cardano is in fact intrinsically flashloan-attackless at this time, but it is not because of &quot;formal verification&quot;, it's because there are no <strong>multi-step yet atomic transactions</strong>. Flashloans, by definition, are an atomic transaction where an uncollateralized loan happens in the first step and it gets repaid in the last step. No multi-step yet atomic transactions, no flashloans, no flashloan attacks.</p>

CC BY-SA 4.0
2021-09-15T19:14:54.790Z
As long as you understand what formal verification can do, and can't do, I don't see why this should give a "false sense of security". And of course there will be buggy smart-contracts on cardano as well.
j.karlsson
CC BY-SA 4.0
2021-09-15T00:46:48.723Z
2021-11-02T18:24:31.887Z
2021-11-02T18:24:31.887Z
Quinn Dougherty
<p>Flash loans generally exploit financial protocol vulnerabilities to manipulate the prices and exploit the system. For example, In the 2020 attack on Fulcrum built using bZx protocol, attackers used borrowed Ether to manipulate the price of sUSD( a stable coin); naturally, the price of the stable coin should have remained stable to prevent the attack. Smart contract writers should have anticipated the instability of stable coin prices under unusual market conditions. Formal verification methods would have identified this hidden issue.</p>
<p>Theoretically, these higher protocols are influenced by the underlying blockchain technology, which results in unreliable smart contract state estimation.</p>
<p>Cardano has brought the &quot;Formal Methods&quot; paradigm in creating smart contracts, enabling precise estimation of smart contracts behaviors provably. Moreover, Plutus is designed with such care to enable this technology. The potential of this mathematical precision has not yet been realized in the current ETH-dominated DeFi. In short, Cardano will prevent this type of protocol attacks by enabling smart contract writers to predict what can go wrong in which setting.</p>

CC BY-SA 4.0
2021-05-29T19:52:05.327Z
2021-05-30T02:45:15.027Z
2021-05-30T02:45:15.027Z
raghu
<p>While flash loans will exist on Cardano, flash loan attacks will not.</p>
<p>To understand why, let's examine that PancakeBunny attack, <a href="https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/" rel="nofollow noreferrer">https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/</a></p>
<ol>
<li>Hacker used PancakeSwap to borrow a large amount of BNB</li>
<li>Hacker used these funds to to manipulate the price of USDT/BNB as well as BUNNY/BNB</li>
<li>Hacker received a large amount of BUNNY tokens</li>
<li>Hacker dumped BUNNY tokens onto the market, causing BUNNY price to crash</li>
<li>Hacker paid back BNB back to PancakeSwap, closing the flash loan</li>
</ol>
<p><a href="https://twitter.com/PancakeBunnyFin/status/1395173389208334342" rel="nofollow noreferrer">https://twitter.com/PancakeBunnyFin/status/1395173389208334342</a></p>
<p>This pattern is a common vector for flash loan attacks.  Key to the success of this attack is the ability to chain the execution of multiple smart contracts in series within a single blockchain transaction.</p>
<p>On Cardano, this simply won't be possible by design.</p>
<ul>
<li>A single blockchain transaction represents activity that occurs simultaneously, not in series</li>
<li>And while Cardano does support chaining smart contracts, they must be chained over a series of transactions not a single transaction</li>
</ul>
<p>So how would flash loans on Cardano work?  One option would be to write a validator script that implements the following rule: allow this UTXO to be spent so long as it is spent back into the same script address plus interest.</p>
<p>By design, the number of cases where this will be useful will be far more limited than on some other blockchains.</p>

CC BY-SA 4.0
2022-01-28T03:57:12.773Z
what are your thoughts on this article?https://medium.com/@khajepour.amirhossein/the-curse-of-flash-loan-in-cardano-62969dd0ea88
dev
CC BY-SA 4.0
2021-11-02T21:44:03.677Z
2021-11-02T21:44:03.677Z
Matt Ho
<p>Flash loans attacks are current in DeFi space and we saw several ones these last weeks on the Binance smart chain. (Pancake Bunny and Burger swaps)</p>
<p>Mr. Hoskinson said numerous times that if it took years for Cardano to implement smart contracts and DeFi, it was to avoid such attacks and to have a more secure plateform.</p>
<p>My question would therefore be :
Will projects on Cardano be flash-loans-attacksless? If yes how? If not, can we find a way to secure it?</p>
<p>Thanks in advance</p>

<security>
What prevents flash loans attacks from occurring on the Cardano network?
# What prevents flash loans attacks from occurring on the Cardano network?

(Asked by: username_0 on 2021-05-29)

Flash loans attacks are current in DeFi space and we saw several ones these last weeks on the Binance smart chain. (Pancake Bunny and Burger swaps)

Mr. Hoskinson said numerous times that if it took years for Cardano to implement smart contracts and DeFi, it was to avoid such attacks and to have a more secure plateform.

My question would therefore be :
Will projects on Cardano be flash-loans-attacksless? If yes how? If not, can we find a way to secure it?

Thanks in advance

**Tags:** security

---

## 3 answers

### Answer by username_4 on 2021-11-02. Score: 4

While flash loans will exist on Cardano, flash loan attacks will not.

To understand why, let's examine that PancakeBunny attack, <https://www.coindesk.com/markets/2021/05/20/flash-loan-attack-causes-defi-token-bunny-to-crash-over-95/>

1. Hacker used PancakeSwap to borrow a large amount of BNB
2. Hacker used these funds to to manipulate the price of USDT/BNB as well as BUNNY/BNB
3. Hacker received a large amount of BUNNY tokens
4. Hacker dumped BUNNY tokens onto the market, causing BUNNY price to crash
5. Hacker paid back BNB back to PancakeSwap, closing the flash loan

<https://twitter.com/PancakeBunnyFin/status/1395173389208334342>

This pattern is a common vector for flash loan attacks. Key to the success of this attack is the ability to chain the execution of multiple smart contracts in series within a single blockchain transaction.

On Cardano, this simply won't be possible by design.

* A single blockchain transaction represents activity that occurs simultaneously, not in series
* And while Cardano does support chaining smart contracts, they must be chained over a series of transactions not a single transaction

So how would flash loans on Cardano work? One option would be to write a validator script that implements the following rule: allow this UTXO to be spent so long as it is spent back into the same script address plus interest.

By design, the number of cases where this will be useful will be far more limited than on some other blockchains.

> **Comments:**
> **username_5**: what are your thoughts on this article?https://medium.com/@khajepour.amirhossein/the-curse-of-flash-loan-in-cardano-62969dd0ea88  

---

### Answer by username_1 on 2021-09-15. Score: 1

**EDIT nov-02-2021: I misspoke earlier, details at the bottom.**

Cardano is not intrinsically flashloan-attackless. Functional programming and formal verification help you a lot with the distance between spec and implementation, but do not give you anything with the distance between reality and spec. Reality (edge cases, attackers, things you failed to foresee) will be what gets you if your devs didn't let a simple bug through. Any proof engineer will tell you that **false sense of security** is a risk *introduced by* formal verification

It's tricky because we only use one word: "exploit" - when what we mean is either exploits at the software implementation level or exploits at the mechanism design level, but not both. The literature is infused with ambiguity, one must read diligently if they want to disambiguate this.

If you make progress on this, charge someone a lot of money.

EDIT: Cardano is in fact intrinsically flashloan-attackless at this time, but it is not because of "formal verification", it's because there are no **multi-step yet atomic transactions**. Flashloans, by definition, are an atomic transaction where an uncollateralized loan happens in the first step and it gets repaid in the last step. No multi-step yet atomic transactions, no flashloans, no flashloan attacks.

> **Comments:**
> **username_2**: As long as you understand what formal verification can do, and can't do, I don't see why this should give a "false sense of security". And of course there will be buggy smart-contracts on cardano as well.  

---

### Answer by username_3 on 2021-05-29. Score: 1

Flash loans generally exploit financial protocol vulnerabilities to manipulate the prices and exploit the system. For example, In the 2020 attack on Fulcrum built using bZx protocol, attackers used borrowed Ether to manipulate the price of sUSD( a stable coin); naturally, the price of the stable coin should have remained stable to prevent the attack. Smart contract writers should have anticipated the instability of stable coin prices under unusual market conditions. Formal verification methods would have identified this hidden issue.

Theoretically, these higher protocols are influenced by the underlying blockchain technology, which results in unreliable smart contract state estimation.

Cardano has brought the "Formal Methods" paradigm in creating smart contracts, enabling precise estimation of smart contracts behaviors provably. Moreover, Plutus is designed with such care to enable this technology. The potential of this mathematical precision has not yet been realized in the current ETH-dominated DeFi. In short, Cardano will prevent this type of protocol attacks by enabling smart contract writers to predict what can go wrong in which setting.


---

