Blockchain

DeFi (Decentralized Finance)

Financial services built on blockchain technology that operate without traditional intermediaries like banks, using smart contracts for lending, trading, and more.

Decentralized Finance (DeFi) is an ecosystem of financial applications built on blockchain networks that replicate and improve upon traditional financial services without centralized intermediaries.

Core DeFi primitives include decentralized exchanges (DEXs) like Uniswap for token trading, lending protocols like Aave and Compound for borrowing and lending, stablecoins like USDC and DAI for price stability, and yield aggregators like Yearn for optimizing returns.

DeFi operates through smart contracts that are transparent, composable, and permissionless. "Composability" means DeFi protocols can be combined like building blocks — a concept called "money legos." For example, you can deposit tokens into a lending protocol, use the receipt tokens as collateral elsewhere, and earn yield on both.

Key risks include smart contract vulnerabilities, impermanent loss in liquidity pools, liquidation risk in leveraged positions, and regulatory uncertainty. Total Value Locked (TVL) is a key metric for measuring DeFi adoption.

How it works

DeFi applications are smart contracts: programs deployed on a public blockchain that hold tokens and move them according to their code. ethereum.org describes DeFi as financial products and services that are accessible to anyone who can use Ethereum.

Users interact by signing transactions from a wallet they control. Contract code and balances are on-chain, so anyone can inspect them, and contracts can call one another. ethereum.org gives the example of lending tokens on one platform and then trading the interest-bearing token received in return on an entirely different application.

Many decentralised exchanges replace order books with automated market makers. A Uniswap pool holds reserves of two tokens, x and y, and enforces x * y = k, where k must stay constant or increase after every trade. Buying one token adds the other to the pool, so the price follows the ratio of the reserves, and larger trades relative to pool depth move it more. Swap fees go to the liquidity providers who supplied the reserves.

The same openness carries risk. ethereum.org notes that DeFi products, like any software, can suffer from bugs and exploits, and a transaction executed by a faulty contract generally cannot be reversed by a support desk.

Example

A worked constant-product trade, ignoring fees: a pool with 100 ETH and 200,000 USDC, so k = 20,000,000 and the starting price is 2,000 USDC per ETH.

Trader adds 10,000 USDC
  new USDC reserve  = 200,000 + 10,000        = 210,000
  new ETH reserve   = 20,000,000 / 210,000    ≈  95.238
  ETH paid out      = 100 − 95.238            ≈   4.762
  effective price   = 10,000 / 4.762          ≈ 2,100 USDC per ETH
  pool price after  = 210,000 / 95.238        ≈ 2,205 USDC per ETH

The trader paid about 5% above the starting price because the trade was large relative to the pool: that gap is price impact. In a pool ten times deeper, the same 10,000 USDC would move the price far less. Real pools also charge a swap fee on top, set per pool and protocol version.

Common confusion

Is DeFi the same as cryptocurrency?

No. Cryptocurrencies and other tokens are assets. DeFi is the set of applications, such as exchanges, lending markets and stablecoin systems, that let people trade, lend and borrow those assets through smart contracts. Holding a token does not involve DeFi; swapping it in an on-chain pool does.

What is the difference between DeFi and a centralised crypto exchange?

On a centralised exchange a company holds customers' funds and matches trades in its own systems, much like a broker. In DeFi, users keep custody in their own wallets and trades are executed by public smart contracts on-chain. That removes the intermediary, and also removes the intermediary's ability to reverse mistakes or recover lost keys.

Further reading

Want to learn more?

Explore more developer terms or read in-depth articles on the blog.

Browse all terms