Decentralized finance: a financial market based on blockchain and smart contracts

Decentralized finance (DeFi) refers to an alternative financial infrastructure built on the Ethereum blockchain. DeFi uses smart contracts to create agreements to replicate existing financial services in a more open, interoperable and transparent way. This article focuses on the opportunities and potential risks of the DeFi ecosystem, and proposes a multi-layer framework to analyze implicit architecture and various DeFi building modules, including token standards, decentralized exchanges, decentralized debt markets, and regional Blockchain derivatives and on-chain asset management agreements. The conclusion of this article is that DeFi is still a risky niche market, but it also has interesting characteristics in terms of efficiency, transparency, accessibility, and composability. Therefore, DeFi may help build a stronger and more transparent financial infrastructure.

The Institute of Financial Technology, Renmin University of China compiled the core content of the article.

Source | Federal Reserve Bank of St. Louis Review

Author | Fabian Schar 


Decentralized Finance (DeFi) is a blockchain-based financial infrastructure. It usually refers to an open, permissionless and highly interoperable agreement built on a public smart contract platform (such as the Ethereum blockchain) Stack. It replicates existing financial services in a more open and transparent way, especially not relying on intermediaries and centralized institutions, but based on open protocols and decentralized applications (DApps). The agreement is enforced by code, transactions are executed in a safe and verifiable manner, and legal state changes continue to exist on the public blockchain. Therefore, this architecture can create an immutable and highly interoperable financial system with unprecedented transparency, equal access rights, and almost no need for custodians, central clearing houses, or custodial services, because most of these roles All can be borne by “smart contracts”.

DeFi already provides a variety of applications. For example, you can buy USD-linked assets (so-called stablecoins) on a decentralized exchange, transfer these assets to the same decentralized lending platform to earn interest, and then add interest-bearing tools to the decentralized flow Investment funds in the sex pool or on the chain.

The backbone of all DeFi protocols and applications are smart contracts. Chi can contract usually refers to small applications on a large number of block chains by parallel execution verifier storage. In the context of a public blockchain, the network is designed so that every participant can participate and verify the correct execution of any operation. Therefore, compared with traditional centralized computing, the efficiency of smart contracts is somewhat low. However, their advantage lies in a high degree of security: smart contracts will always be executed according to regulations and allow anyone to independently verify the resulting state changes. When implemented safely, smart contracts are highly transparent and minimize the risk of manipulation and arbitrary intervention.

To understand the novelty of smart contracts, you must first look at regular server-based web applications. When users interact with such applications, they cannot observe the internal logic of the application, nor can they control the execution environment, both of which can be manipulated. Therefore, users must trust the application service provider. Smart contracts can alleviate these two problems and ensure that the application runs as expected. The contract code is stored on the underlying blockchain, so it can be publicly reviewed. The behavior of the contract is deterministic, and function calls (in the form of transactions) are processed in parallel by thousands of network participants to ensure the legitimacy of execution. When execution leads to state changes, such as changes in account balances, these changes are subject to the consensus rules of the blockchain network, and will be reflected in and protected by the state tree of the blockchain.

Smart contracts can access a rich set of instructions, so they are very flexible. They can also store encrypted assets, thereby assuming the role of custodian, using fully customizable standards to determine how, when, and who these assets are released. This enables a variety of novel applications and a thriving ecosystem to be produced.

DeFi is still a relatively small niche market, but these numbers are growing rapidly. The value of funds locked in DeFi-related smart contracts recently exceeded US$10 billion. It must be understood that these are not transaction volume or market value figures, but rather reserves locked in smart contracts for multiple purposes. Figure 1 shows the value of Ether (ETH, the native encrypted asset of Ethereum) and USD value of the assets locked in the DeFi application.

Decentralized finance: a financial market based on blockchain and smart contracts

The amazing growth of these assets and some truly innovative agreements indicate that DeFi may become relevant in a wider context, and has attracted the interest of policymakers, researchers, and financial institutions. This article serves as an investigation and introduction to the subject, identifying opportunities and risks, and should be regarded as the basis for further research.

DeFi building blocks

DeFi uses a multi-layered architecture, and each level has a different purpose. These layers build on each other and create an open and highly composable infrastructure that allows everyone to build, rehash, or use other parts of the stack. These levels are hierarchical, and they are only as safe as the levels below themselves. For example, if the blockchain in the settlement layer is compromised, all subsequent layers will be insecure. Similarly, if we use a permissioned ledger as the basis, any decentralization efforts made on subsequent layers will be invalid.

This section presents a conceptual framework for analyzing these layers and studying the token and protocol layers in more detail. The framework distinguishes five layers, as shown in Figure 2: settlement layer, asset layer, protocol layer, application layer, and aggregation layer.

Decentralized finance: a financial market based on blockchain and smart contracts

