decrypt101
SocialOpen ProjectsSupport me My Resumes
  • Preface
    • Motivation
    • Roadmap’s
  • Introduction to Blockchain
    • A Brief History
    • Growth of Blockchain
    • Structure of Blockchain
    • Types of Blockchain
    • Key Technologies of Blockchain
    • Features of Blockchain
    • How Blockchain Works ?
    • Implementation of Blockchain
    • Summary
  • Components of Blockchain Architecture
    • Distributed Ledger
    • Blocks
    • Transaction
    • Chain
    • Peer-to-Peer Network
    • Blockchain Layers
    • Off-Chain & On-Chain
    • Wallet
    • Mining
    • Tokens
    • Assets
    • State Channels
    • Sidechains
    • Oracles on Blockchain
    • Atomic Swaps
    • Decentralized Identity (DID)
    • Blockchain Data Storage
    • Interoperability
    • Data structures for Scaling Blockchain
    • Maximal Extractable Value (MEV)
  • Consensus Mechanisms
    • Proof of Work (PoW)
      • Implemation Using Rust
    • Proof of Stake (PoS)
    • Proof of Burn (PoB)
    • Proof of Capacity (PoC)
    • Proof of Activity (PoAc)
    • Proof of Weight (PoWe)
    • Proof of Luck (PoL)
    • Proof of Ownership (PoO)
    • Proof of Existence (PoE)
    • Proof of Believability (PoBe)
    • Proof of History (PoH)
    • Proof of Authority (PoA)
    • Proof of Elapsed Time (PoET)
  • Cryptographics
    • Encryption & Decryption
      • Symmetric Encryption
      • Asymmetric Encryption
      • Key Management and Exchange
      • Implementation
    • Cryptographic Hashing
      • Secure Hash Algorithms (SHA)
      • Message Digest Algorithms
      • Ethash
      • Blake2
      • SCrypt
      • RIPEMD-160
    • Digital Signature
      • Digital Signature Algorithms
      • Digital Signature in Blockchain
    • Zero-Knowledge Proofs (ZKPs)
      • Types of Zero-Knowledge Proof and Protocols
      • A Case Study of Polygon Platform
    • Multi-Party Computation (MPC)
    • Cryptanalysis
    • Practical Implementation
  • Decentralized Application (DApp)
    • Design and UX in Web3
  • Smart Contract
    • Development Tools
    • Solidity
    • Testing Smart Contract
    • Developing Smart Contract
    • Interacting & Deploying with Smart Contract
    • Verifying Smart Contracts
    • Upgrading Smart Contracts
    • Securing Smart Contract
    • Smart Contract Composability
    • Testnet and Mainnet
    • Blockchain Platform Using Smart Contract
    • Application of Smart Contract
    • Practical Implementation
  • Blockchain Platforms
    • Ethereum
      • Ethereum Virtual Machine (EVM)
      • ETHER and GAS
      • Ethereum transaction
      • Ethereum Accounts
      • Ethereum Stacking
      • Ethereum Network
      • Ethereum Scaling Solutions
      • Ethereum Use-Cases
      • Getting Started with Ethereum
      • Ethereum Ecosystem and Support
    • Solana
      • Solana Architecture
        • Solana Account Model
        • Solana Wallet
        • Transactions and Instructions
        • Solana Programs
        • Program Derived Address (PDA)
        • Cross Program Invocation (CPI)
        • Tokens on Solana
        • Clusters and Public RPC Endpoints
        • Transaction Confirmation & Expiration
        • Retrying Transactions
        • Versioned Transactions
        • Address Lookup Tables
        • State Compression
        • Actions and Blinks
      • Solana Developments
      • Solana Client
      • Advanced Solana
      • Solana Scaling and Performance Architecture
      • Solana Solutions and cases
      • Practical Implemenation
    • Binance Smart Chain (BSC)
      • Create a BEP20 Token
    • Hyperledger Fabric
    • Cosmos
    • Polkadot
    • Quorum
    • Polygon
    • Algorand
    • Corda
    • Avalanche
    • TRON
    • Summary
  • Decentralized Finance (DeFi)
    • DeFi Components
    • DeFi Protocols
    • DeFi Platforms
    • DeFi Risk Classification
      • Infrastructure-layer Attacks
      • Smart Contract Layer-attacks
      • Application Layer-attacks
      • DeFi Risks
    • DeFi and Blockchain
    • DeFi Impact
  • Decentralized Ecosystem and Digital Innovation
    • Layer 2 Scaling Fundamental
    • Tokenomics
    • Cryptocurrency
    • Quantative Trading
    • NFTs
    • GameFi
    • Metaverse
  • Blockchain as a Service (BaaS)
    • Building Fullstack Blockchain Platform
    • Decentralized Digital Identity
    • Build a Cryptocurrencies Exchange
    • Play-to-Earn Gaming
    • Solana Token Airdrop Manager
    • Smart Contract Development on Solana with Rust
    • Quantitative Trading Platform
    • Insurances protocols
    • Flash Loans
    • Asset Management
    • Tokenized Derivatives
    • Automated Market Makers (AMMs)
    • Staking
    • Lending and Borrowing Platforms
    • Yield Farming
    • Stablecoin System
    • Security Token Offerings (STOs)
    • Initial Coin Offerings (ICOs)
    • On-Chain Voting Systems
    • Decentralized Autonomous Organizations (DAOs)
    • NFT Marketplaces
    • Provenance Verification
    • Supply Chain Tracking
    • Commodities Tokenization
    • Real Estate Tokenization
    • Digital Certificates
    • KYC (Know Your Customer)
  • Blockchain Development Across Languages
    • Blockchain using Go(Golang)
    • Blockchain using Rust
    • Blockchain using Python
    • Blockchain using Cairo
  • Distributed Systems & Infrastructure Technology
    • Classification of Distributed Systems
    • Networked systems versus Distributed systems
    • Parallel systems vs Distributed systems
    • Distributed versus Decentralized systems
    • Processes of Distributed Systems
    • Architecture of Distributed systems
    • Infrastructure Technologies
  • Distributed System Patterns
    • Distributed Agreements Algorithms
      • HoneyBadgerBFT
    • Data Replications
    • Data Partition
    • Consistency
    • Distributed Time
    • Cluster Management
    • Communication between Nodes
    • Fault Tolerance and Resilience
      • How to design better fault tolerance systems
      • Resilience Patterns
    • Coordination systems
      • Clock synchronization
    • Security
      • Trust in distributed systems
      • Design of Principal Security
      • Security threats, policies, and mechanisms
      • Authentication and Authorizations
      • Cryptography
      • Monitoring in Security
  • Distributed System Design
    • Page 1
    • Distributed Shared Memory
    • Distributed Data Management
    • Distributed Knowledge Management
    • Distributed Ledger
  • FAQs
  • Support and Community
