Skip to content

What Is Decentralized Finance? How DeFi Works

How lending, trading and yield protocols run on smart contracts instead of banks, why composability matters and where the real risks sit.

Akane T.H.Updated 10 min read

What decentralized finance means

Decentralized finance, usually shortened to DeFi, is a set of financial services — lending, borrowing, trading, holding savings — run by programs on a public blockchain rather than by a bank, a broker or an exchange. Those programs are smart contracts: code that holds the funds, applies the rules and settles the transaction, with no company deciding in the middle.

The difference shows up most clearly in a loan. At a bank, you apply, the bank checks your credit and decides, and the bank holds the money. In DeFi, you lock crypto worth more than the loan into a lending contract and it releases the funds immediately, because the collateral, rather than your record, is what secures it. There is no application and no opening hours — and no one to call when something goes wrong.

The basics

DeFi rebuilds familiar financial services without a central operator. Deposit crypto into a lending protocol and a smart contract records the deposit, tracks the interest owed and returns both when you withdraw, following rules published as code on the blockchain.

Because those contracts run on a public network, the services are available at any hour, from anywhere with an internet connection, and they do not ask who you are. That last point cuts both ways. It removes the paperwork that keeps some people out of banking, and it removes the checks that protect the people already inside it.

The principles behind it

  • Decentralization: no single operator can approve, refuse or reverse a transaction.
  • Transparency: transactions and contract code sit on a public blockchain, so anyone can inspect both.
  • Permissionless access: anyone with a wallet and an internet connection can use a protocol. There is no account to open and no approval to wait for.
  • Composability: protocols can call each other, so one application can be assembled out of several others.

The vocabulary moves quickly, and much of it is used loosely. The Web3 dictionary defines the terms that appear here.

How DeFi works

A smart contract is a program stored on a blockchain that runs when someone sends it a transaction. It holds balances, applies its rules and cannot be talked out of them. Lending, trading and savings products in DeFi are all built this way: the contract does what a bank's back office, its rulebook and its vault would otherwise do between them.

Depositing into a lending protocol works like this. You connect a crypto wallet to the protocol's site, approve a transaction, and the contract takes the deposit and begins crediting interest. Nobody sets that rate. It moves with how much has been deposited against how much is being borrowed, and it can change from one hour to the next.

A four-stage strip of a lending deposit: connect a crypto wallet to the protocol's site, approve the transaction, the contract takes the deposit, then it credits interest at a rate nobody sets, which moves with deposits against borrowing and can change from one hour to the next.

What the blockchain contributes

The blockchain is the record. Every deposit, withdrawal and trade is written to it, and anyone can read a contract's code and its entire transaction history without asking permission — an audit trail no bank publishes.

It is a record, though, not a guarantee. The chain will faithfully record a contract written to steal from its users, and it will not reverse those transactions afterwards. Transparency helps people who can read the code. It is not a substitute for the code being sound.

What the automation changes

  • Always on. Contracts run continuously. There is no settlement window and no bank holiday.
  • Fewer intermediaries. No broker or custodian takes a cut, though you still pay network fees, which rise when the chain is busy.
  • Censorship resistance. No single company can freeze an account or turn a customer away.
  • Speed. Transactions settle in the time the network takes to confirm them, not in days.

Traditional finance vs DeFi

Service Traditional approach DeFi approach What changes for the user
Lending & borrowing A bank decides who borrows, on what terms, after checking their credit. A contract lends against crypto collateral at a rate set by supply and demand. Immediate access if you hold collateral; no recourse, and automatic liquidation if it falls in value.
Trading A centralized exchange holds customer funds and matches orders. A decentralized exchange swaps tokens between wallets against pooled liquidity. You keep custody until the swap; no account, but also no support desk.
Payments Banks and payment processors clear transfers, with cut-off times and fees. Crypto and stablecoins transfer directly between addresses. Settlement in minutes, including across borders; fees depend on how busy the network is.
Asset management A firm manages the assets and charges a fee for it. Strategies run as contracts you deposit into and can withdraw from yourself. Lower fees and a visible strategy; no manager accountable for the outcome.

The main parts of the DeFi ecosystem

Lending and borrowing

Protocols such as Aave and Compound let you deposit crypto for others to borrow and earn the interest they pay. Borrowing runs the other way: you lock up crypto worth more than the loan and draw against it.

The collateral is the whole mechanism. There is no credit check because there is nothing to check — the loan is secured by assets you already hold, not by a judgment about you. If the collateral falls in value past a set threshold, the contract sells it to repay the loan, without warning and without discretion.

Trading

Decentralized exchanges (DEXs) such as Uniswap let people swap one token for another without an exchange holding the funds. Rather than matching buyers to sellers, most DEXs trade against pools of tokens that other users have deposited, pricing each swap by a formula based on what is in the pool. Your tokens stay in your own wallet until the moment of the swap.

Yield farming and liquidity mining

Supplying tokens to those pools earns a share of the trading fees, and protocols often add their own token on top as a further reward. Advertised returns can be very high. So can the losses: reward tokens can fall in value faster than the yield accrues, and the balance of a pool shifts as people trade against it, so you can withdraw less than you put in. This is the experimental end of DeFi and it is priced accordingly.

Composability

Because protocols can call each other, a product can be assembled from parts — a wallet that routes a swap through a DEX and deposits the proceeds into a lending protocol, all in one transaction. That is what people mean when they describe DeFi protocols as building blocks. It also means a failure in one widely used contract spreads to everything built on top of it.

Why people use DeFi

Access

A protocol asks for a wallet, not identification, so it does not turn people away for having no bank account, no credit history or the wrong address. It does require an internet connection, crypto to begin with, and enough collateral to borrow against — barriers of a different kind, and real ones.

