This page may contain legacy content

To get our most up-to-date content please access our documentation

May 13, 2022

What is DeFi? The Full Decentralized Finance Guide

Table of Contents

DeFi, or decentralized finance, is disrupting modern-day banking, and it’s almost as if the legacy financial system cannot keep up with the needs of 21st-century users. Because of the nearly outdated world of traditional finance, DeFi is becoming increasingly popular day after day. Furthermore, being able to earn high interest on assets, borrow, lend, trade, etc., and cutting out intermediaries is an attractive aspect DeFi offers. The above is just a small taste of what decentralized finance can do for Web3 users. So, if you want a full guide to decentralized finance and have been searching for an answer to the “what is DeFi?” question, you’ve come to the right place. As such, step inside the shuttle and discover everything there is to know about this new financial system in this article as we explore the outer rim of DeFi!

With DeFi, the decentralized crypto ecosystem increases sophistication to mimic traditional finance (TradFi) functions. Beyond simply replicating old models, DeFi dapps are revolutionizing how we conduct financial transactions. But, what is DeFi exactly? The term “DeFi” merges the two words “decentralized” and “finance” together. This exciting hybrid model combines features of decentralized blockchain technology plus the familiar products and services associated with traditional finance. What’s more, you can integrate all-new assets such as NFTs (non-fungible tokens) into DeFi. Decentralized exchanges such as the two most popular platforms, Uniswap and PancakeSwap, feature openly accessible marketplaces where people can trade both fungible and non-fungible assets in permissionless environments.

Herein, we take a closer look at the growing phenomenon of DeFi. We answer the question, “what is DeFi?” and examine how it can benefit our lives. Also, we discuss decentralized exchanges (DEXs), AMMs, and liquidity pools.

Full Video Tutorial Explaining DeFi

If you are a blockchain developer looking for a detailed theoretical and technical understanding of DeFi, look no further than this video from Moralis’ YouTube channel:

https://www.youtube.com/watch?v=5tc8XrA8VdI

Through the above video, you’ll learn about the conceptual transitions from TradFi to CeDeFi to DeFi. Furthermore, you’ll understand lending platforms, decentralized exchanges, and AMM liquidity pools in greater depth.

What is DeFi (Decentralized Finance)?

So, what is DeFi? As touched on briefly, DeFi stands for “decentralized finance”. It’s an umbrella term for an all-new financial infrastructure revolving around the idea of decentralization. In other words, DeFi eliminates the traditional middleman in finance. Hence, the concept, just like the blockchain technology underpinning it, is disruptive and revolutionary.

In traditional finance – or TradFi as it’s called in blockchain and Web3 circles – large institutions serve as trusted intermediaries to facilitate transactions. In DeFi, blockchain technology eliminates the need for such third parties. Moreover, blockchains allow parties to transact anonymously or pseudonymously online.

What is DeFi? Role of Smart Contracts

As we answer the “what is DeFi?” question, you might be wondering, “how is decentralized finance possible?”. It’s possible with the use of what’s called “smart contracts”. Blockchain protocols such as Ethereum use smart contracts to set the rules for transactions. Furthermore, smart contracts hold the assets and execute the transactions once certain conditions are fulfilled.

Smart contracts, also known as Web3 contracts, are crucial to the foundations of DeFi. They form the backbone of decentralized transactions or transactions without an intermediary. Also, they ensure that various DeFi platforms interact seamlessly. Today, developers write smart contracts using Solidity, the programming language of Ethereum (the first Turing-complete blockchain). However, since Ethereum launched, many other blockchains have emerged, each with its own strengths. Such blockchains have built on the knowledge of Ethereum and EVM (Ethereum Virtual Machine) and modified certain aspects, such as transaction speeds or gas fee structures.

Moreover, you’ll find that Moralis, the ultimate Web3 development platform, provides tools and APIs to interact with these blockchains. What’s more, with Moralis, you don’t need to build your node infrastructure from scratch. Gone are the days when developers were forced to deal with the limitations of RPC nodes. Using Moralis Speedy Nodes, you can instantly connect with Ethereum nodes, Polygon nodes, BSC nodes, Arbitrum nodes, and Avalanche nodes.

