What is DeFi

What is DeFi and how does it work? How do you make money with DeFi? What is DeFi example?

What is DeFi

What is DeFi?

DeFi is the English abbreviation of "Decentralized Finance", which is a concept opposite to "Centralized Finance" or CeFi, which mainly refers to a blockchain application project built on a programmable public blockchain network such as Ethereum, with cryptocurrency value anchoring, lending, swapping and other financial activities as functional goals, and consisting of a series of smart contracts and applications.

Traditional financial activities are carried out with financial institutions as the core, whether it is payment, lending, securities investment, foreign exchange trading, or futures, options, swaps and other derivatives transactions, are managed and controlled by central financial institutions. On the one hand, investors need to fully trust the financial institutions that occupy a central position; on the other hand, financial institutions also need to review and screen compliance matters such as customer identity, source of funds, and use of funds. Therefore, traditional financial activities are called "centralized finance".

The so-called "decentralized finance" emphasizes getting rid of the control, intervention and credit dependence of financial intermediaries, eliminating user review and differential treatment, using blockchain technology to fix smart contract content, transaction process records and encrypted asset status, completely realizing financial disintermediation, so that participants in financial activities can directly complete transactions according to the established financial logic of smart contracts.

The value orientation of "decentralization" makes DeFi applications always exclude the identification of users and node servers, and there is a direct conflict with the financial regulatory rules of countries around the world in the direction of anti-money laundering, anti-tax avoidance, counter-terrorism, anti-foreign exchange evasion, etc., so it is widely criticized and even explicitly prohibited.

However, it is also this "decentralized" value orientation that prompts DeFi to base the transaction structure and financial logic on the assumption of "stranger network", as far as possible to completely strip away the credit dependence or ability dependence on any subject, purely rely on logical and self-consistent game models and code algorithms to solve financial problems such as term mismatch, insufficient liquidity, collateral price decline, exchange rate changes, etc., hoping to fundamentally solve misappropriation, embezzlement, fraud, corruption, default configuration, Moral hazard issues that can arise from human factors such as the transfer of benefits.

what is defi

Not relying on the management ability and credit level of any subject, relying solely on speculative arbitrage, risk hedging and other game models to build the transaction structure and financial logic of the product, this is the most fundamental difference between DeFi and traditional financial services, and it is also its core value.

Several classes of typical DeFi applications

From the functional point of view, the most popular DeFi applications can be roughly divided into stablecoins, swaps, lending and other derivatives categories.

Stablecoins

The so-called stablecoin refers to a cryptocurrency whose value is anchored to a certain (or basket) of fiat currencies. Strictly speaking, many cryptocurrencies are barely "assets" and are difficult to classify as "currencies." In addition to the lack of legal attributes such as legal compensation and mandatory, they also have a very serious flaw, that is, the value of the currency is unstable. Like traditional financial activities, DeFi also needs a general equivalent of stable value to act as a medium of exchange and a scale of value, which is the direct reason for the emergence of "stablecoins".

In the cryptocurrency space, there are many stablecoins with prices anchored to the US dollar, but they have not shed their dependence on centralized subjects and therefore cannot be classified as DeFi. For example, USDT and USDC, both claim that the value of the currency is anchored to the dollar, and both claim to set up a "1:1" dollar deposit reserve to support the demand for redemption, but whether these dollars are stored in an undisclosed corporate account or in a tracked and audited escrow account, objectively speaking, a centralized entity with a fiat reserve account as the core will be formed, which is in direct conflict with DeFi's "decentralized" concept.

Dai, a stablecoin launched by the Maker DAO community on the Ethereum platform, takes a completely different solution. It makes full use of market-oriented game models such as margin trading and currency arbitrage, and realizes the price anchoring of stablecoin DAI to the US dollar while adhering to the principle of "decentralization".

defi decentralization

When minting DAI, users must lock in tokens of a certain value ("Pledge Coins") as collateral in their pool of encumbered assets set up. For each pledge coin, the system specifies a minimum guarantee rate (e.g. 150%) pegged to a stable rate (e.g. 5.5%). After coinage, the system dynamically adjusts the lower limit of the number of locked pledge coins according to this minimum guarantee rate and the market price of the pledge coin (if the number of pledge coins is lower than this lower limit, the system will start the collateral auction procedure, allowing any user to bid for the pledge coin at a DAI discount, thereby maintaining the security of the DAI). When the user returns the DAI, the system (after deducting the stabilization fee) unlocks the corresponding amount of pledge coins according to the guarantee rate and market price.

