What is a flash loan?

A flash loan is a type of transaction that borrows a certain amount of liquidity and pays it back within the same transaction or block. No time elapses between borrowing and paying back the funds, as it is all settled together at once, atomically. Atomic composability is therefore necessary for flash loans to work as everything has to either settle together or fail together.

As per the diagram above, all transactions within the block are settled together, guaranteeing that any funds borrowed as part of a flash loan are paid back.

Because of this, there is no credit or counterparty risk, and so flash loans do not need to be collateralized. This makes flash loans hyper capital-efficient, as they provide extreme levels of leverage. This degree of capital efficiency is not possible in traditional financial markets and is only possible in DeFi.

The liquidity for flash loans typically comes from lending protocols such as Aave or CREAM, which offer single-transaction loans as a feature to allow them to be composed with other dApps such as Uniswap or Sushiswap.

So why have flash loans at all?

The main use case for flash loans is for individuals or bots to take advantage of arbitrage opportunities, such as the same asset being priced differently across two different exchanges.

To illustrate, if the price of ETH on Uniswap is $2,000, and the price of ETH on Sushiswap is $2,005, there is a difference of $5 in the price of ETH between the two. Without a flash loan, an arbitrageur would only be able to arbitrage the difference in price using their available liquidity. So for example, if they had $1,000, they would only be able to make a profit of $2.5. However, with a flash loan, the arbitrageur could borrow $1,000,000, arbitrage the price difference, pay back the $1,000,000, and gain a profit of $2,500 instead. The price of ETH on Uniswap and Sushiswap would move closer together as a result of the arbitrageur with the flash loan, than without.

Flash loans enhance the efficiency of markets in DeFi, as they allow individuals with strong information but limited capital to have a greater impact in resolving market inefficiencies.

Are there any issues with flash loans?

Flash loans sometimes have a bad reputation as they often appear alongside DeFi hacks, bugs, and exploits. However, in nearly all of these cases, flash loans are not the root cause of the issue. Instead, the flash loan allows the attacker to leverage up significantly and take advantage of the underlying flaw in the DeFi protocol with much more liquidity than an unleveraged position would allow. In a way, this is in itself an arbitrage opportunity, but one that takes advantage of smart contract vulnerabilities, rather than inefficient markets.

Flash loans are therefore not the culprit in the vast majority of hacks. They are merely a tool that amplifies an attackers’ ability to take advantage of a vulnerability.

You can read through a list of DeFi hacks, bugs, and exploits on rekt.news, as well as how Radix will reduce such hacks, exploits, and failures here.

How to get the benefit without the downside

So, flash loans are great at making DeFi markets more efficient, but because of this, they amplify attackers’ ability to take advantage of hacks, bugs and exploits. How do we get the best of both worlds?

The answer is to have a network that is atomically composable and scalable, to allow flash loans to work their magic.

Then, you address the root cause of DeFi hacks, bugs and exploits through a safer and more predictable application execution environment. At Radix, we’ve spent years developing Radix Engine to solve just these problems.

You can learn more about how Radix Engine does this here:

--

--

--

The first layer 1 protocol specifically built to serve DeFi

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Common security concerns regarding Apple devices for enterprises

🛎🛎STEPMOON HAS AUDITED BY CYBERSCOPE🛎🛎

Terrorist Tech-comms

How Do Hackers Hack?

Our First Audit

What’s an Ethical Hacker?

CEHv11

Announcement on suspension of support for COCOS

Understanding the California Consumer Privacy Act’s Effect on Businesses

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Radix DLT — The Decentralized Finance Protocol

Radix DLT — The Decentralized Finance Protocol

The first layer 1 protocol specifically built to serve DeFi

More from Medium

Crypto and the macroeconomic cycle

Blockchain Bridges — What is Crypto Blockchain Bridge

SPELL TOKEN CRYPTO HUGE PRICE UPDATE!

The Russian Roundup: Uniswap V3 Deployed On Polygon — Issue #18