1. The settlement layer (layer 1) consists of the blockchain and its native protocol assets (for example, Bitcoin [BTC] on the Bitcoin blockchain and ETH on the Ethereum blockchain). It allows the network to securely store ownership information and ensure that any state changes comply with its rule set. Blockchain can be seen as the basis for trustless execution and as a settlement and dispute resolution layer.

2. The asset layer (layer 2) includes all assets issued above the settlement layer. This includes native protocol assets and any other assets issued on this blockchain (often called tokens).

3. The protocol layer (layer 3) provides standards for specific use cases, such as decentralized exchanges, debt markets, derivatives, and on-chain asset management. These standards are usually implemented in the form of a set of smart contracts, which can be accessed by any user (or DeFi application). Therefore, these protocols are highly interoperable.

4. The application layer (layer 4) creates user-oriented applications that connect to various protocols. Smart contract interactions are usually extracted by a web browser-based front end, making the protocol easier to use.

5. The aggregation layer (Layer 5) is an extension of the application layer. The aggregator creates a user-centric platform that connects to multiple applications and protocols. They usually provide tools to compare and evaluate services, allow users to perform other complex tasks by connecting to multiple protocols at the same time, and combine related information in a clear and concise way.

Knowing the conceptual model, let’s take a closer look at the tokenization and protocol layers. After a brief introduction to asset tokenization, we will study decentralized transaction protocols, decentralized lending platforms, decentralized derivatives, and on-chain asset management. This allows us to establish the foundation needed to analyze the potential and risks of DeFi.

Asset tokenization

The public blockchain is a database that allows participants to establish a shared and immutable ownership record-a ledger. Generally, the ledger is used to track the native protocol assets of the corresponding blockchain. However, as public blockchain technology becomes more and more popular, the idea of ​​providing additional assets on these ledgers also becomes more and more popular. The process of adding new assets to the blockchain is called tokenization, and the blockchain representation of assets is called tokens.

The general idea of ​​tokenization is to make assets more accessible and transactions more efficient. Especially tokenized assets can be easily transferred from anyone in the world within a few seconds. They can be used in many decentralized applications and are stored in smart contracts. Therefore, these tokens are an important part of the DeFi ecosystem.

From a technical point of view, public blockchain tokens can be created in a variety of ways. However, most of these options can be ignored because the vast majority of tokens are issued on the Ethereum blockchain through a smart contract template called the ERC-20 token standard. These tokens are interoperable and can be used in almost all DeFi applications. As of January 2021, more than 350,000 ERC-20 token contracts have been deployed on Ethereum. Almost 90% of the listed tokens are issued on the Ethereum blockchain.

From an economic point of view, I am more interested in the nature of assets, rather than the basic technical standards used to implement digital representation of assets. The main motivation for adding additional assets on the chain is to add stablecoins. Although the aforementioned protocol assets (BTC or ETH) can be used, many financial contracts require low-volatility assets. Tokenization can create these assets.

However, one of the main problems with tokenized assets is issuer risk. Local digital tokens, such as BTC and ETH, have no problems in this regard. In contrast, when someone introduces a token with a promise, such as paying interest, dividends or delivering goods or services, the value of the corresponding token will depend on the credibility of the statement. If the issuer is unwilling or unable to deliver, the tokens may become worthless or traded at a steep discount. This logic also applies to stablecoins.

Generally speaking, tokens based on commitments have three support models: off-chain mortgage, on-chain mortgage, and unsecured. Off-chain collateral refers to the storage of basic assets through custody services, such as commercial banks. On-chain mortgage means that assets are locked on the blockchain, usually in smart contracts. When there is no collateral, the transaction party has the highest risk. In this case, the commitment is based solely on trust.

On-chain collateral has several advantages. It is highly transparent and can protect claims through smart contracts, allowing the process to be executed in a semi-automatic manner. One disadvantage of on-chain collateral is that this collateral is usually kept in the local agreement asset (or its derivatives) and therefore will experience price fluctuations. Take the Dai stablecoin as an example. It mainly uses ETH as its on-chain collateral to create a decentralized and trustless Dai token pegged to $1. Since there is no native token pegged to the U.S. dollar on Ethereum, the Dai token must be backed by another asset. Whenever someone wants to issue a new Dai token, they first need to lock enough ETH as the underlying collateral in the smart contract provided by the manufacturer’s agreement. Since the exchange rate of USD to ETH is not fixed, overcollateralization is required. If at any time the value of the underlying ETH collateral falls below the minimum threshold of 150% of the outstanding Dai value, the smart contract will auction the collateral to offset Dai’s debt.