Thus, minting DAI is equivalent to "borrowing" DAI in security from 150% of the value of the pledge coin, while "returning" the DAI is equivalent to releasing a pledge coin of 150% value on the condition of principal and interest repayment. In this way, a strict value substitution relationship is created between the DAI and the pledge coin, thus creating conditions for currency arbitrage.

Once the market price of DAI is higher than $1, there is an arbitrage opportunity to lock in the pledge coin to "borrow" dai and then sell dai from the exchange, that is, the "short opportunity" of dai. As dai's supply increases, its dollar price will fall back accordingly until it returns to $1.

Conversely, if the market price of DAI is less than $1, it will generate an arbitrage opportunity to buy DAI and "return", release and sell the pledge coin, that is, the "long opportunity" of DAI. As dai continues to be bought, its supply will decrease, pushing its dollar price higher until it rises back to $1.

Under the coordination of the above arbitrage mechanism, the value of DAI can be stabilized at the target price of "$1" through the market game between bulls and bears.

dai eth

Token swaps

Centralized cryptocurrency exchanges, the business scope includes the exchange transaction between cryptocurrencies and fiat currencies, so it is generally necessary to conduct KYC (Know Your Client) review of users, and adopts a centralized trading model of centralized custody, pending order matching, and centralized settlement, so it does not conform to the concept of decentralization. There is a class of applications in DeFi that specifically solve the problem of swaps between different tokens, and they make full use of the arbitrage model to establish an automatic exchange asset pool in pairs of two pairs of tokens, creating an "auto-market maker" token swap model.

Uniswap is currently the largest and most influential decentralized token exchange ("DEX") traded on the Ethereum platform. The project presets two types of users: liquidity providers and traders.

Liquidity providers inject token pairs into the swap pool in a "1:1" value ratio to provide liquidity (assuming x A coins and y B coins), and the system will distribute the asset pool share coins to them at the ratio of the assets they inject into the total value of the asset pool, representing the corresponding share of the asset pool interest they hold.

Traders can "swap" out another token (assuming Δx Bcoin) by "putting" one token (assuming Δx A-coin) into the asset pool, and the system will complete the swap according to the basic formula of the constant product of the number of the two tokens, namely:

For each swap transaction, the system imposes a 0.3% fee and remains in the asset pool, which is equivalent to a proportional distribution to liquidity providers, thereby encouraging the injection of assets into the swap pool to increase liquidity, while hedging the value loss caused by the arbitrage transaction to the asset pool (see below for details).

When a liquidity provider injects token pairs into an asset pool, it should ensure that the value of the two tokens is equal at the market price of the exchange, otherwise arbitrage space will be created, giving speculators the opportunity to profit from the overvalued tokens in exchange for undervalued tokens from the asset pool.

Whenever a swap transaction occurs, it will lead to an increase in the number of input coins in the asset pool, a decrease in the number of swap coins, resulting in a decline in the ratio of the input coin relative to the swap out coin, when its price falls below the level of the market price plus fee, arbitrage space will be generated, promoting speculators to reverse the operation, thereby reducing the total amount of input coins in the asset pool, prompting its comparison price to return to the market price.

It is by using this arbitrage mechanism and cross-market game that the system maintains the ratio of the number of tokens in the swap asset pool to the ratio of the market price of the two tokens, and the swap asset pool acts as a "market maker", providing bilateral quotations to currency exchange users in real time.

Therefore, uniswap's token exchange arrangement, in essence, can not be completely separated from the traditional cryptocurrency exchange and exist independently, must rely on the exchange to provide market price support, its arbitrage mechanism can work.

defi projects

If you analyze the source code in depth, you will find that Uniswap tacitly transfers the "swap currency" to the user first, and then calculates whether the "input coin" is sufficient, and allows the addition of other smart contracts between the previous two steps to control the transaction process. This is actually to reserve programming space for cost-free arbitrage, so that speculators can first take out the "swap out of the currency", make a profit through other transactions and then pay the "input coin" in the same block transaction, so as to complete the swap transaction, which is the so-called "lightning swap".

In fact, the swap asset pool is the only counterparty of speculators, and each speculator will inevitably include a 0.3% fee in its arbitrage cost, so the net income obtained by each arbitrage exchange is actually the collective value loss of liquidity supporters. Further, for users who do not have the protection of automatic arbitrage procedures, simply relying on the provision of liquidity to profit is actually a very irrational investment behavior, and it is completely dependent on the transaction volume without arbitrage motivation to be large enough to allow the fee income to hedge against the value loss that the arbitrage exchange will inevitably produce.

Cryptocurrency lending