Powered by GitBook
On this page
  • Layer-1 and Layer-2 Blockchains
  • Layer 1 Vs Layer 2
  • Centralized Finance
  • DeFi Taxonomy and Design Requirements
  • Applications
  • Design Requirements of DeFi
  • Architecture
  • Continuous Improvement and Governance
  • Continuous Improvement
  • Governance
  • DeFi Stakeholders
  1. Decentralized Finance (DeFi)

DeFi Components

The DeFi ecosystem is composed of several core components that work together to enable decentralized financial services. The general design principles for blockchains and Distributed Ledger Technology (DLT) and their implications for activities in financial services have been widely studied

These elements provide the foundation for the various applications and use cases of DeFi:

Layer-1 and Layer-2 Blockchains

A blockchain (BC) is a computer network that maintains a distributed database. This network only allows appending new transactions and forbids deleting or updating any transactions. Transactions are grouped into blocks and block order in the database is maintained, and verifiable, using cryptographic hash functions and digital signatures. BCs can be classified as permissioned and permissionless. Permissionless BCs are open (public) networks accessible by all. Permissioned BCs can be accessed only by external parties recognized by the system administrator. For this Documentation, we define a BC as a public - trustless and permissionless - distributed ledger. Consequently, DeFi applications are also trustless - they do not depend on any centralized entity - and permissionless - and are open to use by any BC wallet.

A network consensus mechanism defines the rules, for what constitutes a legitimate transaction and block. The dominant consensus mechanisms are proof-of-work (PoW) and proof-of-stake (PoS). The consensus mechanism economically incentivizes network participants - miners in PoW and validators in PoS blockchains - to promote network security. In PoW BCs, miners, to append a new block to the ledger, are required to solve the cryptographic puzzle in a process that requires electricity. In PoS BCs, validators, to append a new block, must pledge (”stake”) a certain amount of native tokens of the underlying BC. In exchange for appending a new block, validators receive a reward. In case of malicious behavior, validators are punished, in a process called slashing by a fee from the staked tokens. Staking is the process of providing BC native tokens to validators to participate in profits from the block rewards. By design, the PoS blockchain requires validators and stakers to freeze their tokens for a period of time that may vary from days to years. Gas fee is paid to miners and validators for appending the transaction to the BC.

Layer 1 Vs Layer 2

