Cryptheory: Crypto and Internet

cryptocurrency and internet meaning, guides, learning

Inside DeFi: Flash loans in arbitrage trading

3 min read

Flash loans make it possible to borrow a theoretically unlimited amount of cryptocurrencies within a short period of time. The unbelievable thing about it at first glance: without depositing any collateral. In addition, you do not have to prove your identity anywhere, since you are stored on a decentralized protocol. One rightly asks: How is that possible?

How does a flash loan work?

The condition for such a flash loan is that the term is very short. And by that we mean: very short. To be precise: it has to be repaid within a single transaction. In other words: while the transaction is being executed and before it is carved into the blockchain forever.

If you don’t pay back the flash loan within the same transaction, the entire transaction is void. This is the only way to prevent someone from borrowing money and not paying it back. The ingenious thing: This also makes it possible to issue the loans in unlimited amounts. If you plan such a flash loan well, you can do a lot with it. However, if you gamble, you will have to bear the costs. Because the respective providers collect a fee for their flash loans. And you have to pay for it, regardless of whether the flash loan works or not.

Arbitrage trading with flash loans

Arbitrage trading takes advantage of price differences between different exchanges. This can be particularly interesting for stablecoin trading pairs. Let’s clarify this with an example.

Let’s say we see on Uniswap that we pay 1DAI for 1USDC. So far, so regular. However, we notice that on another DEX, let’s say SushiSwap, we only have to pay 0.99 USDC for 1DAI.

This means that if we were to quickly transfer funds from one DEX to another and back, we could make $0.01 profit per DAI just by switching platforms.

So you could set up a flash loan of, for example, 1,000,000 USDC aave and use it to buy on SushiSwap DAI. This results in 1,010,101.10 DAI. After that, one could quickly jump onto Uniswap and sell them back for USDC. The Result: One would get 1,010,101.10 USDC.

Thanks to Flashloan, we would have made $10,101.10 in profit in a single Ethereum transaction. But we would still have to deduct the 0.09 percent fee. That’s 900 USDC. Our net profit would then be 9,201 USDC. If everything goes well. However, there are a few factors that can come between us.

If the deal goes awry, we may be stuck with the fees. When things go bad, our arbitrage opportunity is gone too, because the price has stabilized again by the time we recognize the situation, take out a loan, and initiate the trade.

It can also happen that someone or something is faster than us. Because not only are there a lot of other traders waiting for such opportunities, but also trading bots that might challenge our place on the arbitrage podium. In short, as an arbitrage trader, you really need to know what you’re doing.

All content in this article is for informational purposes only and in no way serves as investment advice. Investing in cryptocurrencies, commodities and stocks is very risky and can lead to capital losses.

2 thoughts on “Inside DeFi: Flash loans in arbitrage trading

Leave a Reply

Your email address will not be published. Required fields are marked *