Compound and AAVE are more influential cryptocurrency lending projects on the Ethereum platform, their business models are very similar, they are set up separately by currency pool, liquidity providers deposit tokens into the pool of funds in exchange for the share of the asset pool, borrowers lend tokens from the pool on the basis of excess guarantee, floating interest rate and compound interest calculation, the system relies on the ratio of token supply and demand to determine the deposit and loan interest rate, through the liquidation arbitrage, collateral auction mechanism to supervise repayment and promote bad clearance, In turn, an automated lending market for cryptocurrencies is constructed.

In the case of AAVE, for example, the system sets up two types of user roles: liquidity provider and borrower.

Liquidity providers can deposit the cryptocurrencies accepted by the system into the corresponding pool of borrowed funds, and the system issues an equal amount of share coins (A tokens) to them to represent their equity share in the pool. Depositors can apply for redemption at any time, and after recovering and destroying the A token, the system will transfer the corresponding "deposited coins" to the user.

If you only want the deposit to receive interest, passively hold the A token, the system will issue the interest income generated by the pool of funds in the form of A token proportional to the liquidity provider; if you want to borrow, you can use the A token as a guarantee to lend "loan coins" from the pool of funds whose total value does not exceed a specific upper limit.

The Loan To Value ("LTV") represents the upper limit of the ratio of the value of a token that can be lent to the value of the pledge coin, secured by a certain deposited coin. The pledge rate of different deposited coins is not the same, and the collateral rate of safe, stable and large circulation tokens is higher, and the total value of the tokens that can be guaranteed to be lent will be higher, and vice versa.

Once a borrower's account (due to interest accumulation, appreciation of the borrowed currency or depreciation of the pledge currency) exceeds the upper limit of the pledge rate, the system will trigger the liquidation mechanism of the guarantee warehouse, at which time any user who holds the borrowed coins can purchase the corresponding pledge coins in the asset pool at a discounted price, which is equivalent to auctioning the borrower's pledged property to repay its debts, dispose of the poorly, and close the risk exposure.

Loan interest rates, regulated entirely by market forces, fluctuate up and down with the supply and demand of the borrowed coins. The higher the utilization rate of the borrowed coin (the ratio of the total loan amount to the total deposit amount), the higher the loan interest rate; if the utilization rate exceeds a certain critical value, the loan interest rate will rise rapidly at a steeper rate of change, thereby suppressing borrowing demand, attracting deposit supply, and supervising repayment.

The deposit rate, calculated by dividing the interest income of the deposited coin by its total number of deposits, is equivalent to distributing the interest on the loan directly to the depositing user.

Interest is calculated as compound interest with a minimization period. Whenever an event affecting the loan interest rate occurs in the system (such as: deposit, borrowing, redemption, liquidation of the guarantee warehouse, etc.), the loan interest rate of the corresponding asset pool will be recalculated, the interest payable will be calculated, and the interest payable will be credited to the corresponding borrower's account (i.e. compound interest calculation). In the actively traded lending market, each time an Ethereum block is generated, a number of transactions that affect the interest rate are recorded, which means that the entire system is basically a continuous calculation of compound interest in blocks of time.

On the whole, the core mechanism of the decentralized cryptocurrency automatic lending market is mainly reflected in two aspects: first, relying on the supply and demand of tokens to determine the deposit and loan interest rate, and at the same time relying on the fluctuation of interest rates to affect the number of token deposits and loans in turn, thereby achieving a dynamic equilibrium of token supply and demand; second, relying on the guarantee warehouse liquidation mechanism to urge borrowers to pay attention to currency value changes, timely repayment, and promote the market to clear and quickly dispose of risk assets, thereby maintaining the asset health and sufficient guarantee of the entire market.

Similar to other DeFi applications, decentralized lending applications rely on external market price information to figure out key questions such as whether the pledge rate is overrun, so they cannot exist independently of centralized exchanges.

Technical characteristics of DeFi

In summary, DeFi applications contain at least four common technical characteristics: one is built on the public chain, the second is that the blockchain system supports programming, the third is that the code is completely open source, and the fourth is to make full use of speculative arbitrage and game balancing mechanisms.

The public chain has the basic characteristics of blockchain technology that cannot be tampered with, is difficult to destroy, and is pre-positioned for reconciliation, and can conveniently fix the smart contract code, transaction records and account status, while maintaining anonymity and openness to the whole society, which is convenient for attracting crypto assets, blockchain applications and users to join the project, and is also in line with the basic concept of "decentralization".

Supporting programming is key to turning complex financial logic into executable computer code. Ethereum, which represents "Blockchain 2.0", has built its own Turing-complete scripting language Solidity and embedded virtual machines that can execute code, thus opening the era of smart contracts for blockchain applications. To date, Ethereum remains the most thriving community platform for DeFi applications.

