Skip to content

Decentralized finance (DeFi), explained

DeFi rebuilds financial services (lending, trading, saving, yield) as smart contracts anyone can use without a bank or broker. Here's how the core building blocks work, how DeFi compares with CeFi, and where the risk actually lives.

Published: Updated: Reading time: 6 min
On this page

Decentralized finance (DeFi) rebuilds financial services (lending, trading, saving, and yield) as smart contracts on a public blockchain that anyone can use permissionlessly, without a bank or broker in the middle. Your wallet is your account, the blockchain is the ledger, and open-source code does the job a financial institution normally would.

How DeFi works

You don't sign up for anything. You connect a wallet to a protocol and the protocol does the rest.

A protocol is just a set of smart contracts deployed on a chain like Ethereum. Those contracts hold pooled funds and enforce rules that no one can quietly change: this pool pays 4% to suppliers, that position gets liquidated if collateral drops below a threshold, this swap follows a fixed pricing formula. You sign a transaction, it settles on-chain within minutes, and the outcome is public for anyone to audit.

Because every protocol reads and writes the same shared ledger, one app can plug straight into another. A stablecoin earned in one app becomes collateral in another, which mints a token you stake somewhere else. People call this composability. It's the reason DeFi moves fast, and also why it occasionally breaks in ways nobody predicted.

The core building blocks

Most of DeFi comes down to four primitives, and most products combine a few.

  • DEXs and AMMs. A decentralized exchange (DEX) lets you swap tokens with no order book, unlike the centralized exchanges most people start on. Instead, an automated market maker prices trades against a liquidity pool using a formula, classically x * y = k: buy one token and its reserve shrinks, so its price rises automatically. Uniswap popularized the model. The people who fund those pools earn trading fees, and chasing extra token rewards on top is what "yield farming" usually means.
  • Lending markets. Suppliers deposit assets into a pool and earn interest; borrowers post collateral and take a loan against it. Rates move algorithmically with supply and demand. Aave is the largest of these by total value locked.
  • Staking and liquid staking. Lock tokens to help secure a network and earn rewards. Liquid staking hands you a receipt token in return, so your capital keeps working elsewhere while the original stake stays bonded. Lido popularized it.
  • Stablecoins sit under all of it as the settlement layer. USDT and USDC hold their peg with off-chain reserves. DAI (now part of the Sky ecosystem, alongside USDS) was built on overcollateralized on-chain loans, though part of its backing is now USDC and other assets. Without a stable unit of account, none of the rest would be usable.

What is DeFi lending

DeFi lending deserves its own look, because it's where most people first put real money to work, and it behaves nothing like a bank loan.

Everything is overcollateralized. To borrow 700 dollars of stablecoins you might lock 1,000 dollars of ETH. That sounds backwards until you remember there is no credit check and no one to chase you for repayment. The collateral itself is the guarantee. If your collateral value falls too far, the protocol liquidates it automatically to cover the debt, and nobody calls you first.

Why borrow against your own assets instead of just selling them? Usually to get liquidity without triggering a taxable sale, or to lever up on a position you want to keep. Keep in mind that a liquidation is itself a sale, so it can create the tax bill you were trying to avoid. Misjudge the market and the tool works against you.

DeFi vs CeFi

CeFi (centralized)DeFi (decentralized)
CustodyA company holds your assetsYou hold your own keys
AccessAccount, ID checks, approvalAny wallet, no approval
SupportHelp desk, sometimes reversalsNone, transactions are final
TransparencyInternal books, periodic reportsEvery balance on a public ledger
Main riskThe company fails or freezes fundsCode bugs, key theft, your own mistakes

Why DeFi is compelling

It's open 24/7 to anyone with a wallet and an internet connection, and no gatekeeper decides whether you qualify.

Every balance and rule lives on a public ledger you can inspect yourself. Builders can assemble new products from existing protocols in days rather than negotiating partnerships for months. And you keep custody the whole time, so no third party can freeze the account or go under and take your balance with it. That same self-custody is why the risks below land entirely on you.

