Compound is a decentralized lending and borrowing protocol built on the Ethereum blockchain. Unlike traditional finance, it offers transparent interest rate models, high privacy, instant loans, and no-lock-in savings.
How Compound Works: The Basic Structure
Let's use DAI, which often has one of the highest supply APYs, as an example. Lenders deposit DAI into a smart contract to immediately start earning interest. Borrowers can then take out loans in DAI by collateralizing other assets, such as ETH, and pay interest on the borrowed amount.
A few key points about this structure:
- Borrowers can collateralize any asset supported by Compound, but the total value of the collateral must always be greater than the borrowed amount to mitigate the risk of default. This is governed by a collateral factor.
- When a borrower repays a loan, the interest paid is distributed proportionally to all lenders who have supplied that asset. This eliminates the need for one-to-one matching of lenders and borrowers.
- Borrowers can repay their loans at any time, with the total amount due calculated based on the interest rate and the duration of the loan. Similarly, lenders can withdraw their principal plus accrued interest at any time, provided there is sufficient liquidity in the protocol. A reserve mechanism ensures that enough assets are available for withdrawals.
How Does Compound Enable Instant Deposits and Withdrawals?
The protocol uses a clever token system. When a lender deposits 1 DAI into the smart contract, they receive cDAI (compound DAI) tokens in return. The lender can later redeem these cDAI tokens for the original DAI plus any accrued interest.
How is Interest Generated?
The key to understanding interest accrual is the exchange rate between the underlying asset (e.g., DAI) and its cToken (e.g., cDAI).
If a lender deposits 1 DAI and receives 40 cDAI, the initial exchange rate is 1 DAI / 40 cDAI = 0.025. Over time, as interest accrues, this exchange rate increases.
- Initially, 1 cDAI can be redeemed for 0.025 DAI.
- As time passes, the exchange rate becomes greater than 0.025, meaning 1 cDAI can be redeemed for more than 0.025 DAI.
- Therefore, the same 40 cDAI can later be redeemed for more than 1 DAI. The difference is the interest earned.
- Everyone interacting with the Compound protocol uses the same, globally updated exchange rate.
By simply holding cTokens, a lender automatically earns interest on the underlying supplied asset.
A Practical Example
- On October 10, 2019, Alice deposits 1000 DAI and receives 40,000 cDAI. The exchange rate is 0.025.
- On October 10, 2020, Alice decides to withdraw her funds. The exchange rate has now increased to 0.0275.
- She redeems her 40,000 cDAI for 40,000 × 0.0275 = 1100 DAI.
- The extra 100 DAI is the interest she earned over the year.
How is the Exchange Rate Calculated?
The exchange rate for a cToken is determined by several variables:
- totalCash: The total amount of the underlying asset held in the contract that is not currently lent out.
- totalBorrows: The total amount of the underlying asset that borrowers owe (principal + accrued interest).
- totalReserves: The total amount of reserves held by the protocol (a portion of the interest paid by borrowers).
- totalSupply: The total supply of the cToken.
The exchange rate increases as more borrowing activity occurs, driving up the totalBorrows and the interest that needs to be distributed.
Borrow APR and Supply APY
A central concept in Compound's model is the Utilization Rate (U).
Simply put, the utilization rate is the percentage of the total supplied assets that are currently being borrowed.
For example, if the utilization rate for DAI is 62.13%, it means that 62.13% of all deposited DAI is currently out on loan.
This utilization rate is the primary input for Compound's core interest rate model.
Borrow APR
The borrow interest rate (APR) is calculated based on:
- Base Rate
- Utilization Rate (U)
- Multiplier
Borrow APR = Base Rate + (Utilization Rate × Multiplier)
For Compound's DAI market, the Base Rate is 5% and the Multiplier is 12%. If the current Utilization Rate is 62.13%:
Borrow APR = 5% + (12% × 0.6213) = 12.46%
This is the annualized rate a borrower would pay at that exact moment.
Supply APY
The supply interest rate (APY) that lenders earn is derived from the borrow rate. It is influenced by:
- Borrow APR (the rate calculated above)
- Utilization Rate (U)
- Reserve Factor
Supply APY ≈ Borrow APR × Utilization Rate × (1 - Reserve Factor)
Using the same DAI example, with a Borrow APR of 12.46%, a Utilization Rate of 62.13%, and a Reserve Factor of 5%:
Supply APY ≈ 12.46% × 62.13% × (1 - 5%) = 12.46% × 0.6213 × 0.95 = 7.35%
This is the annualized rate a lender would earn at that moment.
It's important to note that theBase Rate,Multiplier, andReserve Factorare unique constants for each asset market on Compound. These parameters can be adjusted by the protocol's admin, and all changes are recorded transparently on the blockchain.
Key Takeaways from the Model
With fixed constants, the borrow and supply rates for a single asset have theoretical minimum and maximum values because the only variable is the Utilization Rate.
For DAI:
Borrow APR = 5% + (U × 12%)
- Minimum (U=0%): 5%
- Maximum (U=100%): 17%
Supply APY ≈ Borrow APR × U × (1 - 5%)
- Minimum (U=0%): 0%
- Maximum (U=100%): ≈16.15% (17% × 100% × 0.95)
Actual rates will fluctuate between these extremes based on real-time market supply and demand (utilization).
How Often Do Rates Update?
Interest rates on Compound update in near real-time. The smallest unit of time for a rate change is one Ethereum block. With a new block mined approximately every 15 seconds, interest rates can potentially change that frequently.
Compound calculates interest per block by dividing the annual rate by the estimated number of blocks in a year, which the protocol sets at 2,102,400.
A Practical Example of Interest Accrual
- Bob borrows 100,000 DAI on October 10th at 11:00 AM. The borrow APR is 10%.
- At 12:00 PM, due to a change in the utilization rate, the borrow APR increases to 15%.
- Bob repays the full loan at 1:00 PM on the same day.
How much does Bob owe?
- From 11:00 AM - 12:00 PM (1 hour, ~240 blocks) at 10% APR:
Interest = 100,000 × 0.10 × (240 / 2,102,400) ≈ 1.14 DAI - From 12:00 PM - 1:00 PM (1 hour, ~240 blocks) at 15% APR:
Interest = (100,000 + 1.14) × 0.15 × (240 / 2,102,400) ≈ 1.71 DAI
(Interest compounds by being added to the principal for the next calculation) - Total Repayment:
100,000 + 1.14 + 1.71 = 100,002.85 DAI
How Are Borrowers Forced to Repay? The Role of Collateral and Liquidation
To secure a loan, a borrower must collateralize assets. If the value of their collateral falls too close to the value of their loan, it can be liquidated.
Each asset on Compound has a Collateral Factor—a loan-to-value (LTV) ratio that determines how much can be borrowed against it.
Liquidation Example:
- Carol collateralizes 3 ETH (worth $600 at $200/ETH) to borrow DAI.
- ETH's collateral factor is 75%, so her borrowing power is $600 × 0.75 = **$450**.
- She borrows 445 DAI (assuming 1 DAI = $1).
- Later, she owes 451 DAI (principal + 6 DAI interest), but hasn't repaid. Her debt ($451) now exceeds her borrowing power ($450).
- A portion of her collateral is now eligible for liquidation. A liquidator can repay up to half of her outstanding debt (451 / 2 = ~225.5 DAI).
- In return for repaying 200 DAI of her debt, the liquidator can seize Carol's collateral at a discount. With a liquidation incentive of, for example, 10%, the liquidator receives $220 worth of ETH (1.1 ETH) for repaying 200 DAI.
- After this liquidation, Carol's debt is reduced by 200 DAI to 251 DAI. She now has 1.9 ETH left as collateral, valued at $380. Her new borrowing power is $380 × 0.75 = $285, which is greater than her remaining $251 debt, so the liquidation process stops.
This mechanism protects lenders by ensuring loans are always over-collateralized. 👉 Explore more DeFi strategies
Frequently Asked Questions
How does Compound make money?
Compound doesn't "make money" in a traditional sense. The protocol collects a portion of the interest paid by borrowers (the Reserve Factor) and holds it in a reserve, which acts as an insurance fund to cover potential shortfalls and secure the system.
Is lending on Compound safe?
While innovative, DeFi protocols carry risks. The primary risk on Compound is smart contract vulnerability. The protocol has undergone extensive audits, but the code is complex. There is also the risk of a collateral asset crashing in value faster than liquidators can act, potentially leaving some loans under-collateralized.
Can I lose money by supplying assets?
The main risk for suppliers is smart contract risk. Your deposited funds are not FDIC insured. However, the liquidation mechanism for borrowers is designed to protect suppliers from losses due to borrower default. You earn interest continuously for as long as your assets are supplied.
What is the difference between APR and APY on Compound?
For borrowers, the rate is shown as an APR (Annual Percentage Rate). For suppliers, the rate is shown as an APY (Annual Percentage Yield), which takes into effect the compounding nature of interest, which accrues every block (approximately every 15 seconds).
Who sets the interest rates on Compound?
Ultimately, the market does. Rates are determined algorithmically based on the supply and demand (utilization) for each asset. The protocol's governance can adjust the model parameters (Base Rate, Multiplier, Reserve Factor) for each market to influence how rates respond to utilization.
What happens if Compound's admin changes the parameters?
The protocol is designed to be governed by its token holders (COMP). Any proposed changes to interest rate model parameters must be voted on by the community, making the process decentralized and transparent.
Conclusion
Compound's interest rate model is a cornerstone of DeFi, enabling efficient and transparent capital markets.
- It enables instant deposits and loans without requiring one-to-one matching.
- Holding cTokens automatically accrues interest for suppliers.
- The Utilization Rate is the primary driver of both borrow and supply interest rates.
- Interest rates update, and interest accrues, approximately every 15 seconds with each new Ethereum block.
- A robust liquidation mechanism helps ensure the protocol remains solvent, protecting lenders.