Rates and costs

Lending protocols have at times paid depositors more than a savings account, and removing brokers and custodians removes a layer of fees. Neither is free money. The rates float, no deposit insurance sits behind them, and network fees can outweigh the saving on small transactions. For how the sector has moved over time, see the DeFi statistics page.

Transparency and control

Every transaction is on a public ledger, and assets sit in a wallet you control rather than an account a company controls. You can see how a lending protocol allocates funds and how it calculates a rate, because the rules are published as code. The other side of holding your own assets is that recovering them is entirely your own problem.

The risks

Smart contract bugs

Smart contracts are code, and code has bugs. A contract holding a large balance is a standing target, and exploited bugs have emptied protocols of user funds in a single transaction. Programming errors can also lock funds in place, with nobody able to release them. Audits reduce this risk. They do not remove it, and an audit covers the version of the code it examined, not whatever is deployed today.

Losing your keys

Your private key, and the seed phrase that can rebuild it, are the only way to reach your funds. Lose them and the funds stay where they are, permanently out of reach. No authority can restore access. Hardware wallets such as Ledger and Trezor keep keys offline, away from a computer that might be compromised.

Volatility

Crypto prices move sharply and DeFi positions move with them. A borrowing position that looked comfortably collateralized in the morning can be liquidated by the afternoon, at whatever price the market gives. Do not commit money you cannot afford to lose.

Regulatory uncertainty

Governments are still deciding how DeFi fits existing financial law, and the answers differ by country. What counts as a security, who is liable for a protocol, what a platform must collect about its users — all of it is in motion, and it can change what a protocol is allowed to offer, or who it is allowed to offer it to.

Reducing the risk

Read what a protocol actually does before depositing: who wrote it, whether it has been audited, how long it has been running, and what happens to your position if the market moves against you. Start with an amount you would not mind losing. Use a hardware wallet for anything substantial, check the address of every site you connect a wallet to, and treat unsolicited offers of help or returns as phishing, because most of them are.

A four-stage strip of the route the article sets out for a beginner: set up a browser, phone or hardware wallet; get crypto, because every blockchain action costs a gas fee; move a small amount through a full round trip of deposit, wait and withdraw; then read the protocol's own documentation and check what its audit covered.

Getting started

Set up a wallet

A crypto wallet holds the keys that control your assets. MetaMask is a common browser wallet for connecting to DeFi sites; Trust Wallet is a common phone equivalent; a hardware wallet from Ledger or Trezor is worth the cost once real money is involved.

Setting one up produces a seed phrase, usually 12 or 24 words. It rebuilds every key in that wallet on any device, which means anyone who reads it can take everything in it. Write it down offline, and never type it into a website or send it to anyone, whatever they claim to need it for.

Get some crypto

You need crypto both to hold and to transact, because every action on a blockchain costs a gas fee, paid in the network's own coin and charged whether the transaction succeeds or fails. Exchanges such as Coinbase, Kraken and Binance sell crypto for ordinary currency, and you withdraw it from there to your own wallet.

Try a protocol with a small amount

Compound and Uniswap have run for years and are widely used, which makes them reasonable places to see how this works in practice. Compound is not a savings account, whatever the quoted interest rate suggests: the rate is variable, the deposit is not insured, and the contract itself can be exploited. Move a small amount first and follow it through a full round trip — deposit, wait, withdraw — before committing more.

Keep reading

Protocols change and the rules change with them. Read a protocol's own documentation rather than its marketing, and check what an audit actually covered before relying on it. If you are looking to work in this field, see DeFi jobs on Find Web3.

Where DeFi is heading

Interoperability and scaling

Blockchains do not natively talk to each other. Cross-chain bridges move assets between them, so funds held on one chain can be used by a protocol on another. Bridges have also been among the most heavily exploited pieces of infrastructure in crypto, so that convenience carries a cost.

Layer-2 networks address fees and throughput by processing transactions away from the main chain and posting the results back to it, which brings the cost of a transaction down far enough for smaller amounts to be worth moving.

Institutional interest

Established financial firms have moved from dismissing this technology to running pilots with it — tokenized funds, settlement experiments, custody products. How far that goes depends mostly on regulation.

The regulatory picture

Clear rules would give protocols a known legal footing and give users somewhere to turn when something fails. Unclear rules push activity toward whichever jurisdiction decides first. This is the variable most likely to determine what DeFi looks like in five years.

Energy use

The energy criticism applies to proof of work, where computers compete to add blocks by spending electricity. Bitcoin still works that way. Ethereum, where most DeFi runs, switched to proof of stake on 15 September 2022, replacing that competition with deposits of ether that can be destroyed for misbehavior, and cutting the network's energy use to a small fraction of what it had been. Most chains launched since use proof of stake or a variant of it.

A two-column panel comparing proof of work with proof of stake: under proof of work computers compete to add blocks by spending electricity, which is where the energy criticism applies, and Bitcoin still works that way; under proof of stake deposits of ether secure the chain and can be destroyed for misbehavior, and Ethereum switched to it on 15 September 2022, cutting the network's energy use to a small fraction of what it had been.

What it adds up to

DeFi's claim for itself is a financial system anyone can reach, running on rules anyone can read. Parts of that work today: the contracts are public, the services do run without gatekeepers, and settlement is genuinely faster than the systems it copies. The costs are equally real — bugs that cannot be undone, collateral that liquidates without warning, and no one accountable when it does. Both halves are worth understanding before putting money in.

Find Web3 lists Web3 and crypto roles, including DeFi jobs, with salary medians by role and a monthly hiring report.