What are flash loans in DeFi?
What is Bitcoin? How does blockchain work? How to mine cryptocurrency? We are glad to help you answer these questions with our quick guides in Explained section.
n”,”seo_description”:”What is Bitcoin? How does blockchain work? How to mine cryptocurrency? We are glad to help you answer these questions with our quick guides in Explained section.”},”words_count”:1008,”description”:”Flash loans, though relatively new, are quickly rising in popularity. Learn more about these uncollateralized-type loans in crypto in the article below”,”author”:{“id”:1418,”title”:”Marcel Deer”,”url”:”marcel-deer”,”twitter”:””,”google_plus”:””,”photo”:null,”gender”:”male”,”description”:”A qualified journalist with a background in PR and marketing, Marcel has been passionate about crypto since he first read the Cypherpunks Manifesto. As a strong believer in the power of DeFi, decentralization, and the digital economy, when he’s not writing, he’s researching the latest node projects and actively enjoying the crypto community on Twitter.”,”facebook”:””,”email”:””,”linkedin”:””,”created_at”:”2021-11-07 07:02:27″,”updated_at”:”2021-11-07 07:02:27″,”deleted_at”:null,”avatar”:”https://cointelegraph.com/assets/img/icons/author_male.jpg”,”hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL21hcmNlbC1kZWVy”,”relativeUrl”:”https://cointelegraph.com/authors/marcel-deer”,”user_id”:1418,”language_id”:1,”name”:”Marcel Deer”,”desc”:”A qualified journalist with a background in PR and marketing, Marcel has been passionate about crypto since he first read the Cypherpunks Manifesto. As a strong believer in the power of DeFi, decentralization, and the digital economy, when he’s not writing, he’s researching the latest node projects and actively enjoying the crypto community on Twitter.”,”seo_title”:””,”seo_description”:””,”enabled”:0,”show_in_authors”:0,”show_in_experts”:0},”category_id”:65,”audio”:”https://s3.cointelegraph.com/audio/79904.8b8037cc-9da6-4a7a-bd04-4503bdb62844.mp3″,”tags”:[{“name”:”Smart Contracts”,”uri”:”/tags/smart-contracts”,”super”:0,”page_title”:”Smart Contracts News”},{“name”:”Loans”,”uri”:”/tags/loans”,”super”:0,”page_title”:”Loans News”},{“name”:”DeFi”,”uri”:”/tags/defi”,”super”:1,”page_title”:”DeFi News”}],”tag_title”:”DeFi”,”date”:”51 MINUTES AGO”,”badge”:{“title”:”Explained”,”label”:”default”},”qty”:19,”stats_pixel”:”“,”stats_pixel_url”:”https://zoa.cointelegraph.com/pixel?postId=79904®ionId=1″,”shares”:4,”infographic”:false,”sponsored”:false,”explained”:true,”press_release”:false,”show_referral”:false,”social_description”:”Since being introduced in 2020, flash loans have quickly grown in popularity. How do these uncollateralized-type loans work without the typical requirements for borrowers?”,”social_translators”:{“clipboard_popup_label”:”Link copied”,”socialWechatFooterError”:”WeChat error”,”socialWechatFooterText”:”WeChat share”,”socialWechatHeaderText”:”WeChat share”},”social_shares”:{“post_id”:79904,”post_url”:”https://cointelegraph.com/explained/what-are-flash-loans-in-defi”,”post_titles”:{“normal”:”What are flash loans in DeFi?”,”twitter”:”What are flash loans in DeFi?”},”post_text”:{“normal”:”What are flash loans in DeFi?”,”twitter”:”What are flash loans in DeFi? https://cointelegraph.com/explained/what-are-flash-loans-in-defi via @cointelegraph”},”accounts”:{“twitter”:”@cointelegraph”}},”socials”:{“facebook”:{“url”:”https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi”,”count”:null,”short”:”fb”,”fa”:”facebook”},”twitter”:{“url”:”https://twitter.com/intent/tweet?text=What+are+flash+loans+in+DeFi%3F https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi via @cointelegraph”,”count”:null,”short”:”tw”,”fa”:”twitter”},”telegram”:{“url”:”https://telegram.me/share/url?url=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi &text=What+are+flash+loans+in+DeFi%3F”,”count”:null,”short”:”tg”,”fa”:”paper-plane”},”whatsapp”:{“url”:”https://api.whatsapp.com/send?text=What+are+flash+loans+in+DeFi%3F&href=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi”,”count”:null,”short”:”wu”,”fa”:”whatsapp”},”gplus”:{“url”:”https://plus.google.com/share?url=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi”,”count”:null,”short”:”gplus”,”fa”:”google-plus”},”reddit”:{“url”:”https://www.reddit.com/submit?url=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi&title=What+are+flash+loans+in+DeFi%3F”,”count”:null,”short”:”reddit”,”fa”:”reddit-alien”},”linkedin”:{“url”:”https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fcointelegraph.com%2Fexplained%2Fwhat-are-flash-loans-in-defi&title=What+are+flash+loans+in+DeFi%3F”,”count”:null,”short”:”li”,”fa”:”linkedin”}},”hide_disclaimer”:false,”elink”:”https://cointelegraph.com”,”etitle”:”Cointelegraph”,”elogo_x2″:”https://images.cointelegraph.com/images/528_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9hYjAzYTJhMmNlOWEyMWRjMWYwOTYxZDkxNzMxYzhiYS5wbmc=.png”,”elogo_x1″:”https://images.cointelegraph.com/images/260_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9hYjAzYTJhMmNlOWEyMWRjMWYwOTYxZDkxNzMxYzhiYS5wbmc=.png”,”elogo_svg”:false,”content”:[{“id”:3134,”post_id”:79904,”title”:”How did flash loans originate?”,”content”:”
Unlike normal loans, flash loans do not require a borrower to provide typical requirements such as proof of income, reserves, or collateral.
nn
While that may sound favorable to the borrower, there are pros and cons. Decentralized finance (DeFi) protocols have contributed to the popularity of flash loans. And most of these are on the Ethereum network.
nn
Aave, an Ethereum lending platform, introduced the idea of flash loans in 2020. As such, the concept remains relatively new and still has a lot of issues to fix. According to Aave, flash loans have “no real-world analogy” and are “an advanced concept aimed at developers.”
nn
In this article, we’ll be discussing the basics of so-called DeFi flash loans, as well as the safety issues and use cases typically associated with them. Let’s dive in.
nnn”,”created_at”:”2022-01-22 12:58:26″,”updated_at”:”2022-01-22 13:04:57″,”sort”:1,”translations”:{“id”:3127,”explained_post_id”:3134,”title_en”:”How did flash loans originate?”,”content_en”:”
Unlike normal loans, flash loans do not require a borrower to provide typical requirements such as proof of income, reserves, or collateral.
nn
While that may sound favorable to the borrower, there are pros and cons. Decentralized finance (DeFi) protocols have contributed to the popularity of flash loans. And most of these are on the Ethereum network.
nn
Aave, an Ethereum lending platform, introduced the idea of flash loans in 2020. As such, the concept remains relatively new and still has a lot of issues to fix. According to Aave, flash loans have “no real-world analogy” and are “an advanced concept aimed at developers.”
nn
In this article, we’ll be discussing the basics of so-called DeFi flash loans, as well as the safety issues and use cases typically associated with them. Let’s dive in.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 12:58:26″,”updated_at”:”2022-01-22 13:04:57″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3135,”post_id”:79904,”title”:”What are flash loans?”,”content”:”
Similar to traditional loans, flash loans are expected to be paid back in full eventually. However, there are also marked differences.
nn
In typical lending processes, a borrower loans money from a lender. The amount is expected to be paid back in full eventually, with interest, depending on the terms discussed between the lender and the borrower.
nn
Flash loans operate on a similar framework but have some unique terms and premises:
nn
Use of smart contracts
nn
A smart contract is a tool used in most blockchains to ensure that funds do not change hands until a specific set of rules are met.
nn
When it comes to flash loans, the borrower is required to repay the full amount of the loan before the completion of the transaction.
nn
If this rule is not followed, the transaction is reversed by the smart contract and the loan is nullified as if it never took place at all.
nn
Unsecured loan
nn
Unlike a traditional loan, a flash loan is an unsecured loan, meaning no collateral is needed.
nn
However, this does not imply that the flash loan lender does not get their money back in case of non-payment. In a traditional loan, collateral is typically put up to ensure that the lender receives the money back in the event of non-payment.
nn
Flash loans, however, happen within a very short timeframe (usually a few seconds or minutes). This means that while no collateral is needed, the borrower must return the full amount they borrowed right away.
nn
Instantaneous transactions
nn
As opposed to longer processes for traditional loans, flash loans are processed faster, thanks to smart contracts.
nn
Getting a traditional loan approved usually is a long process. A borrower must submit documents, wait for approval, and pay the loan back in agreed increments within a stipulated period that may run into days, months or years.
nn
On the other hand, a flash loan is expedited in an instant, which means that the loan’s smart contract must be fulfilled during the transaction for which it’s lent out. Therefore, the borrower is required to call on other smart contracts, using the loaned capital to perform instant trades.
nn
The kicker: All this must be done in a few seconds before the transaction ends. Hence, the name: flash loans.
nnn”,”created_at”:”2022-01-22 12:59:35″,”updated_at”:”2022-01-22 13:04:56″,”sort”:2,”translations”:{“id”:3128,”explained_post_id”:3135,”title_en”:”What are flash loans?”,”content_en”:”
Similar to traditional loans, flash loans are expected to be paid back in full eventually. However, there are also marked differences.
nn
In typical lending processes, a borrower loans money from a lender. The amount is expected to be paid back in full eventually, with interest, depending on the terms discussed between the lender and the borrower.
nn
Flash loans operate on a similar framework but have some unique terms and premises:
nn
Use of smart contracts
nn
A smart contract is a tool used in most blockchains to ensure that funds do not change hands until a specific set of rules are met.
nn
When it comes to flash loans, the borrower is required to repay the full amount of the loan before the completion of the transaction.
nn
If this rule is not followed, the transaction is reversed by the smart contract and the loan is nullified as if it never took place at all.
nn
Unsecured loan
nn
Unlike a traditional loan, a flash loan is an unsecured loan, meaning no collateral is needed.
nn
However, this does not imply that the flash loan lender does not get their money back in case of non-payment. In a traditional loan, collateral is typically put up to ensure that the lender receives the money back in the event of non-payment.
nn
Flash loans, however, happen within a very short timeframe (usually a few seconds or minutes). This means that while no collateral is needed, the borrower must return the full amount they borrowed right away.
nn
Instantaneous transactions
nn
As opposed to longer processes for traditional loans, flash loans are processed faster, thanks to smart contracts.
nn
Getting a traditional loan approved usually is a long process. A borrower must submit documents, wait for approval, and pay the loan back in agreed increments within a stipulated period that may run into days, months or years.
nn
On the other hand, a flash loan is expedited in an instant, which means that the loan’s smart contract must be fulfilled during the transaction for which it’s lent out. Therefore, the borrower is required to call on other smart contracts, using the loaned capital to perform instant trades.
nn
The kicker: All this must be done in a few seconds before the transaction ends. Hence, the name: flash loans.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 12:59:35″,”updated_at”:”2022-01-22 13:04:56″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3136,”post_id”:79904,”title”:”How do flash loans work?”,”content”:”
Simply put, in a flash loan, funds are borrowed and returned within seconds and in a single transaction.
nn
The smart contract sets out the terms and performs instant trades on the borrower’s behalf using the loaned capital. If the flash loan yields a profit, it is typically charged a fee of 0.09%.
nn
On a platform such as Aave, this is how flash loans typically work:
nn
- nt
- The borrower applies for a flash loan on Aave.
- The borrower creates a logic of exchanges to try making a profit, such as sales, DEX purchases, trades, etc.
- The borrower repays the loan, makes a profit, and pays a 0.09% fee.
- If any of the following conditions occur, the transaction is reversed, and the funds are returned to the lender:
nt
nt
nt
n
nn
- nt
- The borrower does not repay the capital
- The trade does not lead to a profit
nt
n
nn
The above conditions suggest that what was laid out in the smart contract wasn’t met. As such, the funds are returned to the lender instantaneously. Theoretically speaking, flash loans are a low-risk option for both the borrower and the lender. Flash loans are typically seen as an easy, low-risk way to play with liquidity.
nn
Can you make money with flash loans? Aave recommends having a good grasp of Ethereum, programming and smart contracts to make the most out of flash loans. Ideally, you can make money with flash loans, provided you do not fall prey to flash loan attacks. It would help if you thoroughly researched the protocols you want to borrow from and trade with, as well.
nnn”,”created_at”:”2022-01-22 13:00:38″,”updated_at”:”2022-01-22 13:04:56″,”sort”:3,”translations”:{“id”:3129,”explained_post_id”:3136,”title_en”:”How do flash loans work?”,”content_en”:”
Simply put, in a flash loan, funds are borrowed and returned within seconds and in a single transaction.
nn
The smart contract sets out the terms and performs instant trades on the borrower’s behalf using the loaned capital. If the flash loan yields a profit, it is typically charged a fee of 0.09%.
nn
On a platform such as Aave, this is how flash loans typically work:
nn
- nt
- The borrower applies for a flash loan on Aave.
- The borrower creates a logic of exchanges to try making a profit, such as sales, DEX purchases, trades, etc.
- The borrower repays the loan, makes a profit, and pays a 0.09% fee.
- If any of the following conditions occur, the transaction is reversed, and the funds are returned to the lender:
nt
nt
nt
n
nn
- nt
- The borrower does not repay the capital
- The trade does not lead to a profit
nt
n
nn
The above conditions suggest that what was laid out in the smart contract wasn’t met. As such, the funds are returned to the lender instantaneously. Theoretically speaking, flash loans are a low-risk option for both the borrower and the lender. Flash loans are typically seen as an easy, low-risk way to play with liquidity.
nn
Can you make money with flash loans? Aave recommends having a good grasp of Ethereum, programming and smart contracts to make the most out of flash loans. Ideally, you can make money with flash loans, provided you do not fall prey to flash loan attacks. It would help if you thoroughly researched the protocols you want to borrow from and trade with, as well.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 13:00:38″,”updated_at”:”2022-01-22 13:04:56″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3137,”post_id”:79904,”title”:”Uses of flash loans”,”content”:”
Flash loans are used in DeFi protocols, which are based on the Ethereum Network and Binance Smart Chain.
nn
Aside from Aave flash loans, dYdX flash loans, DEX flash loans and Uniswap flash loans have also risen in popularity. On Uniswap, for example, “flash swaps” allow users to withdraw or take back Ethereum-based tokens paired with other tokens.
nn
While they may have been originally designed for developers, as of August 2020, flash loans without coding are easily accessible to less tech-savvy users. The credit for this goes to platforms like Furucombo and DeFi Saver, among others, who eliminated the need for technical coding skills.
nn
Flash loans can be used for the following:
nn
Flash loan arbitrage
nn
One way for traders to make money is by pinpointing price discrepancies across various exchanges.
nn
For example, if two markets price a cryptocurrency differently, a trader can use a flash loan. The trader can call separate smart contracts to purchase and sell from both markets, making a profit from the price discrepancy between the two.
nn
Collateral swaps
nn
This involves a quick swap of the collateral backing a user’s loan for another type of collateral.
nn
Collateral swaps enable DeFi users to switch the collateral that they used to take out a flash loan on a lending app. For example, if a trader used their Ethereum (ETH) as collateral on one platform, they can then take out a flash loan to repay the previous loan and withdraw their Ethereum (ETH).
nn
Debt refinancing
nn
Aside from collateral swaps, flash loans can also be used for “interest rate swaps.”
nn
Aave cites an example on their blog:
nn
- nt
- Borrow assets from Aave liquidity
- Payback debt on Compound
- Withdraw collateral from Compound
- Deposit collateral on Dydx
- Mint debt on Dydx
- Return liquidity to Aave
nt
nt
nt
nt
nt
n
nnn”,”created_at”:”2022-01-22 13:01:50″,”updated_at”:”2022-01-22 13:04:56″,”sort”:4,”translations”:{“id”:3130,”explained_post_id”:3137,”title_en”:”Uses of flash loans”,”content_en”:”
Flash loans are used in DeFi protocols, which are based on the Ethereum Network and Binance Smart Chain.
nn
Aside from Aave flash loans, dYdX flash loans, DEX flash loans and Uniswap flash loans have also risen in popularity. On Uniswap, for example, “flash swaps” allow users to withdraw or take back Ethereum-based tokens paired with other tokens.
nn
While they may have been originally designed for developers, as of August 2020, flash loans without coding are easily accessible to less tech-savvy users. The credit for this goes to platforms like Furucombo and DeFi Saver, among others, who eliminated the need for technical coding skills.
nn
Flash loans can be used for the following:
nn
Flash loan arbitrage
nn
One way for traders to make money is by pinpointing price discrepancies across various exchanges.
nn
For example, if two markets price a cryptocurrency differently, a trader can use a flash loan. The trader can call separate smart contracts to purchase and sell from both markets, making a profit from the price discrepancy between the two.
nn
Collateral swaps
nn
This involves a quick swap of the collateral backing a user’s loan for another type of collateral.
nn
Collateral swaps enable DeFi users to switch the collateral that they used to take out a flash loan on a lending app. For example, if a trader used their Ethereum (ETH) as collateral on one platform, they can then take out a flash loan to repay the previous loan and withdraw their Ethereum (ETH).
nn
Debt refinancing
nn
Aside from collateral swaps, flash loans can also be used for “interest rate swaps.”
nn
Aave cites an example on their blog:
nn
- nt
- Borrow assets from Aave liquidity
- Payback debt on Compound
- Withdraw collateral from Compound
- Deposit collateral on Dydx
- Mint debt on Dydx
- Return liquidity to Aave
nt
nt
nt
nt
nt
n
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 13:01:50″,”updated_at”:”2022-01-22 13:04:56″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3138,”post_id”:79904,”title”:”What are flash loan attacks?”,”content”:”
Flash loans are relatively new technology and, therefore, prone to attacks by hackers and malicious users who try to game the system and use it to their advantage.
nn
In a flash loan attack, a borrower can trick the lender into believing that the loan has been repaid in full, even if it has not.
nn
Technically, the thief poses as a borrower and takes out a flash loan from a lending protocol. The protocol is then used to manipulate the market and trick lenders. In some cases, attackers create arbitrage opportunities to exploit vulnerable smart contracts. This way, the attackers can purchase tokens for cheap or sell them at higher prices to exploited contracts.
nnn”,”created_at”:”2022-01-22 13:02:22″,”updated_at”:”2022-01-22 13:04:56″,”sort”:5,”translations”:{“id”:3131,”explained_post_id”:3138,”title_en”:”What are flash loan attacks?”,”content_en”:”
Flash loans are relatively new technology and, therefore, prone to attacks by hackers and malicious users who try to game the system and use it to their advantage.
nn
In a flash loan attack, a borrower can trick the lender into believing that the loan has been repaid in full, even if it has not.
nn
Technically, the thief poses as a borrower and takes out a flash loan from a lending protocol. The protocol is then used to manipulate the market and trick lenders. In some cases, attackers create arbitrage opportunities to exploit vulnerable smart contracts. This way, the attackers can purchase tokens for cheap or sell them at higher prices to exploited contracts.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 13:02:22″,”updated_at”:”2022-01-22 13:04:56″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3139,”post_id”:79904,”title”:”Why do flash loan attacks occur in DeFi?”,”content”:”
Flash loan attacks are common because they are the easiest and quickest to pull off.
nn
This is because the protocols associated with flash loans are not yet foolproof against new attacks and manipulations. With transactions happening in mere seconds, hackers can attack multiple markets in one go.
nn
The most common flash loan attacks in DeFi are fake arbitrage opportunities, which we mentioned above. In a flash loan attack, an attacker creates an arbitrage opportunity by modifying the relative value of a trading pair of tokens. This can be done by using their loaned tokens to flood a contract and create slippage.
nnn”,”created_at”:”2022-01-22 13:02:49″,”updated_at”:”2022-01-22 13:04:56″,”sort”:6,”translations”:{“id”:3132,”explained_post_id”:3139,”title_en”:”Why do flash loan attacks occur in DeFi?”,”content_en”:”
Flash loan attacks are common because they are the easiest and quickest to pull off.
nn
This is because the protocols associated with flash loans are not yet foolproof against new attacks and manipulations. With transactions happening in mere seconds, hackers can attack multiple markets in one go.
nn
The most common flash loan attacks in DeFi are fake arbitrage opportunities, which we mentioned above. In a flash loan attack, an attacker creates an arbitrage opportunity by modifying the relative value of a trading pair of tokens. This can be done by using their loaned tokens to flood a contract and create slippage.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 13:02:49″,”updated_at”:”2022-01-22 13:04:56″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}},{“id”:3140,”post_id”:79904,”title”:”How can DeFi systems protect themselves from flash loan attacks?”,”content”:”
A large majority of DeFi hacks are flash loan attacks. Since the technology is new, vulnerabilities are not readily apparent and may require skilled developers to identify.
nn
Flash loan attacks can cost DeFi protocols and their users hundreds of millions. As such, safeguards must be put into place to ensure that a protocol is robust and sanitized.
nn
Despite being vulnerable to attacks, there are several preventive measures that DeFi systems can take to protect themselves:
nn
Decentralized pricing oracles to protect against slippage
nn
Contracts are left vulnerable to manipulation and exploitation when they perform their own calculations of a particular token’s value or trading pair value internally.
nn
As such, flash loan attack risks can be mitigated by using decentralized pricing oracles such as chainlink and band protocol to fetch price feeds. By doing this, instead of relying on singular DEX platforms, DeFi systems can avoid becoming vulnerable to arbitrage scams.
nn
Smart contracts may continue updating their prices based on the supply and demand of various tokens within their market. However, the price ranges should also be limited in reference to external values. When smart contracts work this way, it would be much more difficult for attackers to create slippage and make attacks profitable.
nn
Tools for detecting possible attacks
nn
DeFi platforms can use tools that minimize the possibility of attacks by detecting unusual activity, along with smart contract bugs and exploits.
nn
As such, defenses can be put in place even before an attack is launched.
nn
It is also vital for platforms to conduct security audits to address vulnerabilities before launching a smart contract. This would require reviewing the smart contract’s code for any weaknesses and addressing them even before the attacker has an opportunity to use it against the platform and its users.
nnn”,”created_at”:”2022-01-22 13:03:47″,”updated_at”:”2022-01-22 13:04:55″,”sort”:7,”translations”:{“id”:3133,”explained_post_id”:3140,”title_en”:”How can DeFi systems protect themselves from flash loan attacks?”,”content_en”:”
A large majority of DeFi hacks are flash loan attacks. Since the technology is new, vulnerabilities are not readily apparent and may require skilled developers to identify.
nn
Flash loan attacks can cost DeFi protocols and their users hundreds of millions. As such, safeguards must be put into place to ensure that a protocol is robust and sanitized.
nn
Despite being vulnerable to attacks, there are several preventive measures that DeFi systems can take to protect themselves:
nn
Decentralized pricing oracles to protect against slippage
nn
Contracts are left vulnerable to manipulation and exploitation when they perform their own calculations of a particular token’s value or trading pair value internally.
nn
As such, flash loan attack risks can be mitigated by using decentralized pricing oracles such as chainlink and band protocol to fetch price feeds. By doing this, instead of relying on singular DEX platforms, DeFi systems can avoid becoming vulnerable to arbitrage scams.
nn
Smart contracts may continue updating their prices based on the supply and demand of various tokens within their market. However, the price ranges should also be limited in reference to external values. When smart contracts work this way, it would be much more difficult for attackers to create slippage and make attacks profitable.
nn
Tools for detecting possible attacks
nn
DeFi platforms can use tools that minimize the possibility of attacks by detecting unusual activity, along with smart contract bugs and exploits.
nn
As such, defenses can be put in place even before an attack is launched.
nn
It is also vital for platforms to conduct security audits to address vulnerabilities before launching a smart contract. This would require reviewing the smart contract’s code for any weaknesses and addressing them even before the attacker has an opportunity to use it against the platform and its users.
nnn”,”title_es”:””,”content_es”:”n”,”title_cn”:””,”content_cn”:”n”,”title_de”:””,”content_de”:”n”,”title_it”:””,”content_it”:”n”,”title_ar”:””,”content_ar”:”n”,”title_br”:””,”content_br”:”n”,”title_jp”:””,”content_jp”:”n”,”created_at”:”2022-01-22 13:03:47″,”updated_at”:”2022-01-22 13:04:55″,”title_kr”:””,”content_kr”:”n”,”title_tr”:””,”content_tr”:”n”}}],”is_partner_material”:false,”commentsSection”:{“schemaEntityUrl”:”//cointelegraph.com/explained/what-are-flash-loans-in-defi”,”list”:[],”amount”:0,”i18n”:{“addComment”:”Add a comment…”,”amountOnePostfix”:”Comment”,”amountPostfix”:”Comments”,”cancel”:”Cancel”,”delete”:”Delete”,”edit”:”Edit”,”errorBig”:”Comment text cannot be longer than 2000 characters”,”errorDuplicate”:”Duplicate comment”,”errorSmall”:”Comment text must be at least 2 characters long”,”hideButton”:”Hide comments”,”noComments”:” “,”commentOnModeration”:”Comment on moderation”,”postComment”:”Post”,”reply”:”Reply”,”showAllComments”:”Show All Comments”,”showButtonPostfix”:”comments”,”showButtonPrefix”:”Show”,”signIn”:”Sign in”,”update”:”Update comment”,”commentWasDeleted”:”This comment has been deleted”}},”related”:[{“id”:46550,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy84YWM0ZTQzZGJhYTllMmViYzdhNjg3MjUxZTUxM2Q0YS5qcGc=.jpg”,”url”:”https://cointelegraph.com/news/blockchain-to-disrupt-music-industry-and-make-it-change-tune”,”title”:”Blockchain to Disrupt Music Industry and Make It Change Tune”,”lead”:”Blockchain technology is tipping the scales of the music industry, shifting the power from intermediaries back to artists.”,”leadfull”:””,”category_id”:19,”category_url”:”https://cointelegraph.com/category/analysis”,”category_title”:”Analysis”,”author_url”:”https://cointelegraph.com/authors/antonio-madeira”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL2FudG9uaW8tbWFkZWlyYQ==”,”author_title”:”António Madeira”,”author_img”:”https://images.cointelegraph.com/images/32_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy81MTYxMjQ3NmZjNzRkNjdjNDBlYmM2Zjc1OGFiNjJkNC5qcGc=.jpg”,”date”:”JUN 06, 2020″,”flash_date”:”JUN 06, 2020″,”sponsored”:false,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”Analysis”,”label”:”info”},”published”:{“date”:”2020-06-06 08:15:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:156388,”rss_date”:”Sat, 06 Jun 2020 08:15:00 +0100″,”publishedW3″:”2020-06-06T08:15:00+01:00″,”show_referral”:true,”isMagazine”:false},{“id”:79573,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy9mYmNhYjI0ZjA0ZDMwMjVkMmM3Mzg1MTQzNWU4NDAyYS5qcGc=.jpg”,”url”:”https://cointelegraph.com/news/platform-launches-worlds-first-lunar-sensitive-nfts”,”title”:”Platform launches world’s first lunar sensitive NFTs”,”lead”:”This blockchain-based platform wants to make you part of its story.”,”leadfull”:””,”category_id”:62,”category_url”:”https://cointelegraph.com/category/sponsored”,”category_title”:”Sponsored”,”author_url”:”https://cointelegraph.com/authors/max-moeller”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL21heC1tb2VsbGVy”,”author_title”:”Max Moeller”,”author_img”:”https://cointelegraph.com/assets/img/icons/author_male.jpg”,”date”:”JAN 18, 2022″,”flash_date”:”JAN 18, 2022″,”sponsored”:true,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”Sponsored”,”label”:”default”},”published”:{“date”:”2022-01-18 11:30:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:3190,”rss_date”:”Tue, 18 Jan 2022 11:30:00 +0000″,”publishedW3″:”2022-01-18T11:30:00+00:00″,”show_referral”:true,”isMagazine”:false},{“id”:78581,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xNmE1ZWQyODIwNWM4YmQ2MDczOThmNDNlYmI4NTk4ZS5qcGc=.jpg”,”url”:”https://cointelegraph.com/news/three-blockchains-one-circulating-supply-defi-project-thinks-big”,”title”:”Three blockchains, one circulating supply: DeFi project thinks big”,”lead”:”This DeFi company is based on three blockchains — and offers DApps that allow assets to be transferred across chains quickly.”,”leadfull”:””,”category_id”:62,”category_url”:”https://cointelegraph.com/category/sponsored”,”category_title”:”Sponsored”,”author_url”:”https://cointelegraph.com/authors/chris-jones”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL2NocmlzLWpvbmVz”,”author_title”:”Chris Jones”,”author_img”:”https://cointelegraph.com/assets/img/icons/author_male.jpg”,”date”:”DEC 29, 2021″,”flash_date”:”DEC 29, 2021″,”sponsored”:true,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”Sponsored”,”label”:”default”},”published”:{“date”:”2021-12-29 18:00:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:15580,”rss_date”:”Wed, 29 Dec 2021 18:00:00 +0000″,”publishedW3″:”2021-12-29T18:00:00+00:00″,”show_referral”:true,”isMagazine”:false},{“id”:78695,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjEtMTIvMDY4MzY1NGQtMTM3Ny00Y2E4LTljZmMtYmNiYWE2NjdlMjk4LmpwZw==.jpg”,”url”:”https://cointelegraph.com/news/genesis-issues-6m-nft-backed-loan-to-meta4-capital”,”title”:”Genesis issues $6M NFT-backed loan to Meta4 Capital “,”lead”:”Institutional investors are increasingly entering the NFT space, particularly interested in providing original lending solutions.”,”leadfull”:””,”category_id”:2,”category_url”:”https://cointelegraph.com/category/latest-news”,”category_title”:”Latest News”,”author_url”:”https://cointelegraph.com/authors/ornella-hernandez”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL29ybmVsbGEtaGVybmFuZGV6″,”author_title”:”Ornella Hernández”,”author_img”:”https://images.cointelegraph.com/images/32_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8zMDUwZjJkNWRlZTljOWQ5MGY3NjQ1YjE4ZGI2OWNiNy5qcGc=.jpg”,”date”:”DEC 30, 2021″,”flash_date”:”DEC 30, 2021″,”sponsored”:false,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”News”,”label”:”default”},”published”:{“date”:”2021-12-30 14:00:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:4054,”rss_date”:”Thu, 30 Dec 2021 14:00:00 +0000″,”publishedW3″:”2021-12-30T14:00:00+00:00″,”show_referral”:true,”isMagazine”:false},{“id”:79438,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvMzFkMzk4MGEtZDBjOC00OGNjLTk4NTAtNDViYjQ3MmJhNTE0LmpwZw==.jpg”,”url”:”https://cointelegraph.com/news/3-reasons-why-near-protocol-near-just-hit-a-new-all-time-high”,”title”:”3 reasons why Near Protocol (NEAR) just hit a new all-time high”,”lead”:”NEAR price enters price discovery following the successful completion of a $150 million funding round and exponential ecosystem growth.”,”leadfull”:””,”category_id”:89,”category_url”:”https://cointelegraph.com/category/market-analysis”,”category_title”:”Market Analysis”,”author_url”:”https://cointelegraph.com/authors/jordan-finneseth”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL2pvcmRhbi1maW5uZXNldGg=”,”author_title”:”Jordan Finneseth”,”author_img”:”https://images.cointelegraph.com/images/32_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS9zdG9yYWdlL3VwbG9hZHMvdmlldy8xYjUxM2M1ZTc0Y2NlNTFmMWMxOGM1OTYzNWVjNDExMS5qcGc=.jpg”,”date”:”JAN 14, 2022″,”flash_date”:”JAN 14, 2022″,”sponsored”:false,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”Altcoin Watch”,”label”:”default”},”published”:{“date”:”2022-01-14 20:30:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:9083,”rss_date”:”Fri, 14 Jan 2022 20:30:00 +0000″,”publishedW3″:”2022-01-14T20:30:00+00:00″,”show_referral”:true,”isMagazine”:false},{“id”:79775,”retina”:”https://images.cointelegraph.com/images/1480_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”img”:”https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”thumb”:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”thumb370″:”https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”amp_thumb”:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”thumb150″:”https://images.cointelegraph.com/images/150_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDEvYTI1ZDI1MWMtZTg2OC00NWE5LThlNDAtZjYyZTZhN2FjYmVjLmpwZw==.jpg”,”url”:”https://cointelegraph.com/news/how-to-use-uniswap-a-step-by-step-beginner-s-guide”,”title”:”How to use UniSwap: A step-by-step beginner’s guide “,”lead”:”There are several ways in which users can get started using the Uniswap DEX such as the MetaMask wallet, the Trust Wallet, and the Coinbase wallet. “,”leadfull”:””,”category_id”:19,”category_url”:”https://cointelegraph.com/category/analysis”,”category_title”:”Analysis”,”author_url”:”https://cointelegraph.com/authors/valerio-puggioni”,”author_hash”:”aHR0cHM6Ly9jb2ludGVsZWdyYXBoLmNvbS9hdXRob3JzL3ZhbGVyaW8tcHVnZ2lvbmk=”,”author_title”:”Valerio Puggioni”,”author_img”:”https://cointelegraph.com/assets/img/icons/author_male.jpg”,”date”:”14 HOURS AGO”,”flash_date”:”JAN 22, 2022″,”sponsored”:false,”press_release”:false,”sponsored_label”:”Sponsored”,”explained”:false,”badge”:{“title”:”Analysis”,”label”:”info”},”published”:{“date”:”2022-01-22 09:00:00.000000″,”timezone_type”:3,”timezone”:”Europe/London”},”stat_uniqs”:4813,”rss_date”:”Sat, 22 Jan 2022 09:00:00 +0000″,”publishedW3″:”2022-01-22T09:00:00+00:00″,”show_referral”:true,”isMagazine”:false}]}” :shares=”{“facebook”:{“url”:”https://www.facebook.com/sharer/sharer.php?u=%URL%”,”icon”:”facebook”,”title”:”Facebook”,”sizesAllowed”:[{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”xs”,”label”:”Smartphones”,”breakpoint”:”> 480px”},{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"}],"position":1,"status":true},"twitter":{"url":"https://twitter.com/intent/tweet?text=%TEXT%","icon":"twitter","title":"Twitter","position":2,"status":true,"sizesAllowed":[{"size":"xxs","label":"Extra small devices","breakpoint":"< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}]},”telegram”:{“url”:”https://t.me/share/url?url=%URL%&text=%TEXT%”,”icon”:”telegram”,”title”:”Telegram”,”position”:3,”status”:true,”sizesAllowed”:[{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}]},”linkedin”:{“url”:”https://www.linkedin.com/shareArticle?mini=true&url=%URL%&title=%TITLE%”,”icon”:”linked-in”,”title”:”LinkedIn”,”position”:5,”status”:true,”sizesAllowed”:[{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}]},”copy”:{“url”:”%URL%”,”icon”:”copy”,”position”:7,”title”:”Copy Link”,”sizesAllowed”:[{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}],”status”:true},”whatsapp”:{“url”:”https://wa.me/?text=%TITLE% %URL%”,”icon”:”whats-app”,”title”:”Whatsapp”,”sizesAllowed”:[{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}],”position”:6,”status”:true},”reddit”:{“url”:”https://www.reddit.com/submit?url=%URL%&title=%TITLE%”,”icon”:”reddit”,”title”:”Reddit”,”sizesAllowed”:[{“size”:”xxs”,”label”:”Extra small devices”,”breakpoint”:”< 480px"},{"size":"xs","label":"Smartphones","breakpoint":"> 480px”},{“size”:”sm”,”label”:”Small tablets”,”breakpoint”:”> 768px”},{“size”:”md”,”label”:”Medium devices”,”breakpoint”:”> 992px”},{“size”:”lg”,”label”:”Large devices”,”breakpoint”:”> 1200px”}],”position”:4,”status”:true}}” is=”ExplainedPostPage”>
Unlike normal loans, flash loans do not require a borrower to provide typical requirements such as proof of income, reserves, or collateral.
While that may sound favorable to the borrower, there are pros and cons. Decentralized finance (DeFi) protocols have contributed to the popularity of flash loans. And most of these are on the Ethereum network.
Aave, an Ethereum lending platform, introduced the idea of flash loans in 2020. As such, the concept remains relatively new and still has a lot of issues to fix. According to Aave, flash loans have “no real-world analogy” and are “an advanced concept aimed at developers.”
In this article, we’ll be discussing the basics of so-called DeFi flash loans, as well as the safety issues and use cases typically associated with them. Let’s dive in.
Similar to traditional loans, flash loans are expected to be paid back in full eventually. However, there are also marked differences.
In typical lending processes, a borrower loans money from a lender. The amount is expected to be paid back in full eventually, with interest, depending on the terms discussed between the lender and the borrower.
Flash loans operate on a similar framework but have some unique terms and premises:
Use of smart contracts
A smart contract is a tool used in most blockchains to ensure that funds do not change hands until a specific set of rules are met.
When it comes to flash loans, the borrower is required to repay the full amount of the loan before the completion of the transaction.
If this rule is not followed, the transaction is reversed by the smart contract and the loan is nullified as if it never took place at all.
Unsecured loan
Unlike a traditional loan, a flash loan is an unsecured loan, meaning no collateral is needed.
However, this does not imply that the flash loan lender does not get their money back in case of non-payment. In a traditional loan, collateral is typically put up to ensure that the lender receives the money back in the event of non-payment.
Flash loans, however, happen within a very short timeframe (usually a few seconds or minutes). This means that while no collateral is needed, the borrower must return the full amount they borrowed right away.
Instantaneous transactions
As opposed to longer processes for traditional loans, flash loans are processed faster, thanks to smart contracts.
Getting a traditional loan approved usually is a long process. A borrower must submit documents, wait for approval, and pay the loan back in agreed increments within a stipulated period that may run into days, months or years.
On the other hand, a flash loan is expedited in an instant, which means that the loan’s smart contract must be fulfilled during the transaction for which it’s lent out. Therefore, the borrower is required to call on other smart contracts, using the loaned capital to perform instant trades.
The kicker: All this must be done in a few seconds before the transaction ends. Hence, the name: flash loans.
Simply put, in a flash loan, funds are borrowed and returned within seconds and in a single transaction.
The smart contract sets out the terms and performs instant trades on the borrower’s behalf using the loaned capital. If the flash loan yields a profit, it is typically charged a fee of 0.09%.
On a platform such as Aave, this is how flash loans typically work:
- The borrower applies for a flash loan on Aave.
- The borrower creates a logic of exchanges to try making a profit, such as sales, DEX purchases, trades, etc.
- The borrower repays the loan, makes a profit, and pays a 0.09% fee.
- If any of the following conditions occur, the transaction is reversed, and the funds are returned to the lender:
- The borrower does not repay the capital
- The trade does not lead to a profit
The above conditions suggest that what was laid out in the smart contract wasn’t met. As such, the funds are returned to the lender instantaneously. Theoretically speaking, flash loans are a low-risk option for both the borrower and the lender. Flash loans are typically seen as an easy, low-risk way to play with liquidity.
Can you make money with flash loans? Aave recommends having a good grasp of Ethereum, programming and smart contracts to make the most out of flash loans. Ideally, you can make money with flash loans, provided you do not fall prey to flash loan attacks. It would help if you thoroughly researched the protocols you want to borrow from and trade with, as well.
Flash loans are used in DeFi protocols, which are based on the Ethereum Network and Binance Smart Chain.
Aside from Aave flash loans, dYdX flash loans, DEX flash loans and Uniswap flash loans have also risen in popularity. On Uniswap, for example, “flash swaps” allow users to withdraw or take back Ethereum-based tokens paired with other tokens.
While they may have been originally designed for developers, as of August 2020, flash loans without coding are easily accessible to less tech-savvy users. The credit for this goes to platforms like Furucombo and DeFi Saver, among others, who eliminated the need for technical coding skills.
Flash loans can be used for the following:
Flash loan arbitrage
One way for traders to make money is by pinpointing price discrepancies across various exchanges.
For example, if two markets price a cryptocurrency differently, a trader can use a flash loan. The trader can call separate smart contracts to purchase and sell from both markets, making a profit from the price discrepancy between the two.
Collateral swaps
This involves a quick swap of the collateral backing a user’s loan for another type of collateral.
Collateral swaps enable DeFi users to switch the collateral that they used to take out a flash loan on a lending app. For example, if a trader used their Ethereum (ETH) as collateral on one platform, they can then take out a flash loan to repay the previous loan and withdraw their Ethereum (ETH).
Debt refinancing
Aside from collateral swaps, flash loans can also be used for “interest rate swaps.”
Aave cites an example on their blog:
- Borrow assets from Aave liquidity
- Payback debt on Compound
- Withdraw collateral from Compound
- Deposit collateral on Dydx
- Mint debt on Dydx
- Return liquidity to Aave
Flash loans are relatively new technology and, therefore, prone to attacks by hackers and malicious users who try to game the system and use it to their advantage.
In a flash loan attack, a borrower can trick the lender into believing that the loan has been repaid in full, even if it has not.
Technically, the thief poses as a borrower and takes out a flash loan from a lending protocol. The protocol is then used to manipulate the market and trick lenders. In some cases, attackers create arbitrage opportunities to exploit vulnerable smart contracts. This way, the attackers can purchase tokens for cheap or sell them at higher prices to exploited contracts.
Flash loan attacks are common because they are the easiest and quickest to pull off.
This is because the protocols associated with flash loans are not yet foolproof against new attacks and manipulations. With transactions happening in mere seconds, hackers can attack multiple markets in one go.
The most common flash loan attacks in DeFi are fake arbitrage opportunities, which we mentioned above. In a flash loan attack, an attacker creates an arbitrage opportunity by modifying the relative value of a trading pair of tokens. This can be done by using their loaned tokens to flood a contract and create slippage.
A large majority of DeFi hacks are flash loan attacks. Since the technology is new, vulnerabilities are not readily apparent and may require skilled developers to identify.
Flash loan attacks can cost DeFi protocols and their users hundreds of millions. As such, safeguards must be put into place to ensure that a protocol is robust and sanitized.
Despite being vulnerable to attacks, there are several preventive measures that DeFi systems can take to protect themselves:
Decentralized pricing oracles to protect against slippage
Contracts are left vulnerable to manipulation and exploitation when they perform their own calculations of a particular token’s value or trading pair value internally.
As such, flash loan attack risks can be mitigated by using decentralized pricing oracles such as chainlink and band protocol to fetch price feeds. By doing this, instead of relying on singular DEX platforms, DeFi systems can avoid becoming vulnerable to arbitrage scams.
Smart contracts may continue updating their prices based on the supply and demand of various tokens within their market. However, the price ranges should also be limited in reference to external values. When smart contracts work this way, it would be much more difficult for attackers to create slippage and make attacks profitable.
Tools for detecting possible attacks
DeFi platforms can use tools that minimize the possibility of attacks by detecting unusual activity, along with smart contract bugs and exploits.
As such, defenses can be put in place even before an attack is launched.
It is also vital for platforms to conduct security audits to address vulnerabilities before launching a smart contract. This would require reviewing the smart contract’s code for any weaknesses and addressing them even before the attacker has an opportunity to use it against the platform and its users.