Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

The future direction of lightning loans is still worth thinking about, such as the possibility of cross-chain lightning loan transactions being realized. We expect a breakthrough in cross-chain lightning lending after cross-chain lending matures.


The concept of lightning loans was first introduced by Marble in mid-2018, but it was only a year later that lightning loans slowly started to develop and came to the attention of blockchain users in 2020. Lightning loan transactions are founded on the blockchain’s atomization feature and are a special type of unsecured lending transaction. The atomization feature requires that all relevant operations of the user must be in one transaction hash, including repayment operations. If any of the requirements is not met, the entire transaction involving multiple operations must be rolled back and the failed transaction cannot be packaged.

With this setup, lightning deals theoretically allow users to lend all the passes in the liquidity pool in an unsecured manner, subject to the return of the borrowed passes and a fixed borrowing cost after a series of swap collateral clearing operations and before the end of the transaction. This lending method perfectly solves the default risk of current on-chain lending, and brings a new possibility for blockchain users compared to traditional on-chain lending where the lending is done through over-collateralization.

Before this possibility was discovered, lightning lending, however, entered the public eye due to two attacks. bZx suffered two lightning lending attacks in February 2020, on the 15th and 18th, respectively, with losses amounting to $330,000 and $640,000 each. Meanwhile DeFi has seen an intensive period of lightning loan attacks since liquidity mining caused the DeFi wave.

The chart below shows the 12 lightning lending attacks discovered so far, with a total loss of $99.65 million. Interestingly, two months after the attack, Cream.Finance proposed on April 8 that it would offer Cross-Protocol Flash Loans, which would be done through Iron Bank. The cross-protocol flash lending will be done through Iron Bank.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Lightning Lending Attack Summary

Source: Huobi DeFi Labs

Looking at the block time dimension of the blockchain, the lightning loan has a maturity period of zero on the blockchain. This means that the interest rate on lightning loans should be zero, i.e. the interest rate on the loan multiplied by the maturity period is zero. Huobi DeFi Labs believes that in the far future, the service fee rate for lightning loan protocols will converge to zero, and from this perspective dYdX seems to be more friendly to lightning loan users, while Aave and Uniswap V2 ask for a higher fee of 0.3%. It is still unknown whether Aave and Uniswap V2 will be able to divest themselves of the Lightning Lending business in the future and offer service rates that are independent of the overall agreement. However, in the current lightning lending race, the three agreements have cut into the lightning lending market with their own advantages and features.

Uniswap V2 is the latest among the three mainstream protocols to provide lightning lending services, but as a DEX leader, Uniswap V2 stands out in terms of transaction frequency and lending pass comparison with high liquidity, dividing 60-70% of the lightning lending transaction market. As the first protocol platform to discover lightning lending transactions, dYdX is also not to be underestimated, despite offering only three mainstream assets for lending, namely ETH (WETH), USDC and DAI. dYdX has a whopping 21 DeFi protocols involved in lightning lending transactions. aave, as the purest lending protocol among the three, differs from the other two by offering directly callable lightning Aave is the most pure lending protocol among the three, and differs from the other two by providing directly invocable lightning lending functions; at the same time, Aave is currently the main recipient of lightning lending calls from several DeFi protocols, such as DeFi Saver and Furucombo, which are both major customers of Aave’s lightning lending transactions.

In addition to these three mainstream protocols, Huobi DeFi Labs also focuses on Instadapp, a contemporaneous protocol of Uniswap V2 that provides lightning lending services, which started out offering COMP leveraged liquidity mining and debt position management, and caused a small wave of interest within a month of its launch. a small wave of lightning loan transactions. It was also the first protocol to introduce the concept of bulk flash lending, but the protocol fell silent after Uniswap V2 went live and Aave exploded in popularity.

This report focuses on the on-chain data of these four protocols, tracking a total of about 110,000 lightning loan transaction data, and seeks to present a full picture of lightning loan transactions on-chain by analyzing this data. The analysis perspective covers the number of transactions, address analysis, debit pass types and debit amounts for mainstream assets, while summarizing and comparing almost all protocols around the lightning lending function in the market.

