Person putting coin into piggybank - article about defi protocols for lending and borrowing

Defi Protocols and Apps for Lending & Borrowing

Defi is the latest trend in cryptocurrency and has been gaining momentum since 2020. It stands for “decentralized finance” and puts a decentralized spin on lending and borrowing (plus other finance functions such as derivatives and insurance). This article will help you get started in the fascinating world of defi by introducing you to it and offering resources for learning more about it. As is the case with many other things, there are certain intricacies associated with it.

Ethereum and Binance

Ethereum is commonly used in defi activities. It’s the first and most developed blockchain platform. Plus, it supports smart contract programming (a crucial defi requirement). Many protocol tokens for defi are ERC-20 tokens. Since the underlying token type is the same, you’re able to swap Ether for other Ethereum tokens and vice versa.

Binance Smart Chain is a popular Ethereum alternative that supports tokens and many defi functions. Binance defi platforms operate similarly to well-known Ethereum platforms such as Uniswap, Compound, and Aave. A bridge between Ethereum and Binance allows you to transfer tokens between the two blockchain platforms. According to Cointelegraphdecentralized finance has been growing faster on BSC than on Ethereum in 2021. The rise in popularity is likely the result of high gas fees on Ethereum, driving demand for alternative blockchains.

Defi Protocols

Think of a defi protocol as a platform that conducts lending and borrowing with smart contracts and blockchain technology. The tokens generated from these protocols represent the amount borrowed, claim interest payments, insurance, or interest substitutes in a different cryptocurrency and stablecoins.

Here’s a list of common protocols you’ll encounter in the defi ecosystem. It’s not exhaustive—new releases and innovations are always happening.

  • Compound: a company that allows people to earn money on the cryptocurrency they save and borrowers to pull funds. Depositors receive c-tokens, which represent the cryptocurrency unit deposited and earns interest for the holders. C-tokens are tradable, and new holders become eligible to receive interest. And c-tokens can be used in other dapps for various purposes—collateral, down payments, paying fees, etc.
  • Kyber Network: it’s a platform that allows token swap functionality in decentralized applications. They also operate KyberSwap (token trading for ERC-20 tokens) and KyberDAO (holders of the KNC token are eligible for collecting a portion of trading fees).
  • Celsius: it’s the only centralized defi protocol on this list that operates like a traditional bank. Depositors can store their funds in Celsius wallets and earn interest by selecting other cryptocurrencies, stablecoins, or the Celsius native token CEL. Borrowers can get loans at low APY.
  • Balancer: if you’ve heard about Uniswap, Balancer functions similarly but allows up to 8 pairs of ERC-20 and Ether tokens instead of just a pair. It’s also useful as an automated portfolio manager. Meaning, it’s an inverse of how a stock investment fund works (automated market makers).
  • Aave: it’s an open-source protocol that facilitates lending and borrowing. Like Compound, Aave issues aTokens that are pegged to the value of the underlying deposited asset and accrues interest automatically. Depositors can redirect earned interest to any Ethereum public address. Aave is also the creator of Flash Loansdefi loans that don’t require collateral.
  • Ampleforth: it’s a cryptocurrency that’s different from others included in this list. The protocol doesn’t facilitate lending and borrowing. The token is designated to function as money but with a flexible circulation supply to maintain supply-demand equilibrium. Ampleforth automatically adjusts the wallet supplies of the tokens to reduce volatility as much as possible. The token’s protocol seeks equilibrium according to the Law of Supply and Demand, without pegging itself to the price of another asset. In theory, Ampleforth could replace the need for stablecoins in the defi space—with AMPL serving as collateral instead of a fiat-connected stablecoin.
  • MakerDAO: the decentralized protocol is responsible for creating the Dai stablecoin. When borrowing on the MakerDAO marketplace (Oasis), you’re given Dai when you create a Vault, and stability fees are based on a rate called the Dai Savings Rate (DSR). The Rate is voted on and determined by holders of the Maker governance token (MKR).

Swap Platforms and DEXs

Decentralized exchanges (DEXs) are platforms that skip onerous KYC requirements and allow people to swap different coins and tokens. The first platforms were Ethereum exclusive—Ether coins and ERC-20 tokens—based on a coin-token pairing formula. Crypto buyers trade one cryptocurrency for another token (“swapping”) from liquidity pools (for more detailed explanations, read about Uniswap and 0x).

Here’s a list of popular DEX platforms that support cryptocurrency swaps. Each platform works differently (some have liquidity pool pairs, others are 1-1 swaps), and you should learn their intricacies. Therefore, we link to pages that explain a platform (whether it’s the platform’s site or not).

  • Uniswap: liquidity providers (“depositors”) provide Ether and any ERC-20 token, or a pair of two different ERC-20 tokens, to a liquidity pool where buyers can obtain cryptocurrency via swaps.
  • KyberSwap
  • Curve.fi
  • 1inch
  • Balancer
  • Oasis.app