Create DeFi Dapps 

To be part of the DeFi ecosystem and create dapps, you need to ensure that you have the right Web3 tech stack to do the job. Further, you’ll need different layers in your stack. The first layer involves blockchains, and the second layer involves nodes. The third layer involves APIs, and the fourth layer is composed of comprehensive Web3 development platforms such as Moralis. Moreover, Moralis, the “Firebase for crypto” platform, integrates the functions of legacy services and brings them into the future of Web3 and DeFi. In addition, the fifth layer involves dapps.

Aside from having infinitely scalable node infrastructure, decentralized storage options such as IPFS, and useful APIs (like Moralis’ NFT API), you need the ability to create and manage digital assets. This includes the ability to program, mint, send, receive, and burn tokens. Moreover, these tokens serve as money or property assets within DeFi.

NFTs, the Metaverse, and DeFi

NFTs, or non-fungible tokens, include everything from digital art to digital real estate and gaming. ERC-721 and ERC-1155 token standards allow you to represent anything as a unique digital asset in the DeFi ecosystem. What’s more, they deliver exciting applications in the Web3 metaverse, where they integrate into the GameFi and play-to-earn (P2E) experience. Today, it’s easy to build a play-to-earn game using platforms such as Moralis. Such games have economic and financial aspects attached, and earned tokens are tradable on DeFi exchanges.

Web3 wallets such as MetaMask also play an important role in DeFi and the metaverse. Through these decentralized wallets, anyone can create a Web3 address and authenticate themselves to participate in any DeFi dapp or blockchain game. Furthermore, Web3 wallets don’t need to utilize KYC. Plus, they do not require you to provide personal details to transact. Hence, they protect user privacy – a crucial element DeFi. Moreover, Web3 seamlessly integrates everything through blockchain interoperability. So, since we’ve briefly considered smart contracts, how to create DeFi dapps, and what roles NFTs and the metaverse have in DeFi, it’s time to continue our “what is DeFi?” journey by looking at different types of DeFi applications and components.

DeFi Applications and Components

There are just as many possible types of DeFi dapps as there are financial services, companies, and institutions. Although, because DeFi replicates, builds over, or innovates our current financial services, the potential to generate many more types of dapps remains open-ended, meaning that there are no limitations. Moreover, to answer the “what is DeFi?” question, one must look at the different types of applications that exist for DeFi, and what components are crucial to decentralized finance. As such, the following sections contain examples of the main categories of DeFi dapps and components.

Decentralized Exchanges

Decentralized exchanges, or DEXs, let people trade their crypto assets without the need for traditional KYC. Thus, they let you trade anonymously or pseudonymously. Furthermore, trading on DEXs is permissionless. Moreover, the popularity of DEXs such as Uniswap or PancakeSwap in DeFi exemplifies their key role in supporting the crypto ecosystem.

Stablecoins

Stablecoins are cryptocurrencies pegged to a certain value. Most are pegged to the US dollar (USD). Hence a USD-pegged and backed stablecoin will always be worth one dollar. However, aside from fiat-collateralized stablecoins, there are other types of stablecoins, such as:

  • Crypto-Backed Stablecoins – These are more decentralized than fiat-backed stablecoins and are usually over-collateralized to absorb fluctuations.
  • Commodity-Backed Stablecoins – These use commodities such as gold, real estate, oil, and other precious metals as collateral.
  • Algorithmic Stablecoins or Non-Collateralized Stablecoins – Stablecoins such as this use an algorithm to control supply and use the approach of seigniorage shares.

Stablecoins are especially useful in DeFi ecosystems. Dominant cryptocurrencies or crypto assets, such as Bitcoin or Ethereum, may be highly volatile and may not be ideal instruments for certain purposes. Therefore, stablecoins serve as a stabilizing or anchoring mechanism in the DeFi ecosystem. In addition, they can be a hedging instrument to cushion high volatility in crypto prices. When answering the “what is DeFi?” question, stablecoins paint part of the picture. They make up the stabilizing component of many DeFi ecosystems and decentralized financial instruments.

Yield Farms