Open source code is a necessary means for stranger networks to gain user trust, improve smart contract functions, and ensure code security. The smart contract stored on the blockchain is the compiled binary code, and only by thoroughly disclosing the source code can it be convenient for all sectors of society to verify and review, confirm the consistency of its code logic with the commercial description, and check whether it has logical errors or security vulnerabilities.

Speculative arbitrage is the basic driving force that attracts speculators to participate in trading and restores market equilibrium. Formally, because it is profitable, speculators have the incentive to intervene in trading, through arbitrage activities and long-short games to restore the balance of supply and demand in the market, and then achieve the basic goals of each DeFi application. The basic logic of the arbitrage mechanism determines that DeFi cannot completely separate from the centralized exchange and exist independently, on the one hand, the exchange needs to provide price information of the relevant currency, on the other hand, the exchange needs to directly connect the fiat value to provide an exit from the market for arbitrage trading.

The first three of the above four characteristics basically belong to IT technology, while the fourth belongs to financial technology. From the trend point of view, the focus of innovation in DeFi applications has increasingly shifted from the field of IT technology to the field of financial technology.

Legal challenges posed by DeFi

As mentioned earlier, all kinds of DeFi applications exclude the identification of users from the value, so there is a direct conflict with the financial regulations and regulatory rules of countries around the world in the direction of anti-money laundering, anti-tax avoidance, counter-terrorism, anti-foreign exchange evasion, etc. The issue of identity is actually a pervasive problem of public blockchain applications, and the advent of DeFi has added to the complexity of this problem.

At present, centralized cryptocurrency exchanges basically require registered users to provide identity information and strictly conduct KYC review, but the addresses and wallet applications of public blockchains such as Bitcoin and Ethereum still maintain anonymous attributes. This makes it easy to transfer cryptocurrencies obtained from centralized exchanges from real-name accounts to anonymous wallets, and then transfer value through payment transactions between anonymous wallets, thus making the KYC review of the exchange meaningless.

Even so, transfer transactions between anonymous wallets can theoretically be traced and traced between anonymous wallets along the endorsement traces of cryptocurrencies, while the emergence of DeFi, which is typical of the structure of the pool of funds, directly cuts off the possible tracking path.

For example, DEX applications such as Uniswap set up swap fund pools according to token pairs, while lending applications such as Composite and AAVE set up lending fund pools according to different currencies, which directly cut off the transfer payment path of cryptocurrencies, so that the funds entering the pool and the funds out of the pool no longer have continuous endorsements, making it impossible to track the circulation path of a specific cryptocurrency.

In addition, after the emergence of DeFi, cryptocurrencies can be easily minted or exchanged into stablecoins, directly anchored in value with hard currencies such as the US dollar, and can be easily used through lending applications, margin transactions and financial leverage, which undoubtedly amplifies the impact of cryptocurrencies on the financial system such as foreign exchange management, capital control, and monetary legal solvency of sovereign countries, and may even affect macro monetary policies such as currency issuance and basic interest rates.

Therefore, the legal challenges brought by DeFi are not limited to the problems of counter-terrorism and anti-money laundering brought about by the exclusion of identity, but also the impact on the financial security, monetary policy and monetary sovereignty of sovereign countries. In fact, in some countries with hyperinflation or foreign exchange controls in Asia, Africa and Latin America, cryptocurrencies (especially stablecoins) have even become a circulation tool for consumer payments, trade settlement, and even cross-border payments and international settlements. This is why a growing number of sovereign states have begun to pay serious attention to the development of cryptocurrencies and have begun to study special legislation to regulate cryptocurrency exchange and other related financial activities.

The innovative value of DeFi

In addition to the negative challenges, DeFi actually has a lot of positive rule-based innovation value. In summary, this is mainly reflected in three aspects; one is that decentralized solutions may completely eradicate the moral hazard problem, the second is that a fully open smart contract system is conducive to regulatory review and social supervision, and the third is that "lightning trading" may greatly save transaction costs and reduce delivery risks.

Decentralized solutions

Whether it is "illegal ICOs", "pyramid scheme traps", "Ponzi schemes" or "P2P explosions", many times the financial risks with huge social impact do not actually stem from identity problems, but from the moral hazard of asset managers who are in a central position and are entrusted to manage other people's property. DeFi, which is characterized by "decentralization", is precisely the problem that is first concerned and solved.

