Deconstructing the DeFi ecosystem, and multiple ways for the oracle to optimize the DeFi ecosystem

Author: Chainlink

Original link: https://blog.chain.link/analyzing-the-defi-ecosystem-and-the-many-ways-chainlink-can-accelerate-adoption/

Finance is an art of fund management, and its main goal is to maximize (risk-adjusted) asset returns. Whether it's putting money in a deposit account for interest, or investing in stocks or real estate, consumers can use a variety of financial instruments to achieve different goals and avoid various risks.

Decentralized finance (also commonly known as DeFi) has a decentralized back-end architecture that re-constructs common financial instruments. The current development momentum cannot be underestimated. Users no longer need to participate in financial markets with the assistance of centralized institutions, but can use open source software in a decentralized network to obtain, trade, and borrow assets. Therefore, many autonomous P2P financial markets have emerged. Not only can they be open and transparent, but they can also automate processes based on data.

This article details the current unique infrastructure, products, and market structure in the DeFi field, and highlights how developers will use Chainlink oracles to enhance the functionality and practical applications of DeFi financial instruments.

DeFi market status at a glance

Alex Pack, a partner at Dragonfly Capital , said: " DeFi 's goal is to restructure the global banking system and create an open and license-free operating environment."

The current financial system revolves around central bank currency issuance and large banking institutions, which often act as trusted third parties in transactions. Fiat currency provides stability to financial markets, and banks often raise debt, raise interest rates, and reduce loan quotas to increase productivity. Without these two types of institutions injecting liquidity into the market and providing the necessary business infrastructure, the speed of the market and innovation will be greatly reduced. However, the current financial market structure has certain drawbacks. The value and flow of capital is determined by a centralized entity, and inefficiencies in the process can have a negative impact. Therefore, centralized entities will interfere with the market, capital circulation channels will be restricted, and contract cycles will be extended.

With DeFi, the currency and banking infrastructure is no longer owned by a centralized entity, but truly belongs to all market participants. In the DeFi world, currencies will no longer be issued by authoritative institutions, financial networks will no longer run on centralized servers, and currencies and markets will be run by users themselves through distributed software protocols, which can access reliable networks at any time State consensus. This new infrastructure has open source code that can be verified and anyone in the world can access the network without permission. At the same time, the network also adopts a decentralized security model to ensure that all operations cannot be tampered with. DeFi not only transfers the trust object from people to code, but also has the potential to achieve huge network effects, because people from any corner of the world can develop or use DeFi Dapps, which builds a real trust foundation for financial markets.

Detailed DeFi infrastructure

The DeFi infrastructure consists of multiple elements, each of which is explained in detail below.

currency

If a sound financial market is to be established, there must be a reliable and universal medium to determine value and complete value exchange. This medium must be scarce in order to accurately price the market; it must also be universally applicable in order to guarantee its long-term value as a general transaction medium. Money has been this medium for a long time. Gold is one of the best media in history. Although the US dollar is now regarded as the world's reserve currency, gold has been a reserve asset in the global market since ancient times, and now central banks in various countries still use gold as a reserve, and the value of all other currencies will be benchmarked against gold.

Blockchain provides us with a new form of currency. Cryptocurrencies are neither physically scarce nor issued by a centralized entity. They are only software compiled by mathematical algorithms, using non-tamperable code logic. Defines its scarcity. Such currencies can be easily traded through distributed consensus, and everyone in the network can verify them. Cryptocurrency not only meets transaction needs, but also serves as a license-free value storage tool (PSOV) in DeFi. PSOV is similar to a reserve asset, which can be mortgaged and generate loans similar to those issued by modern banks (though mortgage rates are much worse than traditional banks). Although it is widely believed that Bitcoin is virtual gold and a reserve asset, the DeFi ecosystem has taken root and sprouted on Ethereum. Ethereum (ETH) is the main type of mortgage asset. David Hoffman discussed this issue in his article "Ethereum is by far the best currency model."