There are also several examples of off-chain mortgage stablecoins. The most popular ones are USDT and USDC, both of which are stable currencies backed by the U.S. dollar. They can all be used as ERC-20 tokens on the Ethereum blockchain. DGX is an ERC-20-based stablecoin backed by gold, while WBTC is a tokenized version of Bitcoin, allowing Bitcoin to be used on the Ethereum blockchain. Off-chain collateralized tokens can reduce exchange rate risk because the collateral may be equivalent to a tokenized claim (for example, a US dollar claim is backed by real US dollars). However, off-chain mortgage tokens will introduce risks and external dependencies to the counterparty. Tokens using off-chain collateral require regular audits and preventive measures to ensure that the underlying collateral is always available. This process is costly, and in many cases, it is not completely transparent to token holders.

Several organizations are studying unsecured stablecoins, that is, stablecoins that do not use any form of collateral to maintain pegged stablecoins. Rebasing tokens such as Ampleforth or YAM are not eligible for stablecoins. They only provide a stable unit of account, but still expose holders to volatility in the form of a dynamic number of tokens.

Although stablecoins play a vital role in the DeFi ecosystem, it is unfair to limit the theme of tokenization to these assets. There are tokens for a variety of different purposes, including governance tokens for decentralized autonomous organizations (DAOs), tokens that allow holders to perform specific operations in smart contracts, tokens similar to stocks or bonds, and even It is a synthetic token that can track the price of any real-world asset.

Another different category is the so-called non-fungible tokens (NFT). NFT is a token representing a unique asset, that is, collectibles. They can be digital representations of physical objects (such as artworks) that subject them to the usual risks of counterparties, or they can be digitally native units of value with unique characteristics. In any case, the non-fungible nature of tokens ensures that the ownership of each asset can be tracked separately and the assets can be accurately identified. NFT is usually built on the ERC-721 token standard.

Decentralized transaction protocol

As of September 2020, there are more than 7,092 types of crypto assets listed on the exchange. Although most of them are economically irrelevant, and the market capitalization and trading volume are negligible, there is still a need for a market to enable people to trade some popular crypto assets. This will allow owners of such assets to rebalance their risk exposures and adjust portfolio allocations based on their preferences and risk profile.

In most cases, crypto asset trading is conducted through centralized exchanges. Centralized exchanges are relatively efficient, but there is a serious problem: in order to be able to trade on centralized exchanges, traders must first deposit assets in the exchange. As a result, they lost direct access to their assets and had to trust the exchange operator. Dishonest or unprofessional exchange operators may confiscate or lose assets. In addition, the centralized exchange has become a single point that can be attacked and faces constant threats from malicious third parties. Relatively low regulatory review has exacerbated these two problems and forced many such exchanges to make huge scale-up efforts in a short period of time. Therefore, it is not surprising that some centralized crypto-asset exchanges have lost customer funds.

Decentralized exchange protocols try to alleviate these problems by eliminating trust requirements. Users no longer need to deposit funds in a centralized exchange, and they always have exclusive control over their assets until the transaction is executed. Transaction execution occurs atomically through smart contracts, which means that both parties to the transaction execute in an indivisible transaction, thereby reducing the credit risk of the counterparty. Depending on the specific implementation, smart contracts may take on additional roles, effectively eliminating many intermediaries, such as custodial services and the Central Counterparty Clearing House (CCP).

Early decentralized exchanges, such as EtherDelta, have been set up as walled gardens, and there is no interaction between various executions. Exchanges do not have shared liquidity, resulting in relatively low trading volume and large bid-ask spreads. The high network fees and the tedious and slow process of transferring funds between these decentralized exchanges make so-called arbitrage opportunities useless.

Recently, there has been a trend towards open exchange protocols. These projects attempt to simplify the architecture of decentralized exchanges by providing standards on how to conduct asset transactions and allowing any exchange built on the protocol to use shared liquidity pools and other protocol features. Most importantly, however, other DeFi protocols can use these markets and exchange or liquidate tokens when needed.

The following section compares the various types of decentralized exchange protocols:

  • Decentralized order book exchange

Decentralized order book exchange can be implemented in a variety of ways. They both use smart contracts for transaction settlement, but there are significant differences in their order book custody methods. One must distinguish between on-chain and off-chain order books.

The on-chain order book has the advantage of being completely decentralized. Each order is stored in a smart contract. Therefore, no additional infrastructure or third-party hosts are required. The disadvantage of this method is that each action requires a blockchain transaction. Therefore, this is an expensive and slow process, and even the statement of transaction intent can cause network fees. Considering that a volatile market will require frequent order cancellations, this disadvantage becomes more expensive.

For this reason, many decentralized transaction protocols rely on off-chain order books and only use the blockchain as the settlement layer. The off-chain order book is hosted and updated by a centralized third party, usually called a relayer. They provide the recipient with the information they need to select the order they want to match. Although this method does introduce some centralized parts and dependencies to the system, the role of relayers is limited. Relayers never control funds, neither match nor execute orders. They just provide a sequence table with a quote, and may charge a fee for the service. The openness of the protocol ensures competition among relayers and reduces potential dependence.