In yield farms, you invest or stake your crypto assets to earn passive income. Yield farms have become quite popular among Web3 users as they are a practical way to earn interest on assets with relatively mitigated risk and less investing effort. However, not all yield-type dapps are equal in reliability, safety, and soundness, so you still need to be careful and do proper research before investing. Also, when exploring “what is DeFi?”, you’ll realize that yield farms form part of the passive income or investment component that makes DeFi attractive.

Wrapped Coins

In short, wrapped coins are coins represented by another coin on a different blockchain. This is usually to facilitate interoperability and faster transactions. Although the concept is more intricate in execution than its concept, it’s one of the most practical ideas in DeFi. Furthermore, with wrapped coins, the original coin retains its price value while being transacted on another blockchain. For example, you can transact wrapped BTC on Ethereum as wBTC. What’s more, the wrapped currency can be fully backed by the represented currency.

Lending and Borrowing DeFi Dapps

Dapps that allow lending or borrowing employ the same principles as TradFi credit. The only difference is they don’t need an intermediary. For example, one can borrow stablecoins by using crypto, such as Bitcoin or Ethereum, as collateral. Furthermore, other models involve lending crypto to other Web3 users in exchange for interest on the loan.

Gambling Applications

If you’ve ever wondered if gambling dapps are part of the answer to “what is DeFi?” under DeFi applications, they are. In DeFi, such gambling dapps emphasize anonymity, decentralization, and trustlessness. Furthermore, with gambling dapps, it is possible to show gaming results transparently while protecting the user’s privacy.

What is a Decentralized Exchange?

Now that we are familiar with the basic categories of DeFi applications and components, we can explore DEXs. DEXs, or decentralized exchanges, form part of the deeper understanding of “what is DeFi?”. Furthermore, they comprise an important backbone of the DeFi ecosystem. They allow assets to be freely traded minus the need for traditional KYC.

Crypto assets trading on DeFi DEX platforms has soared in the past few years. According to Uniswap’s website, at the time of writing, its DEX boasts over $959 billion in trading volume and over 96 million all-time trades. In addition to its stellar growth, Uniswap is constantly pushing community participation. Its DEX model features innovative ways of decentralized token-based governance (using an ERC-20 token). What’s more, it also incentivizes developers through a grant program.

Those in the blockchain development community would naturally be interested in how a DEX’s infrastructure works. To start, a DEX uses the blockchain to act as the third party in transactions. Furthermore, blockchain technology’s distributed nature eliminates single trusted parties. Thus, it eliminates single points of failure. Instead, it allows users to retain asset ownership via smart contracts. Also, smart contracts set the rules for the exchange and execute the transactions autonomously as soon as conditions meet. In addition, a DEX can set its unique algorithms on how assets are priced and traded.

What is DeFi? DEX vs CEX

When pondering “what is DeFi?”, you need to understand the difference between a decentralized exchange (DEX) and a centralized exchange (CEX). While CEXs use traditional mechanisms and require extensive user information to use the platform, DEXs provide an alternative. DEXs focus on disintermediation. Moreover, they use smart contracts to facilitate trades.

DEX vs CEX – Order Books

DEXs may not use the typical order book trading engine. Instead of an order book, they may use unconventional trading engines facilitated by algorithms. In other words, they use automated algorithmic trading facilitated by “automated market makers”, or AMMs. Hence, you need to understand AMMs and liquidity pools.

What is an AMM?

To grasp “what is DeFi?” and AMMs, we need to understand market-making basics. Market making is the process of providing liquidity to markets. Market makers quote prices to both buy and sell assets simultaneously. Typically, centralized exchanges use an order book and an order matching system to match buyers and sellers. Order books maintain a real-time electronic record that displays all buy or sell orders at a given time. Further, the engine ensures the efficient matching and settlement of orders.

However, in cases of limited liquidity, where there aren’t enough asset traders, it’s possible to see extreme or uneven price swings within that exchange. Thus, CEXs employ market makers to ensure a continuous bid-ask spread.

What is an AMM – AMM Formulas

An automated market maker (AMM) lets you trade digital assets automatically by using liquidity pools. It uses smart contracts to create liquidity pools of tokens or assets. Furthermore, it sets prices for these assets using mathematical formulas, eliminating the need for human market makers.