Approximately 110,000 Lightning Lending transactions from four protocol platforms

Based on the basic fact that the protocols offering lightning loans on Ether are Uniswap V2, Aave, dYdZ and InstaDapp, Huobi Defi Labs tracked a total of 108,000 historical lightning loan transactions from these four protocols. Different protocols use different approaches to provide the underlying lightning lending service, and Huobi DeFi Labs uses different methods to obtain on-chain data based on the characteristics of each protocol.

The overall approach is summarized in the figure. Aave provides encapsulated lightning lending functions directly to users and tracks lightning lending transaction hashes through lightning lending function calls; dYdX obtains transaction hashes based on four event logs; Uniswap V2’s lightning lending on-chain transaction data determines transaction hashes through Dune Analytics’ UNISWAPV2CALL hash; Instadapp’s transaction data is obtained in the same way as Aave, through its lightning lending function call tracking.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Summary of Lightning Lending on-chain data sources and how they are obtained

Source: Huobi DeFi Labs

The summary of lightning loan transaction data obtained from the four lightning loan protocols is shown below. Instadapp has no new lightning loan transaction data after July 2020, but it is still one of the subjects of this report for lightning loan on-chain data due to its considerable transaction data.

Lightning loan market enters stable period with bull market

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Lightning Loan Transaction Time Distribution Chart

Source:, Huobi DeFi Labs

The temporal distribution of historical lightning loan transactions on Etherscan is shown in the graph. The first lightning loan transaction appeared on June 21, 2019 and was generated by dYdX. Lightning credits occurred only on dYdX in 2019 and the number of lightning credits in that year was only 148 until January 18, 2020 when the second protocol Aave, which generated lightning credit transactions, started to appear. However, at this point lightning loans were still not known to the general public until the famous bZx attacks on February 15 and 18.

In April and May of 2020, InstaDapp and Uniswap V2 went live to offer flash lending services, and in June flash lending transaction data showed the start of the first round of outbreaks. This round of outbreaks was related to the launch of liquidity mining by Compound in June. Liquidity mining caused the beginning of the DeFi mania, and Instadapp’s timely launch of COMP leveraged liquidity mining, debt positions and collateral swap management features in the same period became the main driver of the round’s outbreak.

The second outbreak occurred in October last year, driven by uniswap V2, while lightning loan attacks entered a high period from that month. And the percentage of flash loan transactions occurring on Uniswap V2 had been maintained at around 60%, and even the highest had been close to 90%. However, after the launch of Aave V2, Aave V2 divided part of the lightning loan transaction market. At present, the transaction frequency of the lightning loan market is stable at Uniswap V2 accounting for 70%, Aave accounting for 20% and dYdX accounting for 10%.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Lightning Loan Transaction Percentage Time Distribution Chart

Source:, Huobi DeFi Labs

Uniswap V2 Lightning Transactions Failure Rollback Rate of 9.1%

Lightning lending transactions can generate failed rollback results due to their nature, but we only capture failed rollbacks for Uniswap V2 due to the way the data is captured. with about 6k failed rollbacks out of 66k transactions for Uniswap V2, Uniswap V2 lightning lending transactions have a 9.1% failed rollback rate.

Uniswap V2 experienced a large number of failed rollback transactions on July 22, 2020 and January 22, 2021, with specific values of 1,139 and 308 transactions, respectively. This phenomenon may be due to the frequent debugging of its strategy by users on that day. All data analysis results in this report do not include the data of this rollback transaction if not specifically stated.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Historical Distribution of the Number of Failed Rollback Lightning Loan Transactions on Uniswap V2

Source:, Huobi DeFi Labs

Batch Lightning Lending feature may still be in early stages

On December 3, 2020, Aave announced the launch of its V2 version of the main website, accompanied by several feature updates. This includes Bulk Lightning Lending, which allows users to borrow multiple different passes in Lightning Lending at once. But this is not a precedent for Bulk Lightning Lending.