The main agreement using this method is called 0x, which uses a three-step process for transactions: First, the manufacturer sends a pre-signed order to the relayer to include the order in the order book; secondly, the potential recipient sends The relayer queries the order book and selects one of the orders; third, the recipient signs the order and submits it to the smart contract, triggering the atomic exchange of encrypted assets.

  • Constant function market maker

Constant Function Market Maker (CFMM) is a smart contract liquidity pool that holds (at least) two encrypted assets as reserves, and allows anyone to deposit one type of token to withdraw another type of token currency. In order to determine the exchange rate, the smart contract-based liquidity pool uses a variant of the constant product model, where the relative price is a function of the reserve ratio of smart contract tokens. The liquidity pool using this model will not be exhausted, because tokens will become more expensive as reserves decrease. When the token supply of either of the two tokens is close to zero, its relative price will rise indefinitely.

It should be pointed out that the liquidity pool based on smart contracts does not rely on external price information (so-called oracles). Whenever the market price of an asset changes, anyone can use arbitrage opportunities and smart contracts to trade tokens until the liquidity pool price converges to the current market price. The implicit bid-ask spread of the constant product model (plus a small amount of transaction fees) may lead to the accumulation of additional funds. Anyone who provides liquidity to the pool will receive pool share tokens, enabling them to participate in this accumulation, and redeem these tokens in exchange for their share in the potentially growing liquidity pool. Prominent examples of smart contract-based liquidity pool agreements are UniSwap, Balancer, Curve and Bancor.

  • Reserve aggregation based on smart contracts

Another method is to integrate liquidity reserves through smart contracts, allowing large liquidity providers to connect and advertise the prices of specific trading pairs. Users who want to exchange token x for token y can send a transaction request to the smart contract. The smart contract will compare the prices of all liquidity providers, accept the best offer on behalf of the user, and execute the transaction. It acts as a gateway between users and liquidity providers, ensuring best execution and atomic settlement.

Compared with the smart contract-based liquidity pool, the smart contract-based reserve aggregation, the price is not determined in the smart contract. Instead, prices are set by liquidity providers. This method is effective if the liquidity provider’s foundation is relatively broad. However, if there is limited or no competition in a given trading pair, this method may lead to collusion risks and even monopoly price setting. As a countermeasure, the reserve aggregation protocol usually has some (centralized) control mechanisms, such as the highest price or the least number of liquidity providers. In some cases, liquidity providers may only participate after background checks, including KYC (Know Your Customer) verification.

The most famous application of this concept is the Kyber network, which serves as the backbone protocol for various DeFi applications.

  • Point-to-point protocol

An alternative to the classic exchange or liquidity pool model is the peer-to-peer (P2P) protocol, also known as the over-the-counter (OTC) protocol. They mainly rely on a two-step method. Participants can query the parties who want to trade a specific crypto asset pair on the network, and then negotiate the exchange rate bilaterally. Once the two parties agree on the price, the transaction will be executed on the chain through smart contracts. Compared with other agreements, the offer can only be accepted by the parties involved in the negotiation. In particular, it is impossible for a third party to accept an offer before someone by observing an unconfirmed transaction pool (mempool).

In order to improve efficiency, the process is usually automated. In addition, off-chain indexers can be used for peer discovery. These indexers play the role of a catalog in which people can promote their intentions for specific transactions. Please note that these indexers are only used to establish a connection, and prices are still negotiated point-to-point. AirSwap is the most popular decentralized point-to-point protocol application.

Decentralized lending platform

Loans are an important part of the DeFi ecosystem, and there are multiple protocols that allow people to lend and borrow crypto assets. The uniqueness of decentralized lending platforms is that they require neither borrowers nor lenders to identify themselves. Everyone can access the platform, and it is possible to borrow money or provide liquidity to earn interest. Therefore, DeFi loans are completely license-free and do not rely on trust relationships.

In order to protect the lender and prevent the borrower from running away, there are two completely different approaches: one is to provide credit when the loan must be repaid atomically, that is, the borrower receives the funds, uses and repays them, all in the same block Chain transaction. Assuming that the borrower does not return the funds (plus interest) at the end of the transaction execution cycle, the transaction will be invalid and any results (including the loan itself) will be restored. These so-called flash loans are an exciting but still highly experimental application. Although flash loans can only be used for atomic settlement and fully on-chain applications, they are effective new tools for arbitrage and portfolio restructuring. Therefore, they are expected to become an important part of DeFi loans.

Second, the loan can be fully secured with collateral. The collateral is locked in a smart contract and will only be released after the debt is repaid. There are three variants of mortgage loan platforms: mortgage debt position, collective mortgage debt market and P2P mortgage debt market. A mortgage debt position is a loan using newly created tokens, while the debt market uses existing tokens and requires matching between borrowers and lenders.

  • Mortgage debt position