For swapping to work in a decentralized environment, depositors have to deposit them into a liquidity pool. Most liquidity pools work by making the depositor input a specific quantity of tokens and an equivalent quantity of native blockchain coins or matching token pairs.

There are two aspects of DEXs you should know about: slippage and impermanent loss. Slippage refers to the difference between the actual price of the crypto asset and the price reported by the decentralized exchange. Slippage variances last for seconds, but seasoned DEX traders know how to exploit it for a profit with the right timing. Impermanent loss occurs when the value of an asset drops from its original price when it was first deposited. If the price value returns to normal, then your loss is negated. The loss becomes permanent if the liquidity provider withdraws their funds while they’re negative value.

Swap DEXs have moved beyond Ethereum. Newcomers to the smart contract blockchain space – Cardano, Avalance, Solana, Binance – have DEXs available on their respective platforms for exchanging coins for tokens. Plus, they’ve built or plan to build bridges to other blockchain networks for facilitating cross-chain trades. Binance has the Binance Bridge; Avalance has the C-Chain; Cardano will soon have an ERC-20 converter (and probably BEP-20 and SLP converters soon as well). Binance’s network is divided into Binance Smart Chain (BSC) and Binance Blockchain (BNB). Most of the DEX activity that occurs happens on BSC which is accessible to most countries, but BNB is mostly restricted to a select list of areas. Avalanche is divided into three sub-chains: P-Chain, X-Chain, and C-Chain. Most DEX trading happens on the C-Chain, which shares the same public address as Ethereum for cross-chain transfers and usage with self-custodial wallets.

Wallet Apps Used in Defi

A direct connection to your hot or hard wallet is required to use lending and borrowing protocols and engage in token swaps. Most platforms support WalletConnect, which provides a QR code you can scan using any software wallet manager. You can also use MetaMask, a web browser extension that connects with your wallet for sending/receiving funds. Fortmatic and Portis are two platforms that store keys and seed phrases in a hot wallet account. Some DEX platforms can connect directly to your hardware wallet (usually for Trezor and Ledger wallets). By using your wallet to trade funds, you avoid onerous KYC procedures, receive funds much quicker, keep your private keys safe, and maintain your privacy.

How to Use MetaMask

Metamask (metamask.io) is a self-custodial wallet that’s available as a browser extension. You can use it as a hot wallet, by generating a new or existing private key to use the wallet or connecting it to a hardware device (Ledger and Trezor only) for extra security. By default, it connects to the main Ethereum network, but you can configure it for Binance Smart Chain, Polygon, Avalanche, and other Ethereum-related blockchains by finding a blockchain’s RPC (network URL) and then setting it up in the web app.

Below is a list of common RPC configurations for popular blockchain networks that are cross-chained with Ethereum:

  • Binance Smart Chain
    • RPC URL: https://bsc-dataseed.binance.org/
    • Chain ID: 0x38 or 56
    • Explorer: https://bscscan.com
    • Symbol: BNB
  • Polygon
    • RPC URL: https://polygon-rpc.com/
    • Chain ID: 137
    • Explorer: https://polygonscan.com/
    • Symbol: MATIC
  • Avalanche
    • RPC URL: https://api.avax.network/ext/bc/C/rpc
    • Chain ID: 43114
    • Explorer: https://cchain.explorer.avax.network/
    • Symbol: AVAX
  • Arbitrum One
    • RPC URL: https://arb1.arbitrum.io/rpc
    • Chain ID: 42161
    • Explorer: https://arbiscan.io
    • Symbol: AETH

How to Use WalletConnect

WalletConnect (walletconnect.com) isn’t a platform, it’s a protocol. It allows you to connect mobile apps with online dapp services. To utilize the protocol, find WalletConnect in the mobile app. Usually it activates your smartphone camera. In the online dapp service, select WalletConnect as a connection for it to generate a QR image. Scan the image with your camera. This action should activate WalletConnect mode within the mobile app and the dapp service. When you need to approve a transaction, you can allow it inside the mobile app and the dapp service will register the permission.

Defi Book

Decentralized finance and yield farming are recent phenomena. There aren’t many books explaining this burgeoning area of the crypto space. Plenty of articles exist but the flurry of web content can become overwhelming. There’s one recommended book you can read, called “Defi Guidebook” by Dr. Liew Voon Kiong. Many of the concepts in this guide are explained in detail, plus the author provides a tutorial for each popular DEX platform (Uniswap, 1inch, Curve Finance, and others). Buy it on Amazon.