Browsing Tag: bZx


    After the black swan, the DeFi data mutation!

    July 5, 2020

    On February 6, 2020, the total value of ETH and ERC-20 tokens locked in Ethereum’s DeFi ecosystem exceeded US $1 billion. After a series of high-level “smash” incidents, a series of “black swan” events coincide.

    bZx attack event

    In mid February 2020, two arbitrage “attacks” occurred in bZx protocol. After the event data statistics show that the two attacks before and after bZx protocol caused the total loss of 3649 ETH. Because Uniswap uses algorithmic price, the price is easy to change dramatically when the transaction depth is limited; arbitrage “attacker” just takes advantage of the algorithm price defect of Uniswap to manipulate the transaction price of some assets maliciously, which causes the users of the related DeFi protocol who introduce the Uniswap data as the Oracle price to suffer huge asset losses.

    ETH Locked in DeFi
    total value locked in DeFi

    After the bZx incident, from February 18 to February 19, the ETH lock up amount of Ethereum head DeFi protocol decreased by about 175000, about 5.8%; while the lock up amount of USD stable currency assets did not change significantly.

    The bZx protocol attack event led to a significant decrease in the number of ETH lockups, which indicates that a large number of DeFi users have doubts about the security of the DeFi protocol. At the same time, the bZx incident triggered a collective discussion on the issues related to the oracle and the flasloan in the industry.

    The encryption market plummeted on March 12

    At the end of the first quarter of 2020, the new crown epidemic is spreading rapidly around the world, which has a serious impact on almost all walks of life. The US stock market has experienced several historic fusions, and the crypto investment market is no exception. On March 12 (later known as “Black Thursday”), the U.S. stock market collapsed, and BTC, ETH and other mainstream encryption assets fell sharply by nearly 40% in a single day. According to the data, during the period from March 12 to March 13, all kinds of trading activities on Ethereum network increased significantly, resulting in serious network congestion for a long time, and many of the DeFi protocols had the highest active period in history.

    The market crash on March 12 affected almost all types of investment assets, including cryptocurrency, except for the stock market. Although the relationship between crypto investment market and traditional financial market does not always exist, the one-day crash and stock market crash are almost caused by the same reasons: the global panic and liquidity crisis caused by the new crown epidemic.

    Enlightenment from the collapse of encryption market on March 12: what is missing in DeFi?

    ETH locked in DeFi 2

    Based on the analysis of the data of online DeFi, we found that there was a large fluctuation in the amount of ETH lock positions from March 7 to 18

    3.07-3.10: ETH lock up volume increased from 2.893m to 3.03M, up 4.7%

    3.10 ~ 3.12: ETH lock up volume began to decline sharply, from 3.03M to 2.928 m, a decrease of 3.4%

    3.12-3.13: ETH lock up volume began to increase again, from 2.928m to 3.037m, up 3.7%

    3.13-3.18: ETH lock up volume began to decline all the way from 3.037m to 2.792m, a decrease of 8%

    This kind of volatility is the true reflection of Ethereum DeFi ecology in the case of a large drop in the price of ETH: at the beginning, the price of ETH fell slightly, the bondholders continued to make up their positions, and the amount of ETH locked positions increased; however, after the great fall of ETH price, some creditors did not have time to make up their positions, or gave up covering positions At the same time, there are also some debt holders who actively redeem the mortgage assets to avoid closing positions, which also makes ETH lock position decrease.

    From the above data performance, the instantaneous negative impact of 312 crash event on ETH lock up is less than the previous bZx attack event; however, as the price of ETH continues to fall, the impact of the event on the lock up of DeFi ecological ETH is growing: in the week after March 12, ETH lock up volume decreased by 12.2%.

    total value locked in DeFi 2

    On the other hand, on the day of 312 sharp fall, the scale of USD stable currency assets locked in DeFi declined significantly, from 893.43m on March 12 to 559.211m on March 13, and the 24-hour stable currency lock position decreased by more than 37%, which is also related to the “liquidity crisis” in the encryption market proposed by later industries.

    ERC777 protocol reentry attack

    On the morning of April 18, 2020, the Uniswap protocol was successfully attacked by hackers using the re-entry vulnerability. The hacker carried out this reentry attack through the compatibility defects of Uniswap and ERC777 standards, which exhausted about 1278 ETH assets in the Uniswap ETH-imBTC pool.

    What’s worse, just 24 hours later, at 08:45 a.m. on April 19, another DeFi protocol, dForce, was attacked by hackers in a similar way. In the dForce attack, hackers successfully borrowed a variety of encryption assets from dForce platform by using inflated imBTC as collateral, resulting in heavy losses to dForce platform users, with a total amount of up to 25 million US dollars. (Note: the stolen funds were recovered successfully under the coordination of various efforts)

    total value locked in DeFi 3
    ETH locked in DeFi 3
    total value locked in DeFi 4

    After the incident, the encryption funds of dForce lock warehouse dropped to nearly 0, and the head of the difi users suffered a serious impact, which greatly damaged the vitality of the whole industry. However, this re-entry attack is not a major technical vulnerability with high complexity, but a low-level development vulnerability, which does not have more impact on other Ethereum DeFi protocols. Therefore, from the data performance point of view, after the attack event, the lock up amount of ETH and USD stable currency assets of DeFi ecology did not fluctuate significantly.


    However, on the 19th, there was a huge increase in the related transactions of USD stable currency assets on Compund; in addition, the trading volume of USD stable currency on Kyber and IDEX also increased. Some of these data changes are closely related to the operation after hackers steal dForce assets.

    The incident of this reentry attack has triggered collective speculation in the DeFi industry, which is of great significance to the development of the entire DeFi industry. It makes more and more DFI developers begin to reexamine security issues, decentralization principles, rights and responsibilities involved, and even so-called moral issues.

    The above is about some accidents and data in the DeFi ecology since 2020.

    DeFi has just started, and it will be more wonderful next time. Let’s look forward to it!


    Credit of a block

    June 24, 2020

    The anonymity of blockchain makes the concept of “credit” redundant. All the loans and levers on the chain need to be fully mortgaged. Even if someone tries to find another way to establish a weak credit through some “identity” asset, it is also a kind of disguised mortgage in essence (it is known that this is also a kind of mortgage after noticing the word “asset”). In the world of blockchain, if you can’t guarantee the performance, you can’t have credit. Generally, the only way to guarantee the performance is mortgage. It’s in line with this logic to look at various decentralized loans and stable currency schemes on the chain.

    Recently, however, BZX The arbitrage event provides a credit solution: through the flash loan interface, ensure that the asset call in the contract succeeds = the call returns more assets, the contract call fails = the asset does not change, and in this transaction, you can control the asset in the contract at will, as long as the asset is repaid in this transaction, there is no restriction on the use of the asset System, with a great degree of freedom, is similar to the real world liquidity financing (different from dedicated funds). It can be said that this structure realizes the credit of a transaction. Since the transaction is completed in a block, we can call this credit “one block credit” (see Note 1 for the flow of flash loan). Some people may think it’s just “a block of credit”. It has no advantage in time and its value will be very small. Indeed, if we take into account the numerous credit assets in the real world, this “one block credit” is unattractive. However, there is a situation that becomes very important, which is arbitrage!


    Different from the traditional commodity economy, in the financial world, once the opportunity of risk-free arbitrage appears, its demand will no longer be a downward curve, but a straight line perpendicular to the horizontal axis (arbitrage yield), that is, the demand is infinite! Any participant, as long as they have the funds or the financing ability, will try their best to participate in this opportunity. This is an ideal situation. In the real world, when real arbitrage opportunities appear, there is often an important constraint: “lending restrictions”, that is, people who find opportunities do not have funds, nor can they finance to complete arbitrage, resulting in that this opportunity can only be used by a few people, or even not used for a long time. The inefficiency of resource allocation is intolerable to most financial scientists, so the criticism of lending restrictions has never stopped. In the real world, it is difficult to judge whether an arbitrage opportunity is really risk-free and whether the borrowed liquidity can be returned in time. Therefore, the lending restrictions and partial “market inefficiency” have never completely disappeared.

    However, the existence of inter contract transfer and flash loan on the blockchain may make the lending restrictions in the traditional financial world and the resulting “market inefficiency” completely disappear! This is because in the chain, through this kind of flash loan design, two problems mentioned above are solved at the same time: 1. Whether the arbitrage opportunity really exists; 2. Whether the repayment can be made in time. Now for example, if there is contract a, an arbitrage opportunity is exposed. At this time, any fund pool o supporting flash loan in the blockchain world, and a participant s, s who finds the opportunity, do the following arbitrage contract B for the opportunity: call asset X in O, and interact with contract a. if the arbitrage succeeds, return asset X in O. if the arbitrage fails, return asset o is low On X, contract B is cancelled. According to such a contract process, the authenticity of the arbitrage opportunity is verified by whether the loan assets can be effectively returned, so that conditions 1 and 2 are met at the same time. It is noted that O and s can be any fund pool and individual, which means that there are no obstacles and selectivity in the whole process, thus fully reflecting the homogeneity of participants and financial needs, and perfectly solving the inefficient problem of resource allocation.

    Of course, the perfect implementation of the lightning loan also has certain basic conditions to guarantee: a large number of asset pools supporting the lightning loan interface and allowing mutual calls between contracts. If these two conditions are met, a perfect decentralized financial system will be built, and its efficiency will far exceed that of traditional finance. This is not only because of code execution, but also because it perfectly solves the arbitrage risk and the credit problem required by arbitrage. However, it is worth mentioning that if contract calls create new arbitrage opportunities, this is not the expected behavior to promote market effectiveness, which belongs to a new kind of financial attack. In the following articles, we will conduct a more in-depth analysis on condition 1 just mentioned, and need to make a distinction, because if we take advantage of the transaction characteristics of the contract, it is carried out externally Restructuring, forming new affairs, is not a real arbitrage of market inefficiency, but undermines the effectiveness of the market. For contracts and contract calls, we will conduct in-depth analysis. See the following articles for details. However, in any case, because lightning loan creates a new kind of credit, which helps to overcome the “borrowing constraints”, it is an important discovery in the field of blockchain and provides a lot of help for subsequent development.

    What kind of changes will a block’s credit bring to the world? Let’s see!

    Note 1: Flash loan, using the transaction characteristics of a transaction (acid: atomicity, isolation, consistency, durability), has a callback design for the loan model, as follows:

    1) In addition to specifying the loan amount, the loan function entry also needs to specify a receiving contract address
    2) Acceptance of contracts is subject to the requirements given in the loan specification
    3) The loan interface calls the specified callback function of the receiving contract and transfers, and records the balance status before transfer
    4) When receiving the loan transfer, the callback function is called. You can use the received assets to perform custom contract logic, or call other contract functions
    5) After the execution of the receiving contract function, return to the callback point of the valet function, then you can get the pre transfer balance status of the third part. At this time, check whether the repayment has been received. If not, enter the abnormal status, and the whole transaction will be cancelled.

    As mentioned above, a supervised “credit loan process” is completed through callback design and transaction characteristics of transactions