Some DeFi applications allow users to create collateralized debt positions, thereby issuing new tokens backed by collateral. In order to be able to create these tokens, the person must lock the encrypted assets in a smart contract. The number of tokens that can be created depends on the target price of the generated tokens, the value of the encrypted assets used as collateral, and the target mortgage rate. The newly created token is essentially a fully collateralized loan, does not require a transaction partner, and allows users to obtain liquid assets while maintaining market exposure through collateral. Loans can be used for consumption, enabling the person to overcome a temporary liquidity crunch or obtain additional crypto assets for leverage exposure.

Take MakerDAO as an example. This is a decentralized protocol for issuing Dai stablecoins pegged to the U.S. dollar. First, users deposit ETH into a smart contract that is classified as a collateralized debt position (CDP) (or treasury). Subsequently, they call a contract function to create and withdraw a certain amount of Dai, thereby locking the collateral. This process currently requires a minimum mortgage rate of 150%, which means that for any $100 of ETH locked in the contract, users can create up to 66.66 Dai. Any outstanding Dai needs to pay a stability fee, which in theory should correspond to the highest interest rate in the Dai bond market. The fee rate is set by the community, that is, holders of MKR tokens, and MKR is the governance token of the MakerDAO project. To close the mortgage debt position, the owner must send the outstanding Dai plus the accumulated interest to the contract. Once the debt is repaid, the smart contract will allow the owner to recover their collateral. If the borrower fails to repay the debt, or the value of the collateral is below the 150% threshold, then all the collateral of the loan is at risk, and the smart contract will begin to liquidate the collateral at a potential discount rate.

Part of the interest payment and liquidation fee is used to “destroy” MKR, thereby reducing the total supply of MKR. In exchange, MKR holders bear the remaining risk of an extremely negative ETH price shock, which may result in insufficient collateral to maintain a peg to the U.S. dollar. In this case, a new maker will be created and sold at a discounted price. Therefore, maintaining a healthy system is in the best interest of MKR holders.

Although the MakerDAO system is mainly decentralized, it relies on price oracles, which introduces some dependencies. MakerDAO has recently transformed into a multi-collateral system, with the goal of making the protocol more scalable by allowing various crypto assets to be used as collateral.

  • Mortgage debt market

In addition to creating new tokens, it is also possible to borrow existing crypto assets from others. For obvious reasons, this approach requires counterparties with opposite preferences. In other words: for one person to be able to borrow ETH, another person must be willing to lend ETH. In order to reduce the risk of the counterparty and protect the lender, the loan must be fully collateralized, and the collateral is also locked in the smart contract. The lender and the debit can be matched in a variety of ways, the main categories are point-to-point matching and set matching.

Peer-to-peer matching means that those who provide liquidity lend crypto assets to specific borrowers. Therefore, the lender will start earning interest only after matching. The advantage of this method is that all parties agree on a period of time and operate at a fixed interest rate.

Collective loans use variable interest rates that are affected by supply and demand. All borrowers’ funds are concentrated in a smart contract-based loan pool, and the lender begins to earn interest when depositing the funds in the pool. However, interest rates are a function of pool utilization: when liquidity is easily available, loans will be cheap; when demand is high, loans will become more expensive. An additional advantage of loan pools is that they can perform maturity and scale conversion while maintaining relatively high liquidity for individual lenders.

Decentralized derivatives

Decentralized derivatives are tokens that obtain value from the performance of the underlying asset, the outcome of an event, or the development of any other observable variable. They usually need an oracle to track these variables, so they introduce some centralized components and lead to dependence. When derivative contracts use multiple independent data sources, reliance can be reduced.

Decentralized derivatives are divided into asset-based and event-based derivative tokens. When its price is a function of the performance of the underlying asset, we call it an asset-based derivative token. When its price is a function of any observable variable that is not an asset’s performance, we call it an event-based derivative token.

  • Asset-based derivative tokens

Asset-based derivative tokens are an extension of the mortgage debt position model. The locked collateral can be used to issue synthetic tokens that follow changes in various asset prices, rather than being restricted to the issuance of stablecoins linked to the U.S. dollar. Examples include tokenized versions of stocks, precious metals, and alternative crypto assets. The higher the underlying volatility, the greater the risk of falling below a given mortgage rate.

Synthetix is ​​a popular derivative token platform, and its application makes the total debt pool of all participants increase or decrease according to the total price of all outstanding synthetic assets. This ensures that tokens with the same underlying asset remain interchangeable, that is, redemption does not depend on the issuer. This design also makes users bear additional risks when casting assets, because their debt status will also be affected by the asset allocation of others.

There is a special example of asset-based derivative tokens, reverse tokens. In this case, the price is determined by the inverse function of the underlying asset’s performance within a given price range. These reverse tokens give users short exposure to crypto assets.

  • Event-based derivative tokens