According to blockchain trilemma, the blockchain network can only prioritize two features between three: decentralization, security, or scalability. As security is an absolute requirement and decentralization is a promise of BC, scalability has remained a challenge, resulting in low transaction rates and high transaction processing latencies. Layer-1 is the blockchain with its own, independent trust assumptions: the network of nodes, and consensus mechanism. Layer-1 solutions target the improvements of the core elements of blockchain design, e.g., block data, consensus mechanisms, or sharding the network. Layer-2 solutions aim to scale the BC without modifying the underlying trust assumptions. Layer-2 protocols are built on top of layer-1 BCs. Roll-ups are the most common scaling solutions for DeFi protocols deployed to Ethereum. They aim to reduce the load of the main chain by taking the transaction execution off the chain in batches and bundling them together for on-chain verification. Depending on the verification process, roll-ups can be divided into two groups: optimistic roll-ups, e.g., Arbitrum, Optimism, and zero-knowledge (zk) roll-ups, e.g., zkSync, starknet.

Centralized Finance

Decentralized Finance (DeFi) encompasses a broad spectrum of financial applications that leverage blockchain technology to ensure security and integrity. In contrast, Centralized Finance (CeFi) refers to financial applications that, while engaging with digital assets, are hosted outside the blockchain ecosystem. A prime example of CeFi is centralized exchanges (CEXs) such as Binance or Kraken, which facilitate the conversion of fiat currencies (e.g., USD, EUR, CHF) into cryptocurrencies. These cryptocurrencies can either be transferred to a blockchain-based crypto wallet or remain under the custody of the CEX.

Traditional Finance (TradFi) pertains to conventional financial systems that do not involve digital asset-related activities or products. The demarcation between CeFi and DeFi is not always straightforward. Research has proposed a structured methodology for distinguishing between the two. Financial applications are categorized as CeFi if users do not retain custody of their tokens (i.e., they cannot control or transfer the assets without an intermediary). CeFi applications may or may not utilize blockchain settlement.

The collapse of FTX, the world's second-largest CEX, in November 2022, highlighted the risks associated with CeFi, as it left customers unable to access their cryptocurrencies. Conversely, if users retain control over their digital assets but the intermediary has the capability to censor transactions, the application is classified as CeFi with blockchain settlement. Examples include stablecoins like USDT and USDC, which are backed by fiat currencies. Notably, the issuer of USDT has destroyed $44 million of blacklisted USDT.

DeFi protocols can be further categorized based on their governance models: centrally governed and Decentralized Autonomous Organization (DAO). Centrally governed DeFi protocols are managed externally from the blockchain, whereas DAO models involve governance through voting by holders of governance tokens.

DeFi Taxonomy and Design Requirements

DeFi protocols provide various financial services and can be classified based on the value proposition to users: trading, lending, asset management, and BC interoperability. This section proposes novel classification frameworks. First, we separate the token classification from the taxonomy of DeFi protocols. Next, we classify DeFi protocols in two dimensions - algorithm and network (blockchain) architecture. The Taxonomy of DeFi algorithms is based on the technical and economical design of DeFi protocols. The DeFi algorithm determines how financial services are performed on the BC and to which risks DeFi agents are exposed. Taxonomy of DeFi network architecture refers to the number of BCs, on which the protocol operates and the coordination of its work across those BCs. The network architecture implies the infrastructure risks. The classifications within those two domains, as well as token taxonomy, are straightforward, as the values assigned to each dimension can be traced from the DeFi protocols’ implementations and whitepapers that are publicly available.

Applications