(David Hoffman proposes that Ethereum is a "three-dimensional asset" because it is both a value storage tool, a capital asset, and a consumer asset. Source: The Defiant )

assets

Assets are all tangible or intangible items that can be owned and exchanged for value. There are a variety of assets in the financial market, among which tangible assets include commodities (oil, electricity, food), infrastructure (real estate, machinery, trains) and rare luxury goods (artwork, cars, collectibles); Including patents, copyrights, and goodwill. Most assets are tracked internally by the parties to the transaction. In addition, banks that assist in transactions or government agencies responsible for tax and compliance also conduct external tracking. In addition, large audit firms value many assets and verify that internal and external reports match.

Because the asset market lacks absolute authenticity, there is much room for improvement in this system. The current asset market has many contradictory and non-public accounting systems, so it is difficult to consider the pricing of assets in its entirety. The same asset in the market is often valued differently, so both parties to the transaction usually ask a third-party expert to evaluate the difference and determine the final value. Otherwise, the two parties to the transaction can only negotiate in private, and such negotiations often lead to differences or asymmetric information.

Blockchain and smart contracts will disrupt the foundations of asset ownership and valuation. The emergence of the token proves that smart contracts can associate the ownership of all off-chain assets with the unique public / private keys on the chain, thereby digitizing assets. All types of assets can be represented as tokens, such as real estate ownership, expensive art, or goods in the supply chain. The uniqueness of the blockchain is that it has a completely transparent accounting system and can obtain funds across geographical boundaries, so it is very suitable for registering assets. All parties to the transaction in the blockchain can trade in a transparent and equal system, which can not only eliminate friction caused by cross-networks, but also value assets based on the real situation of the market.

Financial product

Except for the physical exchange of goods, any kind of value transfer can be regarded as a financial product. Whether it is an exchange-assisted transaction, a bank issuing (credit or bond) debt, or transferring ownership of certain types of assets (such as securities, derivatives, rights), they all belong to a certain trading mechanism or speculative mechanism. Most financial products are issued by large financial institutions such as investment banks. Investment banks have a lot of capital and are richer in resources. These big banks enjoy the advantages brought to them by economies of scale and have a lot of capital in their hands to build infrastructure or mortgage to meet liquidity needs.

DeFi can turn assets into tokens on the blockchain, and use smart contracts to formulate transaction rules and user experience for financial products. The entire life cycle of smart financial contracts (including ownership, custody, maintenance, execution, and delivery) can significantly reduce or even get rid of human intervention. The trading rules for financial products are written in open source code and fixed in the contract with Boolean logic (that is, execute y if x occurs). Some of the most common financial products have been transformed into DeFi Dapps, including loan products, stablecoins, decentralized exchanges and derivatives.

data

All financial contracts require data input to execute and will produce data output. Such as sending payments with a mouse click, delivering futures contracts based on market data, or calculating bond yields based on current interest rates. Data quality often depends on the reputation of each platform, and some companies provide more accurate and reliable data than others. The value of data often depends on network effects, uniqueness, authority, or quality. The data includes raw data and processed data. Today's financial products are backed by data, but often there are human intervention or gray areas.

The blockchain can currently only make true / false judgments based on the data already on the chain. However, data such as prices, interest rates, and event results are often stored off-chain, and the values ​​and formats of different data sources vary widely. This uncertainty makes it difficult for blockchains to produce reliable true / false judgments unless sacrifices are made to consensus security. Due to this difficult conflict between data and blockchain consensus, we urgently need to build a standardized "bridge" between DeFi applications and various off-chain data. As mentioned before, Chainlink is a standardized and customizable blockchain protocol that can securely and reliably connect DeFi applications to various off-chain resources.

Chainlink connects smart contracts on any blockchain with any required data interface and covers the entire life cycle of the contract.

Human Factors