Event-based derivative tokens can be based on any objectively observable variable that has a set of known potential results, designated observation time, and analytical source. Anyone can purchase a full set of child tokens for a given event by locking 1 ETH in the smart contract. A complete set of sub-tokens contains 1 sub-token corresponding to each potential result. These sub-tokens can be traded separately. When the market settles, the encrypted assets of the smart contract will be distributed among the sub-token owners who win the result. Therefore, in the absence of market distortions, the ETH price of each child token should correspond to the probability of the underlying outcome.

In some cases, these prediction markets may act as decentralized predictors of the possibility of future outcomes. However, market analysis (and price) largely depends on the credibility of the source of the analysis. Therefore, event-based derivative tokens introduce external dependencies and may be unilaterally affected by malicious reporters. Potential attack vectors include flawed or misleading problem specifications, incomplete result sets that may cause the incident to be unresolved, and unreliable or fraudulent source selection.

Augur is the most popular application, which uses multi-stage resolution and an argument process that minimizes reliance on a single reporting source. If the token holders disagree with the designated reporter, they will start arguing and eventually come to the correct result.

On-chain asset management

Like traditional investment funds, on-chain funds are mainly used for portfolio diversification. They allow users to invest in a basket of encrypted assets and adopt various strategies without having to deal with tokens separately. Compared with traditional funds, the on-chain variant does not require a custodian. Instead, encrypted assets are locked in smart contracts. Investors will never lose control of their funds, can withdraw or liquidate them, and can observe the token balance of the smart contract at any time.

The smart contract is set up to follow a variety of simple strategies, including semi-automatic rebalancing of portfolio weights and trend trading, all using moving averages. Or, you can choose one or more fund managers to actively manage the fund. In this case, smart contracts can ensure that asset managers comply with predetermined strategies and act in the best interests of investors. In particular, the asset manager can only take actions that comply with the fund’s rule set and the risk profile specified in the smart contract. Smart contracts can be executed on the chain to alleviate multiple forms of principal-agent problems and incorporate regulatory requirements. Therefore, asset management on the chain may reduce fund setup and audit costs.

Whenever someone invests in a fund on the chain, the corresponding smart contract will issue fund tokens and transfer them to the investor’s account. These tokens represent partial ownership of the fund and allow token holders to redeem or liquidate their share of assets. For example, if an investor owns 1% of fund tokens, this person will be entitled to 1% of locked crypto assets. When the investor decides to end the investment, the fund token is burned, the underlying asset is sold on the decentralized exchange, and the investor will receive an ETH compensation equivalent to their basket share.

There are many ways to apply the on-chain fund protocol, all of which are limited to ERC-20 tokens and Ethereum. In addition, they rely heavily on price oracles and third-party agreements, mainly for borrowing, trading, and incorporating low-volatility reference assets, such as Dai or USDC stablecoins.

Both Enzyme Finance and Set Protocol allow anyone to create new investment funds. Enzyme Finance focuses on building infrastructure for decentralized funds, using smart contract-based rule sets to ensure that fund managers adhere to the fund’s strategy. These smart contracts enforce transaction restriction parameters, such as maximum concentration, price tolerance, and maximum number of positions, as well as whitelists and blacklists of users and assets. The same is true for the fund’s fee schedule.

 Set Protocol is primarily designed for semi-automatic strategies, with deterministic portfolio rebalancing triggered by predefined thresholds and time locks. However, this protocol is also used for active management. Betoken operates as a single fund, managed by a community of asset managers through an elite system. The more successful individual fund managers are, the greater their future influence on the allocation of collective resources. UniSwap’s liquidity pool also has some characteristics of chain investment funds. The constant product model creates incentives for the semi-automatic rebalancing of portfolio weights, while transaction fees provide investors with passive income.

Yearn Vaults are collective investment pools designed to maximize the return on a given asset. Strategies are diverse, but usually involve multiple steps and active management. In many cases, these actions are too expensive (in terms of transaction fees) for smaller amounts. In addition, they require investors to remain vigilant and well-informed. Yearn Vaults alleviate these problems by leveraging collective wisdom and using collective action to distribute network expenses proportionally among all participants. However, the deep integration of the protocol also introduces serious dependencies.

Opportunities and risks


DeFi may improve the efficiency, transparency, and accessibility of financial infrastructure. In addition, the composability of the system allows anyone to combine multiple applications and protocols to create new services.

  • efficient

Although most traditional financial systems are based on trust and rely on centralized institutions, DeFi replaces some of these trust requirements with smart contracts. The contract can assume the roles of custodian, escrow agent and CCP. For example, if two parties want to exchange digital assets in the form of tokens, CCP guarantees are not required. Instead, these two transactions can be automatically settled, which means that both transfers will be executed or neither will be executed. This significantly reduces the credit risk of the counterparty and makes financial transactions more efficient. Lower trust requirements may bring additional benefits, namely reducing regulatory pressure and reducing the need for third-party audits. Almost every area of ​​financial infrastructure can achieve similar efficiency gains. In addition, token transfers are much faster than any transfers in traditional financial systems. Transmission speed and transaction throughput can be further improved by layer 2 solutions, such as side chains or state and payment channel networks.

  • transparency

