Compound is an open protocol that makes it easier for you to borrow money in the blockchain world.

Editor’s note: This article comes from WeChat public account “Orange Book” (ID: Decrypt cryptonetwork), author @orangefans, the original title “Barbarians in the Blockchain World: A List of Industry M & A Events”, slightly deleted Less.

Chao Technology | Decentralized Money Market: How does Compound use the blockchain to reconstruct the little thing of

Currency has time value, because money generates interest.

Blockchain has produced a lot of digital assets, but now most of these assets can only be traded directly, and time value cannot be exchanged, so the realization of borrowing becomes very important.

Compound is an open protocol that wants to borrow digital assets. It wants to make it easier for you to borrow money in the blockchain world.

Borrowing money is a very basic need. Some people have extra assets that are useless. Some people may not have assets themselves. These assets often have the value of production or investment. If these two people can borrow each other, it will be good for both parties. In the end it will create a non-zero sum of wealth growth.

But there are two main problems in implementing lending on the blockchain:

  • Existing lending mechanisms are extremely limited, so they can easily lead to mispricing of assets. (For example, many junk coins have a high market value, because there is no channel to short them.)

  • Blockchain assets may have a negative net worth, because there is the cost of on-chain storage and the risk of transactions (whether on-site or off-site). We do not have a very natural interest rate mechanism to offset these costs, which will make assets volatile, because “holding” does not generate “incentives”.

    Centralized exchanges provide some margin trading, but you need to trust the centralized institutions, and there are also great restrictions on the types of assets that can be borrowed, usually only some mainstream currencies. At the same time, this centralized approach cannot make loans on the chain, so for smart contracts, there is no way to access this set of mechanisms.

    There are also problems with other peer-to-peer protocols, including ETHLend, Ripio, Lendroid, dYdX and so on. These protocols provide users with collateralized or non-collateralized loans, but decentralization has led users to bear high costs and a very unfriendly user experience—for example, lenders need to publish, manage, and monitor lending transactions themselves. The process often takes a long time asynchronously (because it takes time to raise borrowing funds).

    Compound wants to provide a different loan agreement to make the experience and process on the entire chain simpler and smoother.

    The following is an introduction to the working principle of Compound. The main reference source is the white paper. If you just want to know that Compound is a loan agreement and do n’t want to learn more, you can directly pull to the bottom of the article to see #Compound Future, which It involves some interesting applications based on the Compound protocol.

    A brief introduction to Compound

    Compound protocol allows developers to build a variety of money markets based on Ethereum.

    The so-called “money market” is actually a pool of coins. Each coin pool contains only the same ERC-20 currency. The agreement determines the interest rate of currency borrowing in this pool through an algorithm. In simple terms, this algorithm will automatically calculate the interest rate based on the supply and demand relationship of people borrowing and borrowing for this currency. For example, in the currency market of Dai, the current annual interest rate for loans is 2.29%, and the annual interest rate for loans is 8.69%. These rates are treated equally by everyone and may be floating at any time.

    There are currently 5 open currency markets on Compound, including the following currencies:

    • Basic Attention Token (BAT)

    • Dai (DAI)

    • Augur (REP)

    • Wrapped Ether (WETH)

    • 0x (ZRX)

      Chao Technology | Decentralized Money Market: How does Compound use the blockchain to reconstruct the little thing of Whether you are borrowing or lending, you are following Compound Deal directly with the agreement. This is not the same as those peer-to-peer lending agreements. In the peer-to-peer solution, the borrower and the lender will match, and then you need to communicate with the person who is looking for you (or the person who borrows your money), and the two parties themselves agree on the borrowing interest rate, maturity time, mortgage items, etc.

      In the Compound agreement, each ERC-20 token has its own lending market, which contains the balance of each user in this market, as well as each effective lending transaction, and even each period. Historical interest rates, etc.

      Compound agreement includes three main contracts:

      • MoneyMarket contract: Responsible for the realization of the main borrowing logic, including a series of operation functions, such as loan (SUPPLY), withdrawal (WITHDRAW), borrowing (BORROW), repayment of loans (REPAY BORROW), clearing ( LIQUIDATE) and so on.

      • InterestRateModel Contract: Provides a calculation model for the lending rate.

      • PriceOracle contract: Used to provide price information for each ERC-20 token. For example, this contract can get the current price of a coin through the top ten exchanges, which is called by other contracts.

        The main contract is MoneyMarket. In the simplest form, a MoneyMarket contract in a currency market is equivalent to an ERC-20 contract. This contract will maintain a table that records the amount of coins held by each user, that is, the balance. The balance will also be Calculate interest over time.

        Compound introduces a low gas fee method to update the user balance in the contract. Whenever a user borrows or lends, the contract will automatically update the corresponding asset entry in the balance table. In addition, Compound will use this table to record the balance to calculate what the current interest rates for borrowing and lending should be.

        Supply Tokens

        For a certain token, Compound will aggregate the same kind of tokens provided by all lenders and lend them to different users in a unified way. The advantage of this is that it can provide better liquidity in a concentrated way, and at the same time, users can also withdraw their lending assets at any time, and do not need to wait until the loan contract expires to recover the money.

        In a currency market, the balance of the user will calculate the accrued interest based on the rate of supply of this token. Users can check their balance (including accrued interest) in real time.When the transaction updates the balance (such as lending, transfer, withdrawal), the accrued interest will be converted into the corresponding token asset and paid to the user.

        Application scenario

        Long-term investors in the Ethereum ecosystem (such as some institutions) can use the Compound agreement to complete additional income from investment and earn some interest. This extra income does not require you to manage your own funds, complete a loan contract, or take speculative risks.

        DApps, machines, or exchanges, if there is an additional token balance, it can also be put on the Compound protocol to add a little revenue and make fuller use of funds. This has the potential to unlock another completely different business model for the Ethereum ecosystem.

        Borrowing Tokens

        Compound lets users seamlessly borrow money from agreements through collateral credit lines. You just need to see which currency you want to borrow. You don’t need to communicate with others about the repayment date and interest rate, you can borrow money immediately. Borrowings are real-time and predictable. Each currency market has a floating interest rate determined by the market.

        Chao Technology | Decentralized Money Market: How does Compound use the blockchain to reconstruct the little thing of

        To lend out the coins you own or find Compound to borrow, you can interact with the platform directly

        The Compound agreement enforces a rule that each account must have a sufficient balance to repay the loan amount, which is called the mortgage rate (currently the value on the platform is 1.5x). Each account cannot do anything that will make the “balance / borrowing amount” lower than the “mortgage rate”, such as borrowing more money or withdrawing the balance of the mortgage. To increase or reset the mortgage rate, users can repay the loan in full or in part. Any balance held by Compound, including the balance used by the user as collateral, will also generate normal accrued interest.

        Risk and liquidation

        If the mortgage asset provided by a user, divided by the amount borrowed by their credit line, is lower than the mortgage rate, then their mortgage asset can be purchased (through loan assets) at the current market price minus the sale price Liquidation discount. This mechanism will motivate arbitrageurs in the system to quickly reduce the shortage of borrowing assets that the borrower cannot yet, thereby reducing the risk of the agreement.

        Any Ethereum account that owns the borrowing assets may participate in this settlement process in whole or in part, using their assets in exchange for the borrower’s mortgage assets. Because these two types of users and these two types of assets, all price information can be seen in the Compound agreement, so the liquidation is frictionless and does not need to rely on any external system or order book.

        Application scenario

        This ability to hold new assets without buying or selling or changing your own investment portfolio will allow dApp users, investors, and developers to have new “superpowers”:

        • No need to wait for the order to complete or perform any off-chain operations, the dApp can borrow money from Ethereum and immediately use the borrowed money on Ethereum. For example, buying computing power on the Golem network.

        • Investors can make new ICO transactions and borrow eth to use the original investment portfolio as collateral assets.

        • If investors want to short a coin, they can borrow it first, then sell the coin to the exchange, and then arbitrage from the decline in the price of the currency.

          Governance

          In the process of reading the white paper, I found that a more interesting aspect of Compound is that it puts forward some governance ideas. Although this section only takes up a short paragraph, before reading the white papers of dydx or some other defi projects, It feels that there is basically no governance involved.

          Compound ’s governance mechanism is this: They envisage that the entire agreement should be a centralized management model, and slowly change to a decentralized management model voted by the community and takeholders. There is a transition from centralization to decentralization. I think this method is also more reasonable, and can achieve a good balance between efficiency and openness.

          The following rights are controlled by the administrator or management committee of the agreement from the beginning:

          • Right to choose a new administrator or management committee (such as DAO)

          • The right to set a borrowing interest rate model for each currency market

          • The right to open, close, and lift a currency market

          • Decide which entity should be entrusted with the right to the price of the currency

          • Ability to withdraw assets (earned income) in the agreement

            Over time, Compound hopes to gradually deliver these rightsFor community-controlled DAO organizations. The form of this DAO may be a smart contract on Ethereum. Community members can propose or vote to trigger specific functions of the smart contract to exercise those rights mentioned above. Because one of the rights of this DAO is to elect a new DAO, in general, this DAO will have the ability to continuously achieve self-evolution based on vote by the stakeholder.

            Regardless of whether the idea of ​​Compound ’s set of governance mechanisms has landed, and whether it is mature enough, I think it is an interesting attempt.

            The future of Compound

            In the dydx article, we mentioned that anyone can build and release a new futures product on dydx to add vitality to the cryptocurrency financial market. Compound’s agreement is simpler than dydx, because borrowing is a more basic and universal part of finance.

            I think the future of Compound will still depend on whether developers build new services on it, especially when combined with the dApp, there may be different imagination spaces. As mentioned in the white paper: Any dApp, machine or exchange, if there is an additional token balance, can be put on the Compound protocol to make fuller use of funds. This has the potential to unlock another completely different business model for the Ethereum ecosystem.

            If there is a dApp that works well but cannot find a business model, and a large amount of ERC-20 tokens are deposited in its contract, then it can use the Compound’s currency market to borrow and make some money. It’s a bit like many Internet companies use their own business to recover cash flow, and then use the money to make financial operations to make money, such as our one-time gym that pays membership fees, e-commerce to purchase consumer cards, and deposits for cars Car rental companies, Alipay and more.

            I saw a few interesting cases they were talking about on Discord channel of Compound, and I can share them. For example, someone built a very interesting little application called PoolTogether on Compound’s agreement, which is called a “lottery application that will not lose money.” This application works like this: You find poolTogether to buy a lottery ticket, and the money you pay will be locked into a smart contract. PoolTogether aggregates all the money that everyone buys the lottery ticket, and then put it on Compound to make a loan. After the lottery draw is over, all the interest generated by the loan will be owned by the person who wins, and everyone can get back the principal of the ticket.

            This is a very interesting application, because as long as more people buy lottery tickets and save their money together, the larger the bonus interest bonus, the more attractive it will be, creating a positive cycle. Someone also opened another brain based on this appDong: Can the same model be used as a way to support your favorite up / singer / idol? Fans save the money together to generate interest, and the interest is finally distributed to the up owners who want to support it.

            anyway, an application like this may look particularly small, but I think it will be a very interesting attempt. On the discord channel, someone asked Compound that everyone else has 5x10x margin trading. The compound lending rate seems insignificant compared to you. Haven’t you thought about adding some derivatives that increase the leverage? The founder of Compound replied that there are many platforms for financial derivatives on the market, and many have margin trading. However, in these models, what he sees is that the most basic borrowings are actually unnecessary. friction. Therefore, Compound still wants to do the most basic thing to borrow. I think this judgment is correct. Perhaps with a stronger borrowing foundation, we can see more abundant applications and new gameplay.

            Further reading:

            • compound white paper: https://compound.finance/documents/Compound.Whitepaper.v04-83de48b6622ddd665234b41076d04c8b.pdf?vsn=d

            • Compound protocol spec: https://github.com/compound-finance/compound-money-market/tree/master/docs/CompoundProtocol.pdf

            • Compound protocol API documentation: https://compound.finance/developers

            • github code: https://github.com/compound-finance/compound-money-market