Although the goal of DeFi is decentralization, it is impossible to completely eliminate the human factor. In the final analysis, it depends on people to realize and maintain the automated operation of the financial system. In addition, there are areas where automation is almost impossible, especially protocol development and internal governance. Changes in external factors such as the political, cultural, and legal systems will also affect the market. Although distributed ledger technology (DLT) can realize the automatic operation of the system and be governed by a decentralized autonomous organization (DAO), this model is not yet mature. In fact, human intervention is still unavoidable. This is a problem that developers must face up to, and it is also a problem that they cannot completely eliminate with code logic.

Projects in the current DeFi market

To fully understand the DeFi market, we must first understand the definition of DeFi. A common metric in the DeFi market is the amount of mortgage funds in DeFi applications, which is currently about $ 764 million. This indicator means that Dapp uses virtual currency as collateral (usually Ethereum and DAI) to provide loans, revitalize funds, improve network process security, and obtain community governance voting rights.

According to https://defipulse.com/ , the amount of funds (in U.S. dollars) of the DeFi app in the past few months

But you can also say that the entire virtual currency world is a large DeFi application. In particular, mainstream virtual currencies such as Bitcoin and Ethereum, which have their own value and can also participate in pricing.

Let's take a look at the most common types of DeFi Dapps today, and delve into the way these applications are developed and the logic behind them.

MakerDAO