DeFi applications are transparent. All transactions are publicly observable, and the smart contract code can be analyzed on the chain. Observability and deterministic execution have allowed unprecedented transparency, at least in theory. Financial data is publicly available and may be used by researchers and users. In the event of a crisis, the availability of historical (and current) data is a huge improvement over the traditional financial system. Most of the information in the traditional financial system is scattered in a large number of proprietary databases or is not available at all. Therefore, the transparency of DeFi applications can mitigate adverse events before they occur and help to understand their origins and potential consequences when they occur more quickly.

  • Accessibility

By default, anyone can use the DeFi protocol. Therefore, DeFi may create a truly open and accessible financial system. In particular, the infrastructure requirements are relatively low, and there is almost no risk of discrimination due to lack of identity. If regulatory requirements restrict access, for example, for security tokens, such restrictions can be implemented in the token contract without affecting the integrity and decentralization properties of the settlement layer.

  • Composability

The DeFi protocol is often compared to Lego bricks. The shared settlement layer allows these protocols and applications to be interconnected. On-chain fund agreements can use decentralized transaction agreements or loan agreements to achieve leveraged positions. Any two or more parts can be integrated, forked, or re-hashed to create something completely new. Anything created before can be used by individuals or other smart contracts. This flexibility has aroused unprecedented interest in open financial engineering and has expanded the scope of possibilities.


DeFi also has certain risks, that is, smart contract execution risks, operational security, and reliance on other protocols and external data.

  • Smart contract execution

Although the certainty and decentralized execution of smart contracts do have their advantages, there is a risk of error. If there are coding errors, these errors may create loopholes that allow attackers to drain the funds of the smart contract, cause confusion, or make the protocol unusable. Users must be aware that the security of the protocol depends on the smart contract behind it. Unfortunately, ordinary users will not be able to read the contract code, let alone evaluate its security. Although auditing, insurance services, and formal verification are part of the solution to this problem, there is still a certain degree of uncertainty.

Similar risks exist in contract execution. Most users do not understand the payload of the data they are required to sign as part of the transaction, and can be misled by a compromised front end. Unfortunately, there seems to be an inherent trade-off between usability and security. For example, some decentralized blockchain applications will request permission to transfer an unlimited number of tokens on behalf of the user. This is usually to make future transactions more convenient and efficient. However, this permission puts the user’s funds at risk.

  • Operational safety

Many DeFi protocols and applications use management keys. These keys allow a predefined group of people (usually the core team of the project) to upgrade the contract and perform an emergency shutdown. Although it is understandable that some projects want to implement these precautions and maintain a certain degree of flexibility, the existence of these keys may be a potential problem. If the key holders do not securely create or store their keys, malicious third parties can obtain these keys and destroy the smart contract. Or, the core team members themselves may be malicious or lured by significant monetary incentives.

Most projects try to reduce this risk through multiple signatures and time locks. Multisig requires an M-of-N key to perform any smart contract management function, and the time lock specifies the earliest time at which the transaction can be (successfully) confirmed.

As an alternative, some projects rely on voting schemes in which corresponding governance tokens grant their owners the right to vote on the future of the agreement. However, in many cases, most governance tokens are held by a small group of people and lead to similar results as managing keys. Some projects try to alleviate this concentration of voting rights by rewarding early adopters and users who meet certain criteria, ranging from simple protocol use to active participation in the voting process and third-party token collateral (liquidity mining). Nevertheless, even if the issuance is considered relatively “fair”, the actual distribution is often still highly concentrated.

Governance of tokens may lead to undesirable consequences. When these rights are tokenized, highly centralized power may be even more problematic. In the absence of a vesting period, malicious founders can dump all their tokens on CFMM, thereby causing a large-scale supply shock and undermining the credibility of the project. In addition, by allowing well-established protocols to assume a large portion of the governance tokens of relatively new protocols, liquidity mining may lead to the spread of centralization. This may create a large meta-protocol, whose token holders basically control a significant portion of the DeFi infrastructure.

  • Dependence

The most promising feature of the DeFi ecosystem is its openness and composability. These functions allow various smart contracts and decentralized blockchain applications to interact with each other and provide new services based on a combination of existing services. However, these interactions also introduce severe dependencies. If there is a problem with a smart contract, it may have a wide-ranging impact on multiple applications in the entire DeFi ecosystem. In addition, problems with the Dai stablecoin or severe ETH price shocks may cause a chain reaction in the entire DeFi ecosystem.

