This is a study note of Decentralized Finance. It is an overview of DeFi.

1 Lecture

1.1 Finance

Finance is teh process that involves the creation, management, and investment of money and financial assets. Financial assets include bank deposits, stocks, bonds, loans, derviatives. Their values are dervied from a contractual claim. Financial services include banking, lending/borrowing, securities, insurance, trusts, and funds. Financial markets are marketplaces for trading financial assets.

Traditional financial institutions are centralized and have the following issues:

  • can control/freeze customs' assets
  • can censor transactions and charge fees
  • are highly regulated by rules: KYC (know your customer), AML (anti-money laundering), CFT (combat the financing of terrorism).
  • use opaque, siloed database and applications
  • need to be trusted and operate securely

1.2 DeFi

Decentralized Finance (DeFi) is a financial infrastructure that is open, permissionless, and highly interoperable protocol stack built on public smart contract platform. It has the following features:

  • customer controlled assets: non-custodial.
  • decentralized transaction execution: DeFi settlement
  • decentralized protocol execution: trustless DeFi governance
  • permissionless
  • Pseudonymous: privacy
  • Transparency and public verifiability
  • Composability and interoperability
  • Innovation: simpler and faster, atomic somposability (flash loan)

DeFi has the following layers in the bottom up order:

  • settlement layer: blockchain
  • assets: eth, fungible token, NFT
  • protocol: exchange, lending, derivatives, asset management
  • application layer: applications

Roles: User, protocol, oracle, bridge, keeper (a bot triggers events).

DeFi services:

  • traditional: trading, lending, insurance, asset managment, derivatives, data analysis
  • new: custody, stable coin, oracle, cross-chain

1.3 DeFi Services, Risks and Research Topics

  • Asset Tokenization
    • tokenization is the process of adding new assets to a blockchain
    • Tokens are programmable and are easy to access, transfer
    • Types: governance, security, NFT, stablecoin (offchain, onchain and algorithmic)
  • DEX: non-custodial, transparency, permissionless, new exchange protocols (order books, p2p negotiation, amm, maker proposal)
  • Decentralized lending:
    • In CeFi, it is credit-worthiness. The default is expensive, especially when there is an under-collaterization.
    • In DeFi, it is not based on credit. It is over collateralization: collateralized debt postions and debt markets. Under collateralization can be used too (?).
  • Flash Loans: borrow without collateral, an innovation doesn’t exist in CeFi.
  • Other services
    • decentralized derivatives: asset-based and event-based
    • onchain asset management: non-custodial
    • Decentralized insurance

There are eecurity issues in techinical structure and economic incentive. For example, a front-running attacker uses higher transaction fee to execute a transaction T2 before an observed transaction T1. Miner extratable value (MEV) is another example There are systemic risks: highly volatile in price, transaction fees.

Research topics are scalability, usability, universal accessibility, privacy with compliance, legal framework.

2 CeFi Vs DeFi

DeFi offers transparency, control and accessibility. A financial system consists of three components: institutions issue, buy and sell instruments on markets. DeFi has the following properties:

  • public verifability/auditable: open source code and transparent application states.
  • non-custody: users control their assets.
  • privacy: pseudoanonymity. The KYC/AML/CFT rules apply to the convert of fiat and cryptocurrency.
  • Atomicity: multiple transactions are committed together.
  • Composable: due to the open protocol and data.
  • Execution order malleability: miners control the order of transactions.
  • Transaction costs: fees are necessary to avoid DOS attacks.
  • Non-stop market hours
  • Anonymous development and deployment

Legal Issues include on-boarding, proof of coin prvenance. Financial Action Task Force (FATF) rules may render a DeFi developer liable because travel rule applyies to virtual asset service provider (VASP). “If an entity is able to single-handedly censor or intervene in a financial transaction, this entity may become liable to KYC/AML/CFT requirements, even if the entity is not an asset custodian.” In a DeFi bankrun, the asets are returned with a worse echange rate.

An exchange has three components: a price discovery mechanism, an algorithmic trade matching engine, and a trade clearing system. Each can be decentralized. DEX exchange governance like listing of assets may be achived in DAO. Traditional high-frequency trading (HFT) strategies remain similar in DEX. Arbitrage between two decentralized exchanges on the same blockchain can be considered risk-free because of the same chain atomicity.

In DeFi, the lack of the creditworhiness system and enforcement tools on defaults leads to the necessity of over-collateralization in most lending and borrowing protocol. Liquidation can be completed in one or multiple transactions. A novel lending mechanism in DeFi is the flash loan that allows one to complete borrowing, using and returning transactions in a single block. Flash loans are widely applied in DeFi arbitrages and liquidations because there is no risk of hoding upfront assets. At the high-level economic design, some DeFi protocols have a risk-free rate of return.

There are several stablecoin mechanisms including collateralized asset management, minting and burning. USDC and USDT are reserve-based, while DAI relies on leveraged loans. AMPL and ESD, are algorithmic stablecoins that are less stable. Current tablecoins are not DeFi.

There are synergies between CeFi and DeFi. Oracles transfer CeFi data to DeFi. Synthetix allows user to trade CeFi instrument as derivatives on DeFi.

3 Systematization of Knowledge: DeFi

This paper outlines the DeFi primitives, protocol systematization, techincal security, economic security, and holistic security.

The DeFi primitives are: smart contracts, tokens, transaction execution, keepers, Oracles, governance.

DeFi protocols include the following:

  • on-chain asset exchange: order-book or AMM
  • Protocols for loanable funds (PLF) markets for on-chain assets: lending and borrowing. There are two forms of loans: over-collateralized loans and flash loans.
  • Stablecoins. MakerDao’s DAI is a non-custodial stablecoin.
  • Portfolio management: range from automatic rebalancing of a token portfolio to complex yield aggregating strategies.
  • Derivatives are financial contracts which derive their value from the performance of underlying assets. Synthetic assets, futures, perpetual swaps, and options are four common types.
  • Privacy-preserving mixers prevent the tracing of cryptocurrency transactions. Conjoin in a shielded pool and zero knowledge proof are two methods.

Technical secuirty issues include smart contract vulnerabilities, single-transactioin attacks and single-block attacks.

Economic security issues are about incentive structure of the protocol. These are overcollateralization, MEV, governance risks and governance extract value, market and oracle manipulation.

Future research topics are composability risks, governance, oracles, MEV, Oracle, anonymit and privacy.