First, DeFi does not have a centralized entity that holds or controls the wealth of investors. The cryptocurrency paid by the user to the DeFi application will be stored directly in the blockchain address of the relevant smart contract, and can only be accessed, exchanged or liquidated by calling the smart contract interface on the terms agreed in advance, and no external entity can bypass the smart contract and dispose of these properties according to its subjective will. This is like depositing banknotes into an ATM machine without a banknote box door, and can only be completed by interactively invoking the built-in program through the user interface, and it is impossible for anyone to directly take out the banknote box in the machine. This fundamentally eliminates the possibility of misappropriation and embezzlement of investors by centralized entities.

Secondly, the direct control of the DeFi transaction process is the smart contract, which is essentially the computer code fixed in the blockchain ledger, which has the characteristics of not being tampered with, the logic direction is determined, and automatic execution, unlike natural language contracts, there is room for interpretation and malicious default. Therefore, situations such as "P2P self-financing" and "Ponzi scheme" that artificially change the use of funds are impossible to occur in the DeFi scenario controlled by smart contracts.

Third, the obligatory clause of DeFi is automatically triggered by the smart contract and does not require human invocation, which avoids the possibility of malicious default by the obligated subject by refusing to call the smart contract interface. This is like a vending machine, the supplier is reserved for the interface to load the goods, the consumer is reserved for the coin or payment interface, and the trigger conditions for releasing the goods are automatically judged and triggered by the computer program, and do not require the supplier to confirm or intervene, thus avoiding the possibility of the supplier's default.

Fully transparent rule system

DeFi's financial logic is fully publicly displayed through smart contracts, and the information such as trading rules, pricing algorithms, configuration strategies, etc. is fully transparent, which is very conducive to market participants and financial regulatory authorities to test and analyze financial risks.

For example, the Uniswap project, which uses token exchange as a function, directly destroys the initial 1,000 equity tokens of the swap asset pool in its minting algorithm, which is equivalent to retaining the "core own capital"; for example, the AAVE application with the function of lending, its loan interest rate is positively linearly related to the utilization rate of funds, and there is an upper limit of capital utilization, making it impossible for the entire application to exceed the total amount of the capital pool and overdraft the loan. At the same time, dynamic accounting for compound interest (that is, interest principalization) and adjusting the pledge rate of each lender, once the pledge rate exceeds the limit, the collateral liquidation procedure is initiated, which is equivalent to using the three mechanisms of excess guarantee, floating interest rate and minimum reserve to comprehensively resolve the "term mismatch risk".

If we analyze the financial logic and business model of each DeFi project in depth, we can find that it draws on a large number of financial technologies and financial concepts that already exist in mature financial products such as ETFs, ABS, swaps, etc. With the iterative evolution of DeFi applications, smart contracts that express and implement these financial concepts are likely to become the most valuable "experimental results", and with the widespread application of fiat digital currencies and adopted by traditional financial institutions, it will eventually be very likely to take root and play a role in the alliance chain that emphasizes identity.

"Lightning Trading" mode

It is worth mentioning that in Uniswap, AAVE and other projects, there is a concept of "lightning transaction", that is, if you can achieve "first take the coin and then pay the coin", "lend first and then return" in the same block transaction, you can achieve "no cost arbitrage" without investing tokens or providing guarantees in advance, and completely rely on code logic to achieve "no cost arbitrage".

This arrangement is actually the use of smart contract technology to integrate multi-step financial activities such as "bridge fund lending" and "cross-market arbitrage" into an inseparable atomic transaction, and to achieve data interaction with the blockchain ledger through a distributed computing, thereby achieving the purpose of transaction.

If the concept of "lightning trading" is extended to the transaction process of fiat digital currency and digital financial assets, it will greatly improve transaction efficiency, reduce credit occupation such as bridge fund lending, and greatly reduce or even completely eliminate the delivery risk of complex transactions.

Where will DeFi go?

Currently, DeFi applications define themselves in terms of "protocols," which is mostly used to name international conventions. The author understands that this may have two meanings: first, it emphasizes that the core of the project is a series of smart contracts rather than any subject, highlighting the basic value orientation of "decentralization"; second, emphasizing that the project is a "rules-based multilateral trading system" and highlighting the international law concept of open rules, fair application and equality of all parties.

If you think deeply about the market structure, trading categories and trading methods of cryptocurrencies, it is actually very similar to the real-life foreign exchange market. Full competition, abundant liquidity, centralized exchanges and over-the-counter trading coexist, and the world operates continuously 24 hours a day.

One day, if major economies successfully launch central bank digital currencies and build a globally integrated digital financial market infrastructure based on programmable alliance chains, will the current business models and smart contracts of various DeFi applications evolve into the basic rules and standardized contracts of the future digital foreign exchange market?

Whether it is the flame of Prometheus or Pandora's box, it may have become an unavoidable and unstoppable historical trend.