By far, the most popular application in the DeFi field is MakerDao. MakerDao is a decentralized loan platform that issues credit loans in units of DAI and manages the loan process through a decentralized autonomous organization (Note: Dai is a stable currency that is maintained at a 1: 1 exchange rate with the US dollar; DAO users all hold the platform governance token (MKR). In the traditional banking industry, banks can issue loans as long as they maintain a certain reserve ratio (Note: In the United States, banks have a reserve ratio of 10% and deposits in excess of $ 124 million). Local laws may differ, but generally all banks need to use 10% of their deposits as reserves, and the remaining 90% can be used as loans.

MakerDAO's model is also very similar, but the process is decentralized, and the reserve ratio is also different. MakerDAO users can mortgage Ethereum in smart contracts and receive loan funds denominated in DAI. The mortgage rate is currently set at about 150%, which means that users can receive a loan equivalent to 2/3 of the value of the mortgage asset. For example, if you mortgage $ 90,000 worth of ether, you can get a DAI loan worth $ 60,000. The loan to mortgage ratio in this model is higher than traditional banks.

It is worth noting that DAI loan products that accept multiple types of mortgages have recently been launched, and users can mortgage many different types of assets in addition to ether. This new product is marked by DAI, while the previous single mortgage product was marked by SAI.

MakerDAO unifies the incentives of all parties to keep the network in a decentralized mode. MKR token holders will vote on various system governance issues, such as how interest rates are set and how many loans are issued. In return for their hard work, lenders must use MKR tokens to pay interest. When the price of the mortgaged asset of the lender is lower than the asset liquidation price stipulated in the smart contract, the lender also needs to pay it a 14% penalty. This automatic loan settlement mechanism (Note: triggered automatically by the price predictor) can automatically hedge price fluctuations to ensure the solvency of the entire network. Once the loan is fully repaid, the system will automatically destroy the previously issued DAI / SAI and a certain proportion of MKR to ensure that the tokens become increasingly scarce over time. The most subtle aspect of MakerDAO is that all users benefit the entire network while benefiting themselves, so there is no need for a third-party centralized entity to coordinate with it.

Compound

Another popular DeFi Dapp is Compound. This is a loan agreement that functions with money market fund funds, and users can lend capital to others to earn interest. Lenders can obtain corresponding funds according to their "loaning capacity", which includes the balance of their tokens, market liquidity, and exchange rate (Note: the price predictor is connected to obtain this data). When the loan amount exceeds the loan capacity, the lender will be automatically liquidated. Compound can accept seven different mortgage assets, including BAT, DAI, ETH, USDC, REP, ZRX and WBTC.

Compound and Maker will eventually completely subvert the traditional banking industry. The main body of loan will change from large financial institutions to retail customers. The mortgage rate of loans and the size of the credit market will increase sharply. They will lower the market entry barrier and shorten the loan process, and everyone can make loans in the market to earn interest.

We recently joined Aave. Aave, like Compound, is also a money market DeFi protocol. Check out our recent blog post or watch the AMA video for more details.

Synthetix

Another new DeFi project is Synthetix, a decentralized cryptocurrency derivative platform. Synthetix users can mortgage the platform's native token SNX (Ether will be listed soon) and generate synthetic assets, including fiat currencies, virtual currencies, commodities, indices and other assets. Traders or investors of these synthetic assets can trade / invest without actually holding the assets. When a synthetic asset is swapped, its value also closely follows the market value of the underlying asset (Note: the access price predictor queries the market value). Synthetix recently connected to the Chainlink network and upgraded its price predictor to support synthetic assets including 7 foreign exchange and commodities. At the same time, the platform is also preparing to add more new asset types and improve the level of decentralization.

Synthetic assets are collateralized by SNX, and the mortgage rate is 750%. Each transaction of the mortgagor can draw a certain percentage from the platform transaction fee. Because there is no order book when swapping synthetic assets, platform traders can have unlimited liquidity. Moreover, users will assume a certain proportion of loans, and this proportion will rise or fall with the proportion of their synthetic assets in the total synthetic assets in the network. Each transaction is executed in accordance with the contract (that is, the SNX mortgage contract). The contract functions similarly to a clearing house and is the counterparty in each transaction. All positions in the network are open and transparent, and users can flexibly respond to situations where the risk is too high or too low, fully guarantee the mortgage rate is at an optimal level, and adjust their positions.

Decentralized Exchange (DEX)

Decentralized exchanges have been developing rapidly recently, and platforms such as Kyber Network, AirSwap, and Uniswap continue to set new transaction volumes. Decentralized exchanges provide an unmanaged platform for asset transactions, providing users with anti-censorship trading experience and different levels of security, such as letting users keep their private keys, while traditional centralized exchanges will keep them for users. Private key. In addition, the 0x protocol allows Dapp to implement a customized decentralized exchange function; the bZx protocol can coordinate cross-platform unmanaged loan processes, providing liquidity for margin transactions on decentralized exchanges; and the Loopring protocol passes the chain The following calculations and zkRollups guarantee the scalability and privacy of decentralized exchanges.

Chainlink recently connected to Loopring to ensure that the relayer has mortgaged sufficient LRC when computing zero-knowledge proofs on the chain. For more information, click on our recent blog post or watch the AMA video .

Other DeFi applications

Other recently popular DeFi Dapps include the Set protocol (automated asset management), Augur (decentralized prediction market), and Lightning Network (retail payment with Bitcoin). In addition, there are some ICOs for token crowdfunding, STO for equity crowdfunding (Note: STO = security token offerings), stable coins, commodity currencies (Note: such as the Ampleforh protocol for accessing the Chainlink network), and the underlying consensus protocol staking (POS, DPOS), and staking in DAO in the form of venture capital funds, insurance funds, and agreement governance.

How Chainlink is involved in building the next generation of DeFi applications

Chainlink is a decentralized oracle network that can greatly enhance the functionality of DeFi smart contracts, enrich the variety of DeFi products, and attract more highly regulated participants to the DeFi market. The four ways in which Chainlink enhances the DeFi ecosystem are explained in detail below.

Connect off-chain resources

Most DeFi applications need data to execute smart contracts. Some Dapps only use on-chain data, so there is no need to connect to off-chain data. ICO is a typical example. Since the exchange rate has been programmed into the smart contract code, no off-chain data is required. Although in some cases only on-chain data is sufficient, this model itself has many limitations because Dapps must meet specific data formats or can only use data on the native blockchain. If external data and resources cannot be connected, most DeFi applications cannot run.

The oracle can connect smart contracts to data and systems outside the native blockchain (that is, off-chain), reformat external connection points (that is, APIs), and ensure that the two different softwares are compatible with each other when exchanging data . The oracle transmits data to the smart contract, and performs operations in external systems according to the preset instructions and interfaces in the service agreement (SLA).

Chainlink is a decentralized oracle network that provides a secure and reliable bridge for smart contracts, connecting to data providers, web APIs, enterprise systems, cloud platforms, IoT devices, payment systems, and other blockchains. Smart contracts connected to these off-chain interfaces can easily access a variety of pre-formatted data inputs and outputs, and copy existing digital contract content. In this way, DeFi can use all types of off-chain data and systems to trigger contract execution, and use various payment gateways and enterprise back-end systems for contract delivery.

(How DeFi uses decentralized price data to trigger on-chain contracts and automatically execute transactions on Binance; for more details, please click on the Binance blog post )

Data is trusted, reliable, and customizable

No matter how elaborate the smart contract is, the final effect depends on the quality of the data received. Contract logic needs to be triggered by data, so data must be synchronized with the underlying blockchain in terms of security and reliability. Because oracles are still a new topic in the field of DeFi, many projects will initially develop their own oracles. These oracles usually aggregate data off-chain (including data on interest rates, exchange rates, and prices), and then manually transfer the data to the chain. Although it is very necessary to do this in order to ensure security in the initial development of the project, the centralized price aggregation method will cause various problems in the management and performance of the Dapp, and the centralized entity that manages the data also risks being bought and tampered with the data.

Mainstream assets such as ZRX and REP have launched a decentralized price reference oracle network. Independent nodes that have passed the security assessment upload price data and finally aggregate them into price reference data. The data is updated regularly to reflect price changes. You can view our real-time ETH / USD and BTC / USD reference contracts on the Ethereum mainnet. The price reference contract provides price data for all Dapp's smart contracts. Therefore, Dapps do not need to control and maintain price data, but instead decentralize control to a network of oracles that are increasingly decentralized.

(Currently the ETH / USD reference price predictor network and all 21 nodes)

We are working hard to develop a binding agreement (i.e. service agreement) in the Chainlink network where users can agree on the services (i.e. data and time period) they need, the amount of collateral they expect, and their requirements for the nodes (minimum reputation threshold and Infrastructure), this feature is not yet available on the main network. The reputation system extracts historical service level data from these service agreements.

All nodes in the network are listed on platforms such as Chainlink Market , and users can evaluate and filter nodes that meet their requirements based on the above dimensions. In addition, nodes can also make a single call to the data API on the Honeycomb API Marketplace without having to subscribe to all APIs of each data source.

In addition, we also develop data aggregation plug-ins in service agreements. Users can use multiple oracles to obtain data to achieve computational redundancy; use multiple data sources to ensure accurate data; and customize data aggregation methods (such as averaging). Number, remove outliers, set weights, etc.). These functions allow users to arbitrarily set the level of decentralization and data aggregation, and connect smart contracts to reliable and accurate data sources.