For example, suppose a person locks ETH as collateral in the MakerDAO contract to issue Dai stablecoins, and Dai stablecoins are locked in a composite lending smart contract to issue interest-bearing derivative tokens called cDai. The cDai tokens are then transferred to the UniSwap ETH/cDai liquidity pool together with some ETH, allowing the person to withdraw UNI-cDai tokens representing a share of the liquidity pool. Every time a smart contract is added, the risk of potential errors increases. If any contract in the sequence fails, UNI-cDai tokens may become worthless. These “tokens on tokens on top of tokens” situation creates packaging tokens and can entangle projects in ways that theoretical transparency does not correspond to actual transparency.

  • External data

Another point worth mentioning is that many smart contracts rely on external data. Whenever a smart contract relies on data that is not available locally on the chain, the data must be provided by an external data source. These so-called oracles introduce dependencies and, in some cases, may lead to highly concentrated contract execution. In order to reduce this risk, many projects rely on a decentralized oracle network with multiple data provision schemes.

  • Illegal activity

The general concern among regulators is that individuals who wish to avoid recording and monitoring may use encrypted assets. Although the inherent transparency of DeFi is a deterrent to this use case, the pseudonym of the network may provide some privacy. However, this is not necessarily a bad thing, and the situation is more complicated than it seems at first glance. On the one hand, people with dishonest intentions may abuse pseudonyms. On the other hand, privacy may be an ideal attribute for certain legitimate financial applications. Accordingly, regulators should act cautiously and strive to find reasonable solutions that enable them to intervene when necessary without stifling innovation. In addition, people must be aware that it may not be feasible to regulate decentralized networks.

Although it is still doubtful whether regulators can (or should) monitor decentralized infrastructure, there are two areas that deserve special attention, namely, legal entrance and exit, and the authenticity of decentralization.

The legal entrance and exit ramps are the interface of the traditional financial system. Whenever people want to transfer assets from a bank account to a blockchain-based system or otherwise, they must go through a financial service provider. These financial service providers are regulated and may require background checks on the source of funds.

Similarly, it is also important to distinguish between legitimate decentralized agreements and projects that only claim to be decentralized but are in fact controlled exclusively by an organization or a small number of individuals. The former may provide exciting new possibilities and eliminate some dependencies, while the latter may essentially introduce the worst of the two worlds, namely the de facto reliance on centralized operators with limited supervision. Keeping this in mind, regulators should pay close attention and carefully analyze whether a given DeFi protocol is indeed decentralized, or whether the DeFi label is just to evade supervision.

  • Scalability

Blockchain faces the ultimate trade-off between decentralization, security, and scalability. Although the Ethereum blockchain is generally considered to be relatively decentralized and secure, it is difficult to keep up with the huge demand for block space. Rising natural gas prices (transaction fees) and long confirmation times have an adverse impact on the DeFi ecosystem and benefit the wealthy who can make large transactions.

Potential solutions to this problem include base layer sharding, as well as various layer 2 solutions, such as state channels, ZK (zero-knowledge) aggregation, and optimistic aggregation. However, in many cases, scalability efforts have weakened composability and general transaction atomicity-the two most prominent features of DeFi. On the other hand, moving DeFi to a more centralized base layer does not seem to be a reasonable approach, because it would essentially undermine its main value proposition. Therefore, it remains to be seen whether a truly decentralized blockchain can meet the demand and lay the foundation for an open, transparent and unchanging financial infrastructure.

in conclusion

DeFi provides exciting opportunities and the possibility to create a truly open, transparent and unchanging financial infrastructure. Since DeFi is composed of many highly interoperable protocols and applications, everyone can verify all transactions, and users and researchers can use the data for analysis at any time.

DeFi has set off a wave of innovation. On the one hand, developers are using smart contracts and a decentralized settlement layer to create trustless versions of traditional financial instruments. On the other hand, they are creating brand new financial instruments that would not be possible without the underlying public blockchain. Atomic swaps, autonomous liquidity pools, decentralized stablecoins, and flash loans are just a few of the many examples that demonstrate the great potential of this ecosystem.

Although this technology has great potential, there are also certain risks. Smart contracts may have security issues that allow accidental use, while scalability issues can limit the number of users. In addition, in some cases, the term “decentralization” can be deceptive. Many protocols and applications use external data sources and special management keys to manage the system, perform smart contract upgrades, and even perform emergency shutdowns. Although this does not necessarily pose a problem, users should be aware that this involves a lot of trust in many cases. However, if these problems can be resolved, DeFi may lead to a paradigm shift in the financial industry and may contribute to a stronger, open and transparent financial infrastructure.

The following are some screenshots of the article

Decentralized finance: a financial market based on blockchain and smart contracts

Decentralized finance: a financial market based on blockchain and smart contracts

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-12-20 10:45
Next 2021-12-20 10:48

Related articles