Whenever users trade on an AMM-powered DEX, smart contracts automatically send the tokens to the liquidity pool. Afterward, the smart contracts exchange the tokens for their counterparts in the trading pair. The DEX automatically calculates the exchange ratio between the two tokens.

On Uniswap, the AMM formula is “x*y=k”. In this formula, “x” and “y” represent the amounts of each traded token in the pool. Furthermore, the exchange sets “k” as a predefined constant. With this model, you can still expect slippage with each trade. However, larger liquidity pools mean less slippage among large orders.

What is a Liquidity Pool?

A liquidity pool refers to a pool of tokens locked in a smart contract. These tokens function as market-making instruments in a DEX. Liquidity pools allow you to switch between tokens while trading directly on the blockchain. Furthermore, you can expect DEXs to have several liquidity pools. Each pool holds two different crypto assets representing a trading pair. Such trading pairs can represent any two crypto assets or tokens as long as they use the same token standard. Most commonly, it’s the ERC-20 standard.

What is DeFi? AMM and Staking

To illustrate how DeFi benefits users, take the example of passive income through staking. Using an AMM, you can become a market maker. Furthermore, you can earn by staking your crypto assets (tokens or cryptocurrency) as a form of capital. In DeFi, you call market makers “liquidity providers”, or LPs. Moreover, as an LP, you deposit the equivalent value of two tokens in their corresponding pool. For instance, you can deposit $100 worth of USDC and $100 worth of ETH in the USDC/ETH pool. Afterward, you will get LP tokens representing your proportional share in that pool. What’s more, you can start earning fees from the trades in that pool instantly.

Your earnings represent your contribution. You earn the fractional or proportional share of the fees collected from the trades in that particular pool. However, you must note that each protocol charges a different fee (%) for trades. Moreover, rewards in each protocol vary. As DEXs have a governance component, users can also decide on rewards. To understand decentralized governance, read our article regarding governance tokens.

To withdraw your earnings and stop providing liquidity, you can simply return your LP tokens to the smart contract. With this, you’ll receive your original staked tokens and any earned fees.

Create a DEX Clone

Web3 development platforms such as Moralis can help you create your DEX clone. You can use Moralis’ Price API and Moralis’ Deep Index API. Furthermore, Moralis’ Price API helps you pull historical data quickly. Notably, it retrieves the price of any on-chain traded asset on exchanges such as Uniswap, PancakeSwap, or QuickSwap.

Learn how to build your DEX clone using the following tutorial: “Build a Uniswap DEX Clone With HTML, CSS, JavaScript & Moralis on the Ethereum Network“.

What is DeFi? – Summary

DeFi opens up opportunities for Web3 users and blockchain developers to explore new financial models outside traditional finance. With these models, one can find new ways to earn, transact, trade, and allocate digital assets. Furthermore, DeFi is a massive ecosystem, and DeFi’s TVL (total value locked) reached an all-time high in November 2021 at $305 billion. 

With Moralis, the ultimate DeFi and Web3 development platform, you can tap into the opportunities of DeFi by creating your own DeFi dapp. In addition, by using Moralis, you can even create a DEX clone! To access the unprecedented opportunity in DeFi, register on the Moralis site. Explore Moralis and learn to unlock the power of Web3 smart contracts and the innovations they create!

Market Data API
Build amazing trading and portfolio dapps with this Market Data API. Keep users engaged with up-to-date data!
Market Data API
Related Articles
November 15, 2023

How to Build a Real-Time Wallet Tracker

October 2, 2022

Tutorial: How to Connect a Dapp to Polygon Network

November 6, 2022

Web3 Provider – Why Blockchain Developers Should Use One

October 4, 2023

Polygon Node Guide: How to Run a Polygon RPC Node

February 8, 2023

Ethereum Development Tools – How to Build Ethereum Projects in 2023

February 20, 2023

Oasis Testnet Faucet – Get Testnet Funds for the Oasis Network

October 17, 2023

How to Monitor All ETH Transfer Transactions

February 21, 2023

Scaling Solutions for Ethereum – A Developer’s Guide to Ethereum L2s