Browsing Tag: flash loan


    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