DeFi protocols provide various value propositions to users - trading, lending, asset management, and BC interoperability - and extend the initial objective of BCs: a decentralized payment system and store of value.

  • Trading: Decentralized Exchanges (DEXs), e.g., UniSwap, allow DeFi users to swap between two tokens with the settlement occurring directly on the blockchain. Compared to Centralized Exchanges (CEXs), DEXs offer a higher diversity of tradeable tokens and higher security of transactions. DEX Aggregators, e.g., 0x, are DeFi protocols that collect exchange rates from various DEXs and the best execution options. The major risks of DEXs for DeFi users include slippage risk and MEV attacks. Slippage cost refers to the difference between the price quoted by the DEX and the executed price. The MEV (maximum extractable values) attacks are executed by miners or validators that re-order transactions for their profits, leaving the DeFi user with higher

    slippage costs.

  • Lending: Lending Protocols allow DeFi users to borrow tokens against collateral. Interest rate protocols, such as Compound, and Aave, create pools of tokens that can be lent and borrowed, thus they are also referred to as protocols for loanable funds. Depending on token supply and demand, the protocols automatically adjust interest rates. Another mechanism for on-chain lending is provided by crypto-backed stablecoin protocols, such as MakerDAO, and Liquity. Stablecoins are tokens that hold their value pegged to the fiat currency, typically the US dollar. In order to hold the peg to the reference value, crypto-backed stablecoin holds collateral of other crypto tokens to ensure that the circulating token has a redemption value. Any DeFi user can borrow stablecoins directly from the stablecoin protocols by proving crypto collateral. In such a case, a collateralized debt position (CDP) is created. The major risk of DeFi lending is the liquidation risk of the underlying collateral. The liquidation occurs when the collateral value descends behind the minimum over-collateralization threshold. The dep-peg risk refers to the circumstances when stablecoin fails to hold the reference value.

  • Assets Management: The DeFi Protocols in asset management allow DeFi users to generate additional yield on their tokens. Yield farming is a process of providing liquidity capital to DeFi protocols in exchange for fee participation rewards similar to market making in traditional finance. Impermanent Loss is a major economic risk associated with yield farming, caused by the high volatility of the crypto-tokens. Liquid staking refers to DeFi protocols that accumulate rewards from staking without locking the tokens. The staking process at PoS BCs supports the security of the underlying BC but requires locking staked tokens for a defined period to collect the staking reward. De-Peg risks are the major risk related to liquid staking.

  • Blockchain Interoperability: Blockchains, by design, are siloed computer networks that do not communicate with each other. Bridges allow DeFi users to transfer tokens between blockchains without employing any CEX, and to hold exposure to the tokens from other blockchains, e.g., exposure to Bitcoin on the Ethereum chain. To achieve this objective, bridge protocols create wrapped tokens - tokens with the value pegged to the tokens at other blockchains, e.g., wrapped Bitcoin on the Ethereum chain. Wrapped tokens are exposed to the de-peg risk.

Design Requirements of DeFi

In the design domain, the DeFi protocol can be classified into three dimensions: liquidity pools, aggregators, and synthetic tokens, as presented in Figure 1.2.

dhdjaehwelnkbwewejjwejwejfj

The DeFi protocols are developed on the infrastructure layer of their underlying blockchains. The infrastructure layer includes native tokens or staking for proof-of-stake blockchains.

  • Synthetic (Pegged) Tokens: Synthetic tokens are similar to derivatives in traditional finance. They employ smart contracts to keep the peg to the target value, which might be fiat currency - stablecoins, tokens at other blockchains - wrapped tokens of bridges, and staked tokens - liquid staking. The inherent risk of all synthetic tokens is the re-peg risk.

  • Liquidity Pools: Liquidity pool-based DeFi protocols match the demand and supply using token pools operated by smart contracts. The major DeFi liquidity pool-based protocols include decentralized exchanges (DEX) and interest-rate protocols. DEXs manage the supply and demand to swap tokens and, depending on the design, can be further classified as CLOB or AMM. There are various implementations of AMM, with concentrated liquidity being the latest improvement that increases the capital efficiency at AMM DEX. The interest-rate protocol manages the supply and demand for borrowing and lending and adjusts interest rates automatically. DeFi liquidity pools protocols and stablecoins are referred to as DeFi primitives.

  • Aggregators: The major aggregator protocols facilitate the operations of DEXs and include DEX aggregators and yield farming protocols. DEX aggregators allow DEX service customers - traders - to find the best execution rate, and sometimes offer protections against MEV attacks, by splitting the transaction into smaller ones. Yield farming protocols simplify and increase liquidity efficiency at AMM DEXs.

Architecture

This dimension describes whether DeFi protocols operate on a single blockchain (BC) or across multiple blockchains. While most DeFi protocols currently operate on a single chain, there is a growing trend towards multi-chain and cross-chain architectures, which are anticipated to become increasingly significant in the DeFi landscape.

a) Single Chain: Single-chain protocols are deployed and function within a single blockchain network. The majority of DeFi protocols are currently single-chain, focusing their operations on one blockchain environment to leverage its specific features and capabilities.

b) Cross-Chain: Cross-chain protocols facilitate operations across multiple blockchains, enabling the transfer of value between different blockchain networks. These protocols employ blockchain interoperability technologies to transform value from one blockchain into value on another. Cross-chain solutions often include bridges that connect distinct blockchain ecosystems, enhancing their ability to interact and share resources.

c) Multi-Chain: Multi-chain protocols operate across multiple blockchains independently, without the need for value transfer between chains. Unlike cross-chain protocols, multi-chain systems do not rely on mechanisms for value cross-chain interaction, such as cross-chain collateral. Examples of DeFi protocols utilizing a multi-chain approach include Aave and Uniswap, which are deployed across various blockchain networks to broaden their accessibility and functionality.