A total of 145 bulk lightning loan transactions occurred on Ether before March 12, 2021, accounting for only 0.13% of the total number of historical transactions. The distribution of the number of transactions is shown below. Although Aave was the latest to offer bulk lightning lending, about more than 60% of bulk lightning lending transactions occurred through Aave. Uniswap V2 and Instadapp_batch both had about 15% of bulk lightning lending transactions, while dYdX did not have any bulk lightning lending transactions.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Distribution of Bulk Lightning Loan Transaction Protocols

Source:, Huobi DeFi Labs

The chart below shows the historical distribution of bulk lightning lending transactions according to on-chain data. The chart shows that the first bulk lightning lending transaction ever was a bulk lightning lending transaction on Instadapp on June 17, 2020. The chart also shows that bulk flash transactions offered by each agreement platform are clustered at different times, and there appears to be a later generation that has completely banned the bulk flash feature of the former.

Since Aave went live with its bulk flash lending feature, it has included almost all of the bulk flash lending transactions. However, the number of bulk flash transactions is too small, and since the arbitrage of flash transactions on Aave is low compared to other protocol platforms, we believe that the real value of bulk flash is still undiscovered.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Batch Lightning Loan Historical Transaction Frequency Distribution Chart

Source:, Huobi DeFi Labs

Average 1.5 callers for 1 strategy smart contract

There are two types of accounts in Etherscan: external accounts and contract accounts. Based on the understanding that external accounts do not contain code and contract accounts contain contract code, the From Address of a lightning loan transaction parsed by etherscan is an external account or a contract account, and the To Address is a contract account. In other words, the From Address is the caller of the contract account, which can be a normal user or a bot, while the To Address is the lightning lending strategy itself.

Address duration is mainly short term

Before that, Huobi DeFi Labs first analyzed the From Address and To Address time series. 8365 From Addresses had the longest interval of 583 days between the first and the latest transaction; 5591 To Addresses had the longest interval of 613 days between the first and the latest transaction. 613 days. In addition, for the purpose of this report, the time interval between the first and the latest transaction is defined as the duration, but since there is a possibility that these addresses will have another flash credit transaction in the future, it is important to note that the latest transaction does not represent the last transaction.

The ratio of the number of From Address to To Address is 1.5, indicating that on average, about 1.5 users/robots invoke and execute the contracts of the Lightning Lending strategy.

About 35% of the From/To Addresses are within six months and 20% are within 30 days, which reveals that lightning lending strategies may last for a very short period of time as customized transactions; or most of them are customized transactions for a hot protocol, pass-through, special purpose, etc., so most strategies may only last for a short period of time as the market changes due to on-chain market conditions. The duration distribution shows that the two types of strategies can only last for a short period of time. The survival time distribution chart shows that about 60% of flash transactions occur only on the same day for both addresses, which indicates that there may be a large number of failed flash strategy contracts; or the on-chain market conditions are not compatible with flash strategy transactions, and these addresses have to wait for the on-chain market conditions to reach the preset judgment conditions before they can be triggered/invoked again, etc.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

From/To Address Time Survival Distribution

Source:, Huobi DeFi Labs

Historical trends of duration and frequency

The figure below shows the historical data of From Address and To Address for all transactions, the number of transactions over 100, and the number of transactions over 500; the size of the circle in the figure indicates the size of the number of transactions, the horizontal axis is the time of the first transaction at a certain address, and the vertical axis is the time of the latest transaction at the corresponding address. Thus, both From/To addresses are distributed in the upper left area of the graph.

Before March 2020, the number and area of scatters are small, indicating that lightning loans are episodic; the large number of scatters from March 2020 onwards indicates that the number of From/To addresses has entered a surge phase, while the obvious increase in the area of scatters over time also indicates that the number of From Address initiations and To Address calls is on the same white-hot trend.