Where the risk lives

When something goes wrong in DeFi, there is no support line and no chargeback.

  • Smart-contract exploits. A bug in a contract can hand its funds to whoever finds it first, and DeFi loses billions of dollars to hacks every year. The bigger losses now often come from compromised keys and access controls rather than contract code. Chainalysis counted over 3.4 billion dollars stolen from crypto services in 2025, and the largest single theft (Bybit, about 1.5 billion) came from compromised access.
  • Oracle manipulation is the quieter one. Protocols read outside prices through oracles, so if someone tricks the price feed they can drain a lending market before anyone reacts. Mango Markets in October 2022 is the textbook case.
  • Impermanent loss. Supply liquidity to an AMM and a divergence in the two token prices can leave you worse off than if you had simply held them. The fees are supposed to compensate. Sometimes they don't.
  • Liquidation cascades. Leverage plus a sharp price drop triggers forced sells, which push prices lower, which trigger more liquidations.

A useful rule of thumb: an unusually high yield isn't free money, it's a risk you haven't identified yet. Find the mechanism before you deposit.

How DeFi is regulated

Regulation is arriving unevenly and is still mostly unsettled. Regulators are comfortable with custodians (companies that hold your assets) and much less sure what to do with software that holds nothing and answers to no one.

In the EU, the MiCA regulation brought crypto-asset services under formal rules but excluded services provided in a genuinely decentralized way without any intermediary. MiCA also required a DeFi review, due by the end of 2024, and the two agencies published their joint report in January 2025. In the US, a stablecoin law (the GENIUS Act) passed in 2025, while market-structure and DeFi rules are still contested, with the core fight over whether a given token or protocol counts as a security. The pattern almost everywhere is the same: regulate anything custodial first, and treat genuinely decentralized finance as the harder, later problem.

For the protocol categories in more depth, see DeFi protocols explained, and for the wider market picture, what DeFi is and how it works in 2026.

If you're building in this space, that ambiguity isn't an excuse to ignore compliance. It's a reason to design for it early. Teams that need production DeFi smart contracts and the guardrails around them work with a custom software development partner who has shipped on-chain before, so they don't learn liquidation math with live funds.

Frequently asked questions

  • DeFi, short for decentralized finance, is financial services run by smart contracts on a blockchain instead of a bank. No company holds your money or approves your transactions. You connect a wallet, and the code executes the rules on-chain for anyone, anywhere.

  • You interact with a protocol straight from your own wallet. The protocol is a set of smart contracts that hold pooled funds and enforce the rules automatically. You can swap tokens against a liquidity pool, supply assets to earn interest, or post collateral to borrow against it. Every action settles on-chain within minutes, the balances are public, and nobody sits in the middle approving anything or holding your funds in custody.

  • It's as safe as the code and the people running it. The underlying blockchain rarely fails, but the contracts on top of it can, and DeFi loses billions of dollars to exploits, stolen keys, and oracle attacks. There's no bank to reverse a loss. Audits, position limits, and understanding how a protocol works all reduce the risk, but none of them removes it.

  • CeFi (centralized finance) means a company like an exchange custodies your assets and runs the service. DeFi is noncustodial: you hold your own keys and interact with open smart contracts. CeFi is easier and offers support. DeFi is permissionless and transparent, but you carry all of the risk yourself.

  • Staking locks your tokens to help secure a proof-of-stake network, and you earn rewards for it. Liquid staking goes a step further: you get a tradeable receipt token that represents your staked position, so your capital keeps earning elsewhere while the original stake stays bonded. Lido is the best-known example.

  • In most countries, yes. Swaps, yield, staking rewards, and lending interest are usually taxable, though the rules vary and change often. In the US, the IRS treats staking rewards as income once you control them. On-chain activity is public and traceable, so keep records and ask a tax professional in your region.

Still unanswered
Ask us directly

A senior engineer replies under 4 hours.

Related expertise