d) App Chain: App-chains, also known as Solo-chains, are DeFi protocols that develop their own sovereign blockchain tailored to specific use cases. Depending on their security models, app-chains can be classified into Layer 1 (L1), Layer 2 (L2), or Layer 3 (L3). For example, Cosmos offers an SDK for developing L1 app-chains, while Polkadot facilitates the creation of L2 app-chains known as parachains. Additionally, Starknet and zkSync are zero-knowledge rollups (L2) built on Ethereum, with the potential for further development into L3 solutions.

Continuous Improvement and Governance

Continuous Improvement and Governance are critical aspects of maintaining and evolving DeFi protocols to ensure they remain effective, secure, and responsive to user needs. These components play a vital role in the ongoing development and sustainability of decentralized financial systems.

Continuous Improvement

Continuous improvement in DeFi involves the iterative enhancement of protocols and systems based on user feedback, technological advancements, and evolving market conditions. This process includes:

  • Protocol Upgrades: Regular updates and enhancements to improve functionality, security, and performance. These upgrades may involve refining algorithms, optimizing smart contracts, and integrating new features to meet emerging needs.

  • Bug Fixes and Security Patches: Addressing vulnerabilities and issues identified within the protocol to safeguard against potential threats and ensure the integrity of the system. Prompt responses to security breaches and bugs are essential to maintaining trust and reliability.

  • User Feedback and Iteration: Incorporating feedback from the user community to make improvements and address pain points. This feedback loop allows for continuous adaptation and refinement of the protocol to better align with user expectations and market demands.

Governance

Governance in DeFi refers to the mechanisms and processes by which decisions are made regarding the development, management, and evolution of a protocol. Effective governance ensures that the protocol remains aligned with its objectives and responsive to its stakeholders. Key aspects include:

  • Decentralized Autonomous Organizations (DAOs): Many DeFi protocols utilize DAOs to enable decentralized decision-making. DAOs allow token holders to participate in governance by voting on proposals related to protocol changes, upgrades, and other critical decisions.

  • Governance Tokens: These tokens grant holders the ability to propose and vote on changes to the protocol. Governance tokens empower the community to influence the direction and development of the protocol, ensuring that it evolves in a way that reflects the interests of its users.

  • Proposal and Voting Systems: Governance processes often involve structured proposals and voting mechanisms. Proposals for changes or upgrades are submitted and reviewed by the community, with voting conducted to reach a consensus on the implementation of proposed changes.

  • Transparency and Accountability: Effective governance ensures transparency in decision-making processes and holds participants accountable for their actions. Clear communication and documentation of governance decisions foster trust and engagement within the community.

By prioritizing continuous improvement and robust governance, DeFi protocols can adapt to changing conditions, enhance their value propositions, and maintain their relevance and effectiveness in the rapidly evolving financial landscape.

DeFi Stakeholders

Blockchain is a decentralized network, in which its stakeholders (nodes, validators) operate in peer-to-peer model, without any system administrators or centralized entity. DeFi protocols are smart contracts deployed to BC and DeFi users interact with those smart contracts. A liquidity pool is a smart contract that holds tokens deposited in a DeFi protocol by liquidity providers (LPs) in order to facilitate financial services (e.g., borrowing, token swapping). LPs thus fulfill a similar role to that of market makers in TradFi. DeFi stakeholders - service customers of DeFi protocols, LPs, arbitrageurs, and governance users (e.g., founders, developers, investors) interact with the liquidity pools, operating in peer-to-pool model. DeFi stakeholders have different incentives and roles in DeFi, and consequently are exposed to various risks. The table IV summarizes the DeFi stakeholders and risk analysis follows in the further sections.

The table IV: DEFI STAKEHOLDERS, BASED ON

Stakeholder
Role
Incentive

Sevice Customers

Interact with the DeFi protocol

Profit, credit, liquidity mining

Liquidity Providers

Provides capital to DeFi protocols to ensure sufficient liquidity for financial services

Protocol fee profit participation, liquidity mining

Arbitrageurs

Eliminate

the market inefficiencies between different DeFi protocols

Arbitrage Profits

Governance Users

Design, develop and maintain the DeFi protocol

Governance token appreciation

Liquidity mining is a process of interacting with a DeFi protocol to collect its governance tokens or other rewards. The process is not related to mining in PoW BCs. The prime objective of liquidity mining is to attract new users and LPs to DeFi protocols.

PreviousDecentralized Finance (DeFi)NextDeFi Protocols

Last updated 8 months ago