views
The blockchain also plays a central role in the area of decentralized financial markets (DeFi). Decentralized financial transactions are hardly conceivable without blockchain technology, as this is where decentralization can bring its maximum benefit. In the area of blockchains and cryptocurrencies, there are numerous instruments that further increase the economic benefits of the blockchain. At the same time, DeFi benefits from this, as new technologies in this area can quickly represent a great advantage in terms of the speed and effectiveness of transactions. Flash loans are such an instrument that the blockchain is becoming increasingly important. In this post we show why that is and how the technology works.
Flash loans bring credit to the blockchain
With flash loans, there has also been the possibility of using loans with cryptocurrencies since around 2018. Marble, the self-proclaimed “Smart Contract Bank”, created these possibilities with the Marble protocol. Marble is no longer available, but the idea of flash loans has established itself in the market and some providers are making them available. Flash loans are still in the early stages of development. However, billions in values are already being controlled by flash loans. It is worthwhile for every user in the crypto sector to think about the topic and to deal with flash loans.
Aave is now one of the best-known platforms for flash loans with the Ethereum blockchain. The provider provides its defibrillator protocol for flash loans as open source. Also dydx belongs to known providers of this type of loans in the crypto area.
Aava is one of the most popular protocols and platforms for Flash LOans (Screenshot: Aava.com)
However, flash loans work completely differently than conventional loans. Banks and other intermediaries play no role in flash loans, a smart contract in the Ethereum blockchain development retains control . In addition, borrowers basically do not need to provide collateral for flash loans. A loan expires in a few seconds. We explain why this is so in this article. With Flash Loans, borrowers can borrow various cryptocurrencies, use them for their own transactions, and return them to the lender.
Entry into Flash Loans
The control of the individual actions when using flash loans is carried out via smart contracts, usually in the Ethereum blockchain. In the Ethereum blockchain, for example, Aave , a DeFi protocol for flash loans, issued loans worth over four billion dollars in 2021. For this purpose, AAVE offers its own token with the same name, which can also be traded and stacked normally. The smart contract used for this purpose collects cryptocurrencies from potential lenders in a pool. Borrowers can withdraw capital from this pool based on the stored conditions. The processes for this must run within a single Ethereum block, and a smart contract controls all processes.
Flash loans are not limited to Ether (ETH) due to the connection to Ethereum. On platforms like Aave, other cryptocurrencies can also be exchanged for tokens, which are available for flash loans on the platform. These include, for example, DAI, Basic Attention Token (BAT), Chainlink (LINK), Synthetix (SNX), Bitcoin, Enjin Coin (ENJ), 0x (ZRX), Curve DAO Token (CRV). Stablecoins such as USD Coin, TrueUSD or Binance USD can also be used on Aave. This in turn enables lending in the crypto sector on the basis of the US dollar. Further currencies are to be added in the future. Ethereum, Ether and ERC20 tokens play an important role when using flash loans.
Flash Loans in a nutshell
To put it simply, flash loans are, from the perspective of the financial sector, unsecured lending in decentralized finance (DeFi). Flash loans are already being used extensively with Ethereum and Ether, as the providers also offer the corresponding functions via smart contracts. Flash loans use the functions of smart contracts, which are of course particularly popular in the Ethereum blockchain. For this reason, Flash Loans were already heavily focused on the Ethereum blockchain development by the introduction of Marble.
In the process with a flash loan, the borrower takes out a loan and pays it back in a few seconds, within an Ethereum block. This consists of several operations. We will show you how to do this and why it makes sense in the next few sections.
Procedure when using Flash Loans with Aave (Image: Aave.com)
These are the areas of application for flash loans
The loans are used, for example, for the quick and easy exchange of a crypto currency for another currency.
Flash loans are also interesting for arbitrage transactions, i.e. different prices on different crypto exchanges, as borrowers can use them to generate profits. Borrowers can, for example, receive tokens via a flash loan and buy a cryptocurrency on an exchange at a low price. After that, the same currency is sold on an exchange with a higher price. The borrower then pays back the flash loan and benefits from the profit. At the same time, this process stabilizes the crypto market, as discrepancies in the prices of crypto currencies on different exchanges can be balanced out. These processes only take a few seconds. This is made possible by the smart contract, which handles all processes in the Ethereum blockchain in a fully automated and transparent manner.
The process as part of a flash loan can also be useful for self-liquidation if your own collateral decreases. For example, if users have borrowed DAI for ETH and the value of ETH falls, it can make sense to borrow DAI via a flash loan, replace the loan and get your own ETH again. This can significantly improve the security situation in crypto transactions. The replacement of loans or collateral on other platforms can also be lucrative with cheap flash loans, as borrowers can also switch from expensive loans to cheaper loans.
What is the process for a flash loan?
The smart contract that controls the flash loan handles the processes in a single Ethereum block. As a result, the borrower receives the capital immediately, and the lender gets it back very quickly, within an Ethereum block. If that doesn't work, the system declares the Ethereum block used as invalid and resets it. In this case, the capital falls back to the lender as if he had never paid it off. In this case, the blockchain completely resets all actions carried out with the flash loan.
Flash loans offer numerous opportunities in the crypto sector, which offer many opportunities but also dangers. For this reason, not all crypto experts are convinced that flash loans have positive effects on the crypto market in the long term. In this article, we will also go into the dangers of using flash loans.
The advantages of loans are also obvious in the crypto sector. However, there are also significant disadvantages. Flash loans have already become a means of attacking DeFi protocols and stealing money. Since there are no intermediaries such as banks, there is no central element that can quickly intervene in criminal activities and keep the logs. The platforms eliminate the weaknesses over time so that the technology becomes even more secure.
Flash loans versus conventional loans
Typically, borrowers are required to deposit collateral, sign contracts, and pay interest before drawing a loan. In most cases, such loans have a term of years or at least months. Approval also takes time, and in many cases banks involve a large number of people. In the crypto sector, of course, it makes no sense if the granting of loans takes days or weeks. Of course, the repayment must also be much faster. The technologies in the blockchain also play an important role, above all smart contracts.
With Flash Loans, lending and loan processing is different. The general process of granting such a loan is completed in a few seconds. Flash loans can be granted and repaid very quickly in the blockchain via individual transactions. The basis of the flash loans are the smart contracts, which are an important basis of the Ethereum blockchain development. The automation of transactions and processes in the blockchain via smart contracts speeds up lending significantly. At the same time, borrowers receive the required capital very quickly and lenders do not need any security, as the smart contract protects the capital and automatically books it back.
Borrowers can use borrowed capital instantly through smart contracts
Borrowers can use the borrowed capital to conduct business in seconds. In most cases, this is also done by the smart contract, which also controls lending. There are also fees for Flash Loans, but these are very low and are also based on the profit that is made with the loan. The fees depend on the intended use and, using the example of Aave, usually amount to around 0.09% of the loan amount. Other platforms and protocols use a similar amount. The fee is mainly charged if the business, i.e. the flash loan, generates a profit for the borrower. An example of this are arbitrage deals between different crypto exchanges. Aave divides the fees between the platform and the lenders. This procedure is now one of the standards for processing flash loans. Anyone who grants loans can therefore expect interest.
Since the credit is controlled via a smart contract, the latter also retains control over the credit. The transactions made can be processed back via conditions in the smart contract, so that the lender receives his borrowed capital back as soon as the respective conditions in the smart contract are met. For this purpose, the Ethereum block used is defined as invalid. This also has the great advantage that the granting and use of a flash loan does not in theory mean any risk for both parties. However, it has been found in practice that there are quite a number of starting points with which attackers can use flash loans for their criminal activities. We will come to this topic in more detail in the next few sections.
Smart contracts control the transactions in the Ethereum block of the flash loan
In an Ethereum block, which is the basis for the flash loan, all operations must be valid for the entire block to be valid. If the borrower does not repay the capital, the underlying smart contract defines the respective operation as invalid and thus the entire Ethereum block. The Ethereum blocks consist of different transactions controlled by the smart contract of the flash loan. If a transaction is invalid, then all transactions in the Ethereum block are invalid. In this case, the smart contract resets the block and all related operations are no longer valid. In this case, the lender receives his capital back, just as with the successful execution of the flash loan.
Flash Loans at Aave
Aave is one of the most popular platforms and protocols when it comes to using flash loans in the Ethereum blockchains. The Aave wallet is required for lending and using a flash loan in Aave. This Java-based wallet can be linked very easily with conventional Ethereum wallets. The link allows lenders to transfer funds from their traditional wallet to the Aave wallet.
As part of the transfer, the users tie the respective capital to a smart contract in the Ethereum blockchain. The cryptocurrency used is exchanged for aETH, for example. This later controls the flash loans. The system automatically calculates the interest on the loans on the basis of the available capital and the amount of loans that users take out.
In addition to using loans with flexible interest rates, borrowers can also take advantage of offers that offer a fixed interest rate. If the lender wants to exchange his chapter back into his original wallet and his originally used cryptocurrency, Aave transfers the capital back to the original wallet and destroys the corresponding tokens at Aave.
What Are The Dangers Of Using Flash Loans?
Flash loans were the focus of hacker attacks as early as 2020. Hackers captured almost a million euros in ether. The attackers used flash loans and a vulnerability in Fulcrum . Simply put, the hackers successfully manipulated prices. As a result, the criminals made a profit after repaying the flash loan.
The weak point in flash loans is therefore primarily the recognition of the correct prices of the cryptocurrencies used. By manipulating prices, the hackers were able to successfully carry out multiple attacks even after the platform detected the first attack. Many flash loans use stablecoins such as DAI and USDC. When attacking Fulcrum, the attackers successfully manipulated the price of these stablecoins on the platforms used.
In the attack on Chainswap , a project on the Binance Smart Chain, users also lost millions of dollars through flash loans. The attackers took over smart contracts from various projects and thereby stole Ether (ETH). Here, too, price feeds were the cause that attackers were able to successfully exploit to influence the smart contract used.
Conclusion
Flash loans are a relatively new solution in blockchain technologies. The features of Flash Loans enable numerous advantages for blockchains. Arbitrage deals compensate for differences on cryptocurrency platforms more quickly, and the possibility of changing loans offers users many opportunities to reduce costs. At DeFi, flash loans are another means that can help to better handle decentralized financial transactions.
Since the technology is new and is based entirely on IT and the blockchain, it naturally offers a lot of attack potential. For this reason, everyone involved must work to improve the technology. Arbitrage deals allow borrowers to generate profits in a short period of time. Of course there is also a lot of potential to lose money. In any case, it makes sense for every user who deals with DeFi to take a look at the possibilities of Flash Loans.