Most of the scatters are around the 45-degree line, indicating that the From/To Addresses represented by the scatters are only short-term in behavior, i.e., the time between the first transaction and the latest transaction is short. Some of the scatters are located at the top of the horizontal axis, indicating that these addresses still have flash credit transaction behavior in the near future.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

From Address and To Address Transaction Time and Frequency Distribution

Source:, Huobi DeFi Labs

Different protocols of lightning loans show different address distribution patterns

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Distribution of From Address and To Address by Protocol

Source:, Huobi DeFi Labs

The ratio of the total number of From Address to To Address is 1.5. When focusing on different protocols, the ratio of AAVE_d119, Uniswap V2 and dYdX is about 1.3, which is similar to 1.5. The From/To ratios of AAVE_c7a9 and Instadapp and its bulk lightning loan Instadapp_batch are very different, while Instadapp has equal numbers of From Address and To Address, while AAVE_c7a9 shows a completely different ratio, with only 33 To Addresses. There are only 33.

Four major protocols occupy the market of different lightning loan pass-throughs

More than half of the lightning loan transactions are ETH, DAI and USDC

Lightning Lending on-chain transaction data shows that a total of 1,015 passes were lent out as Lightning Lending, of which more than 53% of the transactions had ETH, DAI and USDC as borrowing passes, accounting for 28%, 15% and 11% respectively. The three types of passes have different roles on Ether, with ETH as a native asset on Ether and DAI and USDC as stable coins on Ether.

The top ten most frequently borrowed passes account for 61% of the total number of transactions, and the frequency distribution in each protocol is shown below. In addition to the three most frequently borrowed passes, the remaining passes are: TUSD, a stablecoin; WBTC, a pass-through asset; DeFi Pulse Index, a tradable index pass with 14 DeFi assets as the underlying asset; Dynamic Set Dollar and Frax, passes for the algorithmic stablecoin project; LINK, a pass for the prophecy machine Chainlink; and Uniswap V2, a pass that only occurs on Uniswap. and KP3R, which occurs only on Uniswap V2.

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Top 10 Borrowing Passes by Protocol Frequency Distribution

Source:, Huobi DeFi Labs

The distribution of the top 10 borrowing passes by protocol shows that only 30% of the lightning deals on Uniswap V2 come from these top 10 borrowing passes. Uniswap V2, as the head DEX, offers borrowable passes from all pools on the platform, and the actual data shows that a total of 927 passes have been borrowed by way of Uniswap V2 lightning loans. This advantage shows that Uniswap V2 dominates the market for lightning loan transactions for long-tail assets.

In addition dYdX only offers transactions on ETH, USDC and DAI and mainly occupies the market for lightning loan transactions on these three major passes. dYdX has 1% of the other passes in the chart as borrowed passes with empty resolution results.

dYdX’s top three borrowing passes each have accumulated several times the amount of other agreements

The historical transaction data of lightning loans shows that the three most frequent borrowing passes are DAI, USDC and ETH, based on these three passes we further study the distribution of borrowing amounts of the three major borrowing passes on different protocols. Since the price values of the three passes are not the same in different periods, the amounts are shown here in terms of how much quantity; and all data in the report do not differentiate between WETH and ETH.

The results are shown in the chart below, which shows that the amounts of dYdX’s top three Lightning Lending passes stand out in an overwhelming way across multiple protocols. This occurrence is an apt reflection of the absolute attractiveness of the low or even 0 lightning loan transaction fees on dYdX. Outside of dYdX, Uniswap, Aave and Instadapp show an irregular distribution of pass-throughs.


Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Distribution of total cumulative amount borrowed by Lightning Loans

Source:, Huobi DeFi Labs

Lightning Lending Transactions Involve a Wide Range of Protocols

The DeFi protocols involved in Lightning Lending transactions are a good indicator of the complexity and breadth of Lightning Lending’s current strategy, as they are often used for transactions on other platforms. However, the degree of parsing differs between them, resulting in different statistical results. For this reason, the results of this section of the data are based on the highest value for both.

