<p>Transactions on Cardano can be made up of many state changes. The transaction as a whole is atomic and a state change in the transaction will only be performed if all the changes can be performed.</p>
<p>For something like flash loans, as @Marek-Mahut points out, instead of having multiple transactions imperatively executed, each transaction just includes the before and after state. Flash loans are no longer needed in Cardano's model.</p>
<p>You <em>could</em> have a contract that allows you to redeem some ADA as long as you replace it with some interest in the same transaction--which is the equivalent of a flash-loan--but why would you ever do that? Plutus validators don't check that they're getting paid, they check that the state after redemption <em>will be</em> valid. The flash loan no longer serve the purpose of unlocking liquidity inside contracts. That comes for free with the EUTxO model.</p>
<p>tl;dr: All transactions on Cardano are made up of atomic state changes. This allows for what would be atomic sets of transactions on other blockchains.</p>

CC BY-SA 4.0
2022-02-04T23:32:22.417Z
2022-02-05T01:07:10.097Z
2022-02-05T01:07:10.097Z
Mitchell Turner
<p>Flash loans are not possible within the eUTXO model as each transaction is a single state transition, where a typical flash loan consist of two state transitions within a single transaction.</p>
<p>In my opinion, this is one of the most interesting security/safety features of the eUTXO model.</p>

CC BY-SA 4.0
2021-05-31T19:06:49.547Z
That "two state transitions within a single transaction" is what I mean by "atomic." Yeah.
The safety here sounds comforting, but in describing the EUTxO model, Lars suggested that anything on Ethereum would be theoretically possible on Cardano--maybe I read too much into it. I'm far from understanding the limitations of the EUTxO model, but Haskell has ways of modelling this safely with the STM monad. I'd hope in the future Plutus could be extented to allow it.
Mitchell Turner
CC BY-SA 4.0
2021-05-31T20:19:22.100Z
Yes, it was mentioned already that Lars called it a flash loan by mistake in one of the presentations, but he meant smart contract composability - similar, but a different concept.
Marek Mahut - StakeNuts
CC BY-SA 4.0
2021-05-31T08:39:50.823Z
2021-05-31T08:39:50.823Z
Marek Mahut - StakeNuts
<p>A concrete example would be flash loans, where you could borrow some value from a lending script, do something interesting with it, and return the borrowed amount to the script with a fee, all in one transaction.</p>
<p>Intuitively this feels like it would need to be multiple transactions with separate outputs, but the lending script needs to verify that it is receiving sufficient value in return before it will ever lend anything.</p>
<p>How might this be modeled in Plutus to work?</p>

<plutus><smart-contract><plutus-pioneer-program>
Is it possible to make multiple transactions atomic?
# Is it possible to make multiple transactions atomic?

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

A concrete example would be flash loans, where you could borrow some value from a lending script, do something interesting with it, and return the borrowed amount to the script with a fee, all in one transaction.

Intuitively this feels like it would need to be multiple transactions with separate outputs, but the lending script needs to verify that it is receiving sufficient value in return before it will ever lend anything.

How might this be modeled in Plutus to work?

**Tags:** plutus, smart-contract, plutus-pioneer-program

---

## 2 answers

### Answer by username_0 on 2022-02-04. Score: 2 | Accepted answer

Transactions on Cardano can be made up of many state changes. The transaction as a whole is atomic and a state change in the transaction will only be performed if all the changes can be performed.

For something like flash loans, as @Marek-Mahut points out, instead of having multiple transactions imperatively executed, each transaction just includes the before and after state. Flash loans are no longer needed in Cardano's model.

You *could* have a contract that allows you to redeem some ADA as long as you replace it with some interest in the same transaction--which is the equivalent of a flash-loan--but why would you ever do that? Plutus validators don't check that they're getting paid, they check that the state after redemption *will be* valid. The flash loan no longer serve the purpose of unlocking liquidity inside contracts. That comes for free with the EUTxO model.

tl;dr: All transactions on Cardano are made up of atomic state changes. This allows for what would be atomic sets of transactions on other blockchains.


---

### Answer by username_1 on 2021-05-31. Score: 1

Flash loans are not possible within the eUTXO model as each transaction is a single state transition, where a typical flash loan consist of two state transitions within a single transaction.

In my opinion, this is one of the most interesting security/safety features of the eUTXO model.

> **Comments:**
> **username_0**: That "two state transitions within a single transaction" is what I mean by "atomic." Yeah. The safety here sounds comforting, but in describing the EUTxO model, Lars suggested that anything on Ethereum would be theoretically possible on Cardano--maybe I read too much into it. I'm far from understanding the limitations of the EUTxO model, but Haskell has ways of modelling this safely with the STM monad. I'd hope in the future Plutus could be extented to allow it.  
> **username_1**: Yes, it was mentioned already that Lars called it a flash loan by mistake in one of the presentations, but he meant smart contract composability - similar, but a different concept.  

---