Another feature under development is Town Crier -a trusted execution environment (TEE) with oracles installed. TEE can authenticate TLS certificates and verify that the data came from a website and has not been tampered with during transmission. Assuming users trust the underlying hardware, then Town Crier can ensure that user data is authentic and reliable.

Reduce data and computing costs

Another major issue in developing DeFi tools is the on-chain gas cost. If the application needs constant access to price data, or needs to connect multiple oracles and data sources, it may lead to excessive gas costs and loss of practical value. Decentralization is critical to data security, but this model is difficult to maintain due to the high cost. Currently the data is aggregated on the chain, so each oracle (ie node) needs to pay a gas fee to transmit external data to the chain. If you use 10 nodes to collect external data, you need to pay 10 gas fees for each data update.

We are currently implementing the threshold signature technology in the Chainlink protocol, which is an innovative technology that can greatly improve the decentralization level of the oracle. Threshold signature technology is an innovative aggregation protocol. The oracle can communicate off-chain, verify data points, and reach consensus. The oracle uses threshold signature technology to aggregate data off-chain. It only needs to send the final result to the chain once and pay a gas fee. The security level is not discounted, and it can be verified on the chain.

Chainlink researcher Alex Coventry said: "Our current state-of-the-art threshold signature technology requires 15,000 gas confirmations. That is to say, the original data transmission cost of $ 3,000 can now be reduced to about $ 2, and the cost has decreased by 1500 times. If verified With a quorum of 2,000 nodes, at the current gas / ETH exchange rate, the cost of the traditional model is about $ 17, while the cost of using threshold signature technology is only a little more than 1 cent.