The chart below shows the DeFI protocols involved in the Lightning Lending transactions. On the left are the four major protocol platforms Uniswap V2, Aave, dYdX and Instadapp that provide Lightning Lending functionality, and on the right are the total number of protocol platforms involved in each Lightning Lending transaction, 22 in total (including dYdX).

The statistics show that lightning deals occurring on the dYdX protocol involve up to 21 DeFI protocols, which means that the strategies used on this protocol are more complex and diverse, resulting in lightning deals generated by it involving a wider range of protocol platforms. In contrast the Instadapp protocol has the most homogeneous number of protocol platforms involved in lightning loan transactions, with only 8, namely Curve, Kyber V3, Oasis DEX, Uniswap and its V2, Sushiswap, Aave V1 and dYdX.

The protocols that were called tens of thousands of times among the called DeFi protocol platforms were Sushiswap (~24,000 times), Uniswap V2 (~21,000 times), Balancer (~12,000 times), and Compound (~10,000 times), and those that were called less than a hundred times were dYdX (79 times), Bancor (37 times) , Lendf.ME (3 times) and EtherDelta (1 time).

Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Lightning Lending Exchange Involved DEX Distribution Map

Source:, Bloxy, Huobi DeFi Labs

An ecosystem based on lightning lending capabilities is being built

Over 10 protocol platforms offer lightning lending services directly or indirectly

Huobi DeFI Labs sees lightning lending as a functional technology of the blockchain, around which a lush ecosystem can develop. Currently, there are at least 10 protocol platforms with lightning lending capabilities, including Uniswap V2, Aave, dYdX and Instadapp, which were analyzed earlier in this report, as well as DeFi Saver, Furucombo, Kollateral, Deerfi, Collateralswap, NFT20 and others. The project provides lightning lending services directly or by calling lightning lending functions of other protocols to provide related services.

Uniswap V2 has the highest degree of freedom in its lightning lending service

The lightning credit function is often used as a means of arbitrage, so the degree of freedom to invoke it greatly limits the possibilities of its invocation. The degree of freedom of Lightning Lending can be measured in 2 basic dimensions.

  1. The means of invocation is at the code level or at the front-end level. The degree of freedom is usually higher for flash credit protocols that can be invoked directly via code than for front-end level flash credit protocols, because code level flash credit protocols can be used for a wide variety of flash credit strategies, which are implemented via smart contracts. Smart contracts consist of complex operational instructions, so a code-level lightning lending protocol is easier to combine with a smart contract. For example, although Furucombo builds lightning lending tools for users with no coding experience, enabling users to customize DeFi strategies with simple drag-and-drop, the lightning lending strategies it can implement are weak compared to the lightning swap functionality through calls to Uniswap V2.
  2. the types of passes and the size of the credits that can be offered by the Lightning Lending Protocol. For example, dYdX and Aave can provide far fewer types of lightning credit passes compared to Uniswap V2, so the freedom of these two types of protocols is less than that of Uniswap V.
Lightning loan attacks are frequent, and this history of ethereal lightning loans is worth studying

Source:, Bloxy, Huobi DeFi Labs

DeFi Saver aims to create a one-stop management solution for the DeFi protocol, and with unique features such as one-step (de)leveraging (Boost and Repay), CDP automation (CDP Automation) and one-step CDP closing (1-transaction CDP Closing), it now offers Aave as the foundation of the lightning lending rich product experience. Users are able to manage debt positions in MakerDAO, Aave and Compound.

The Deerfi protocol basically follows the Uniswap model, but it has a smaller number of pools available at the moment and still takes longer to sink assets; in addition it provides a front-end page where users can invoke Deerfi Lightning Lending after providing a deployment contract address containing a strategy.

Kollateral aims to aggregate the liquidity of large pools such as dYdX and Aave and make it available to developers through a simple interface. The disadvantage is that the lightning loan funds are a three-party platform, which is not as good for developers as developing them directly themselves.

Collateralswap helps users quickly Swap collateral assets without having to pay off outstanding debts. Its functional implementation is similar to DeFi Saver’s Loan Shifter, except that the current ALPHA version of Collateralswap only supports MakerDAO.

