Crypto, DeFi

What is Compound Finance Protocol?

Written by Admin · 3 min read >

The compound is an algorithmic, self-contained interest rate protocol designed for developers to open up a world of open financial apps. It is regarded as the most secure protocol for money. If you require a finance protocol for your company or personal use, Compound Finance is the best choice. Below are some guides on using compound Finance.

Setting up an Ethereum Development Environment

The Compound Protocol is an Ethereum smart contract library that allows software developers to interact with digital money marketplaces. You must write to the Ethereum blockchain in order to supply or borrow assets from the protocol.

Ethereum is a decentralized public network of nodes that process transactions and add them to a growing ledger known as the blockchain. Smart contracts are software that may be written by developers and hosted on the Ethereum network. Anyone with Ethereum access can perform write and read activities on the blockchain.

You’ll need an access point to the Ethereum network, some awareness of smart contract design, and some knowledge of JSON RPC to write a program for Ethereum and interact with Compound’s smart contracts.

Key Concepts in Ethereum Development

It only takes a few minutes to set up your Ethereum development environment. Before we start creating code, we need to have a basic comprehension of a few general ideas.

  • Solidity is the most widely used programming language on Ethereum for creating smart contracts.
  • Web3.js is a JavaScript framework for web browsers and Node.js that allows developers to read and attractively write to the Ethereum blockchain. JSON RPC from Web3.js can be used to execute Solidity smart contracts.
  • Infura.io is a business that offers an API for accessing the Ethereum network via HTTP and WebSockets. You must host your own Ethereum network node to access the network without using a service like Infura’s API.
  • The Ethereum Main Network (also known as Homestead) is the production environment for Ethereum. This is where you may swap, burn, and mine actual Ether (ETH). Ropsten, Göerli, Kovan, and Rinkeby are all popular public test networks. The Infura API can be used to access all of these networks.

Supplying Assets to the Compound Finance Protocol

On the Ethereum blockchain, the Compound finance Protocol is a set of interest rate marketplaces. When users and applications give the Compound Protocol an asset, they immediately start earning a variable interest rate. Every Ethereum block (now 13 seconds) accrues interest, and users can withdraw their principal plus interest at any time.

Users contribute their assets to a big pool of liquidity (a “market”) that is available for other users to borrow from, and they share in the interest paid back to the pool by borrowers.

Users obtain cTokens from Compound Crypto in exchange for supplying assets. cTokens are Ethereum-based ERC20 tokens that can be redeemed at any time for their underlying assets. cTokens are redeemable at an exchange rate (compared to the underlying asset) that constantly grows over time, based on the rate of interest earned by the underlying asset, as interest accrues to the assets given.

Non-technical users can utilize Argent, Coinbase Wallet, or app.compound.finance to communicate with the Compound Protocol, while developers can construct their own applications that connect with Compound’s smart contracts.

Developers can use the Compound Finance Protocol to create novel DeFi products. We’ve seen crypto wallets with savings APRs, a no-lose lottery system, an interest-earning system for contribution income, and more so far. The Ethereum blockchain is where the protocol’s smart contracts are deployed. This implies that, as of the authoring of this guide, Compound can only support Ether and ERC-20 tokens.

You’ll need to utilize the contract address for the network you’re developing on; start by looking up each network’s contract address in the Docs. We’ll make a fork of Mainnet that will run on our localhost in this step; copy the Mainnet addresses.

Borrowing Assets from the Compound Finance Protocol

The Compound Crypto Protocol allows users to borrow crypto assets as collateral for any other supported asset, allowing them to settle a trade or use an application with an asset they don’t already own.

A user with ETH, for example, might send it to Compound and immediately borrow DAI.

Borrowing can be done through a graphical user interface or through code. Let’s go over some fundamental principles before going over the processes of a borrowing sequence.

  • Collateral: To borrow cryptocurrency via the Compound Crypto system, users must first provide collateral in the form of another cryptocurrency. This is done with the same mint function that is used to deliver assets. Users cannot redeem or transfer assets while they are being used as collateral, but they do earn interest while in the protocol.
  • Collateral Factor: The maximum amount that customers can borrow is limited by the collateral factors of the assets they have provided as security. For example, if a user provides 100 DAI as collateral and the advertised DAI collateral factor is 75%, the user can only borrow 75 DAI worth of other assets at any given moment. On Compound, each asset can have a variable collateral factor. The Comptroller contract can be used to obtain collateral considerations for each asset. They can also be altered by Compound Governance, but only after a five-day waiting period.
  • Calculating Account Liquidity: When you have various collateral assets with varying collateral factors, how do you know what your maximum allowable borrow amount is? The Comptroller contract has an easy-to-use function that estimates the liquidity of your account, which is a USD-denominated value of the maximum permissible borrow amount. You should never borrow this much money all at once because the protocol’s “accrued interest” function will immediately liquidate your account.
  • The Open Price Feed: How does the protocol know how much money a user can borrow or if their account is insolvent? Compound Finance has its own Price Feed contract, which contains all supported assets’ current exchange rates. The Open Price Feed finds the median price by combining price feeds from many highly liquid exchanges, and it includes criteria built into the contract to verify the accuracy of its stated values. The Open Price Feed documentation is available on the Compound website.

Leveraged tokens

Admin in Crypto
  ·   1 min read

How to make money with cryptocurrency

Admin in Crypto
  ·   5 min read