We are working to reduce computing costs. One of the solutions is to let Chainlink oracles run in a trusted execution environment (Note: The trusted execution environment is based on trusted hardware such as Intel SGX). The combination of a trusted execution environment and a oracle can create a closed environment similar to a black box, where nodes can extend the oracle service range to off-chain computing and transaction privacy protection. Even the oracle itself cannot see the input and output data. At the same time, trusted hardware can prove to the blockchain that the operating process is complete and has not been tampered with. The trusted execution environment has great potential to improve the scalability of smart contracts and reduce computing costs.

(Basic architecture diagram of Dapp and trusted execution environment)

privacy protection

In addition to connectivity and low-cost scalability, another major issue is privacy. Sergey Nazarov, co-founder of Chainlink, points out: "Most contracts in the real world must have privacy protection." Except for the higher-cost zero-knowledge proof mechanism, there is basically no privacy protection mechanism on the chain, which also means many Contracts cannot be transformed into more efficient smart contracts. The parties to the contract must hide internal information or trading strategies, and privacy protection is indispensable. In addition, countries have also introduced data privacy protection laws, and privacy protection has become an issue that cannot be ignored.

Chainlink has initially proposed two privacy protection solutions, and developers can choose at will according to their own needs and level of trust. As mentioned above, oracles in a trusted execution environment cannot see the data they collect, so it is also impossible to leak confidential data (note: the premise is that you trust the hardware to be secure). Users can also connect to off-chain computing environments such as the Trusted Computing Framework (TCF) through Chainlink (Note: TCF is a technology of the Hyperledger Avalon project).

Chainlik's latest software solution is Mixicles, which uses oracles to scramble data input and output of smart contracts to protect user privacy. After the oracle receives the data, it will make a true / false judgment on the data off-chain. The judgment result is then transmitted to a "blender", and the specified data output is based on the data input of the oracle. The basic premise of this scheme is that the state change (that is, the judgment result) and the data output are decoupled on the blockchain, and the two cannot be matched. If a higher level of security needs to be achieved, users can access the oracle or DECO in a trusted execution environment, and use Mixicles together to hide the judgment results from the oracle. For more information, read a research paper published by Chainlink or a blog post that explains the concept more easily.

The Mixicles contract disrupts data input and output. There are multiple payment data inputs (first and second rounds) and multiple new addresses. The third round of payment data output is distributed to multiple addresses.

Bringing new customers and new products to the DeFi ecosystem

There is no doubt that DeFi is the fastest growing and most demanding market in the smart contract field. Although we are very pleased with the development of this field, we must also acknowledge that DeFi is still not widely used in the off-chain world. DeFi products have huge potential and markets that can be integrated into off-chain traditional infrastructures and reshape existing financial systems. But the premise of all this is that we have to develop new features for smart contracts.

Chainlink is continuously developing practical solutions to solve the core problems of smart contracts in terms of connectivity, trusted data, low-cost scalability, and transaction privacy protection, which hinder the further development of DeFi. If the above solution can be successfully implemented, then developers can develop the next generation of smart contracts, which can run smoothly in various systems. After all, Chainlink is an open source tool that provides users with a customized connection method to connect to other blockchain or off-chain systems so that all on-chain and off-chain ecosystems share a consensus.

source:

  • https://info.binance.com/en/research/marketresearch/defi-1.html
  • https://medium.com/bzxnetwork/how-decentralized-is-defi-a-framework-for-classifying-lending-protocols-a34f02c14f5c
  • https://medium.com/@pugely/the-case-for-ethereum-kyber-network-defi-46a8b9b80284
  • https://thedefiant.substack.com/p/ether-is-the-best-model-for-money