NFT20 as a decentralized exchange and exchange protocol for NFT, NFT20 team on March 26th official announcement online NFT Lightning Loan, support unsecured borrowing NFT from various NFT pools, the total number of pools with liquidity greater than 0 is currently 61, and no fees for the time being. NFT20 team said its lightning loan function is very similar to the implementation of Aave, the use of scenarios including arbitrage, and NFT20 as the most exotic type of lightning loan, its freedom is higher than the front-end manipulation type.

Cream.Finance, a newly launched cross-protocol lightning loan provider, supports 64 types of borrowing passwords and charges only 0.03% commission.


The total number of transactions in the lightning loan market is only 110,000, which is not a very impressive transaction figure on Ether. As a native function of Ether, Lightning Lending can be used to help users achieve collateral conversion, position closing, debt position management and other operations. At the same time, lightning loan as a special lending tool with its unsecured feature becomes a special means of attack, arbitrage, and because of this, a source of risk in DeFi. It can be seen that lightning lending provides a solution to credit risk for Ether, but also brings the risk of attack. With lightning credit as one of the sources of risk, DeFi projects currently need to consider how to effectively prevent lightning credit attacks, but the emergence of three lightning credit attacks in February this year shows that current DeFi projects do not seem to have effective defenses.

The dYdX, Aave, and Uniswap V2 analyzed in this report each offer flash lending services with some differences in their own unique ways. dYdX offers only the three main assets USDC, DAI, and ETH and has captured the flash lending market for these assets. Uniswap V2 offers a special flash lending service where repayment passes can be inconsistent with borrowing passes, which from an arbitrage From the arbitrage point of view, it can reduce the step of having to exchange back the borrower’s pass when the user trades and thus reduce some Gas fees. Aave provides a packaged flash credit function, which allows users to get the calculated loan amount and fee directly by calling the flash smart contract when repaying the loan, while the other two agreements need to be calculated externally and returned manually. Aave’s flash lending function is also the main caller of other service protocols (e.g. DeFi Saver, Frucombo).

There is a trend of diversification in the technical aspects (invocation methods) and ecological conditions (number and size of liquidity pools, etc.) of the lightning lending services provided by these three mainstream lightning lending protocols in the current market, however there is a desire to achieve convergence at the technical level. yield protocol developers proposed a standardized version of the lightning lending proposal EIP-3156 in November 2020 and in late January 21 proposed a standardized version of the bulk Lightning Lending proposal EIP-3234. convergence at the technical level has some benefits in terms of reduced difficulty in developing Lightning Lending functionality, but perhaps the size and variety of liquidity that Lightning Lending protocols can provide is more important to Lightning Lending users.

It is still worth thinking about the future direction of flash lending, such as the possibility of cross-chain flash lending transactions coming to fruition. in September 2020, FlashEx published an article on Medium about cross-chain stablecoin flash lending; the project envisioned completing cross-chain flash lending between bitcoin, ethereum, and boca, but there have been no further updates to the project’s official website or official community. Nevertheless, we still expect cross-chain lightning to break through when cross-chain lending matures.

Also based on the concept of lightning, lightning casting has become a topic of interest for a few researchers and users. Compared to lightning lending where the borrowed amount is limited by the liquidity size of the liquidity pool, lightning casting breaks the limitation of the liquidity pool size. However, this report does not analyze flash casting due to the fact that no mature protocols for flash casting were observed at the time of this writing or market data is scarce. However, it does not mean that Huobi DeFi Labs is not positive about this feature, on the contrary, we note the existence of features such as Yield Protocol, WETH10, etc. with lightning casting. We expect more innovative features and related protocols to emerge to enrich the overall blockchain market.

Posted by:CoinYuppie,Reprinted with attribution to:
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Like (0)
Donate Buy me a coffee Buy me a coffee
Previous 2021-05-26 04:02
Next 2021-05-26 05:17

Related articles