DeFi in one hour
You build web products. This page teaches you the financial layer Merkl works on: how blockchains hold money, what people do with it in DeFi, why protocols pay them to do it, and how Merkl handles those payments. Six short modules and a quiz. You need no wallet, no money and no prior crypto knowledge.
- Read60 min top to bottom, with small demos to play with.
- Watch~25 min of video can replace the reading in modules 1 and 2.
- Try+10 min optional, in the Merkl App. No wallet needed.
Start here
By the end of the hour you should be able to:
- explain DeFi to a friend in two sentences;
- read a Merkl opportunity page: TVL, APR, campaigns, and what "claimable" means;
- explain how Merkl decides who gets paid, and why it publishes a Merkle root instead of sending tokens to everyone;
- name a few product and engineering problems you could work on here.
If you keep one sentence from this page, keep this one:
DeFi is savings, loans and currency exchange running as public programs on a blockchain. Protocols pay users to bring money to those programs, and Merkl works out who earned what and pays them.
Terms in bold are defined where they first appear, and again in the glossary at the bottom. Grey boxes translate an idea into web development terms. Purple boxes show where Merkl fits.
Want the big picture on video first?
What is DeFi? Decentralized Finance ExplainedFinematics · 12 min · 2020BonusThe blockchain, for someone who builds web apps
We start with the plumbing. Each idea below has an equivalent in web development, shown in the grey boxes.
A database that nobody owns
A blockchain is a database copied across thousands of machines run by different people and companies. Anyone can read all of it. To write, you send a transaction. The network agrees on the order of transactions and groups them into blocks; Ethereum adds one every 12 seconds. Once a block is final, past rows can't be edited.
Picture a public, append-only Postgres. Every write is signed by its author and costs a small fee. Every read is free, for anyone.
Addresses, keys and wallets
An account is an address such as 0x71C7…976F. Behind it sits a private key, and only that key can sign transactions for the address. A wallet app (MetaMask, Rabby, Coinbase Wallet, Trust Wallet, a Ledger device) keeps the key and signs on your behalf. The tokens stay on the chain; the wallet holds what controls them. If the address is like an IBAN that anyone can send money to, the private key is the only signature the bank accepts. There is no password reset. If you lose the key, you lose the account.
"Connect wallet" is the login button. The site receives the address and never sees the key. Every action that writes to the chain opens a confirmation in the wallet, which the user approves or rejects.
Transactions and gas
A transaction says who sends it, which contract it calls, with what data, and how much fee the sender will pay. That fee is gas, paid in the chain's own currency (ETH on Ethereum). On Ethereum mainnet a transaction can cost several dollars when the network is busy. On the cheaper networks built on top of Ethereum, called layer 2s (Base, Arbitrum, Optimism), it's usually a few cents.
Reading costs nothing. Your frontend asks a node for data over JSON-RPC, and libraries such as viem, wagmi or ethers.js wrap those calls.
Smart contracts
A smart contract is a program deployed at an address on the chain. Its code is public, anyone can call its functions, and it keeps its own state. Changing the code after deployment is either impossible or visible onchain. A DeFi protocol such as Aave or Uniswap is a set of smart contracts plus a website that calls them.
Think of a backend API whose code is open source, whose database is public, and where no admin can quietly edit rows.
Tokens
A token is a smart contract that keeps a table of address → balance and follows a standard interface (ERC-20 on Ethereum-style chains, with functions like balanceOf and transfer). Because every token speaks the same interface, any wallet or app can display and move any of them. The kinds you'll meet at Merkl:
- Stablecoins track the US dollar: USDC, USDT, PYUSD. One USDC is worth about $1. A large share of DeFi activity happens in stablecoins.
- Protocol tokens such as AAVE, UNI or MORPHO. Protocols often pay incentives in their own token.
- Receipt tokens prove a deposit. Supply USDC to Aave and you hold aUSDC; deposit into a vault and you hold vault shares.
- NFTs (ERC-721) are unique tokens. A Uniswap v3 liquidity position is an NFT, because no two positions are alike.
Amounts are integers. USDC has 6 decimals, so 1 USDC is stored as 1000000. ETH and most tokens use 18 decimals. Use BigInt, never floats, and expect display bugs to hide here.
Many chains
Ethereum came first. Dozens of other chains run the same virtual machine, the EVM: Base, Arbitrum, Optimism, Polygon, BNB Chain and more. They share the address format and the contract code, but each keeps its own state. Other chains run different stacks, like Solana or Stellar. Moving a token from one chain to another goes through a bridge. Merkl pays users on 60+ chains, and added its first non-EVM chain, Stellar, in 2026.
Your app shows a user's USDC balance on Base. Does the user need to sign anything or pay gas?
No. Balances are public. Your app reads them from a Base RPC node using the user's address. Only writes need a signature and gas.
Three things people do in DeFi
DeFi (decentralized finance) rebuilds savings, loans and currency exchange as smart contracts that anyone can use, with no bank account and no sign-up. Most of it comes down to three activities, and most opportunities on Merkl fall into one of them. For each one, we start with its everyday equivalent.
1. Lend and borrow
Aave · Morpho · Euler · Compound · Fluid
In everyday termsA savings account and a secured loan, with a smart contract in place of the bank.
Lenders deposit tokens into a pool and earn interest. Borrowers take tokens out and pay interest. Rates adjust on their own: the more of the pool is borrowed (its utilization), the higher both rates go, which pulls in lenders and discourages borrowers.
There's no credit score and no court to chase a bad debt, so every loan is overcollateralized. To borrow $700 of USDC you first deposit, say, $1,000 of ETH as collateral. The protocol caps how much you can borrow against it with a loan-to-value ratio (LTV), for example 80%. If ETH drops and your debt gets too close to that limit, anyone can repay part of your loan and take some of your collateral at a discount. That's a liquidation. The health factor tells you how close you are: below 1, you can be liquidated.
People borrow to get dollars without selling their ETH, to take leverage, or to run "looping" strategies that deposit and borrow repeatedly to multiply a yield.
Lending campaigns can reward suppliers, borrowers or collateral depositors on a given market, for example "supply USDC on Aave v3" or "borrow USDC on one Morpho market". Paying borrowers makes sense for a stablecoin issuer that wants its coin used, or for a protocol that earns from the interest borrowers pay.
2. Swap and provide liquidity
Uniswap · Aerodrome · PancakeSwap · Velodrome · Curve
In everyday termsA currency exchange booth whose cash drawer is filled by the public, who split the booth's commission.
A decentralized exchange (DEX) has no order book. It has pools. An ETH/USDC pool holds both tokens; to swap, you put USDC in and take ETH out, and a formula sets the price from the pool's balances. The classic formula is x × y = k, meaning the product of the two balances stays constant. If a pool holds 10 ETH and 30,000 USDC, one ETH costs 3,000 USDC. Each ETH someone buys leaves the pool with less ETH and more USDC, so the next ETH costs a little more. This design is called an automated market maker, or AMM.
The tokens in the pool come from liquidity providers (LPs). They deposit both tokens and earn a cut of every trade, typically between 0.01% and 1% of the volume depending on the pool. LPs take a risk in exchange. When prices move, the pool sells the token that is rising and buys the one that is falling, so an LP can end up with less value than if they had kept both tokens in a wallet. That gap is called impermanent loss.
Concentrated liquidity (Uniswap v3 and v4 and their many forks, labeled CLAMM in Merkl's code) lets an LP pick a price range, say ETH between $3,000 and $4,000. The capital earns fees only while the price stays inside that range, and earns far more per dollar while it does. Each position is unique, so it's an NFT.
In range. The position holds a mix of ETH and USDC, earns a share of every trade, and qualifies for Merkl rewards.
Concentrated liquidity is one of Merkl's largest campaign families, across Uniswap, Aerodrome, PancakeSwap and dozens of other DEXs. By default Merkl rewards only in-range positions, and the creator decides how rewards split between liquidity provided and holdings of each of the pool's two tokens. The point is to pay for liquidity near the current price, which is the liquidity traders use.
3. Deposit into vaults, or hold
Morpho vaults · Euler · Summer Finance · staking and restaking
In everyday termsA money-market fund. You hand over your dollars, a manager invests them, and your shares grow in value.
A vault takes one token, say USDC, and puts it to work through a strategy, often lending it across several markets. Depositors receive vault shares (the ERC-4626 standard) that grow in value. Professional risk managers curate many of them. Wallets now embed vaults directly: Trezor Suite users can earn on USDC and USDT through Morpho vaults, with an extra MORPHO reward boost paid through Merkl.
Some campaigns pay for holding: keep a stablecoin, a staked-ETH token or an NFT in your wallet and earn in proportion to balance and time. Staking means locking tokens to help secure a network or protocol in exchange for rewards.
These pieces stack. You deposit USDC in a vault, the vault lends it on Morpho, and a borrower uses it to provide liquidity on Uniswap. People call this composability, or "money legos", and each layer can run its own incentives.
| Number | What it means |
|---|---|
| TVL | Total value locked: the dollar value deposited in a pool, vault or protocol. The standard measure of size. |
| APR | Annual percentage rate, the yearly return without compounding. Merkl displays APRs. |
| APY | The same return with compounding included, so slightly higher. |
| Native yield | What the activity pays on its own: interest for lenders, trading fees for LPs. |
| Incentives | Extra rewards paid by someone who wants that activity to grow. This is what Merkl distributes. |
An LP's ETH/USDC range is $3,000 to $4,000, and ETH climbs to $4,200. What does the position hold, and what does it earn?
It holds only USDC, because the pool sold the position's ETH as the price rose. It earns no trading fees until the price comes back into range, and Merkl campaigns skip it by default.
Why protocols pay their users
Protocols pay their users because liquidity attracts liquidity, and someone has to bring the first dollars.
A lending market with no lenders has nothing to lend. A DEX pool holding $10,000 gives a terrible price on a $5,000 trade, so traders go elsewhere, so the pool earns no fees, so LPs leave. Every marketplace has this cold-start problem; a ride-hailing app needs drivers before riders show up.
In June 2020, Compound started giving its COMP token to its lenders and borrowers. Deposits jumped, other protocols copied the idea within weeks, and paying users in tokens, called liquidity mining, became the standard way to bootstrap a protocol. People still call that period DeFi summer.
Who pays today
- Protocols paying for deposits, borrowing or liquidity in their own markets. Aave, Morpho and Uniswap all run campaigns through Merkl.
- Token and stablecoin issuers who want their token held, traded and used. PayPal is a Merkl client.
- Blockchains running ecosystem-wide programs to attract users and apps, as Arbitrum and Optimism have done.
- Fintechs and exchanges such as Coinbase and Robinhood, with use cases that go past DeFi: sharing stablecoin yield with customers, gas rebates, onchain payroll.
What goes wrong when you pay naively
- Mercenary capital. Money arrives for the rewards and leaves the day they stop. Who gets paid, for what and for how long decides whether any of it stays.
- Paying for the wrong thing. An out-of-range LP position or an idle deposit helps nobody, and a naive program pays for it anyway.
- Gamed snapshots. If rewards depend on balances at one moment, people deposit just before it and withdraw right after. Merkl tracks every deposit and withdrawal and rewards size multiplied by time held.
- Costly payouts. Sending tokens to 50,000 addresses one transaction at a time burns gas and engineering hours.
- Infrastructure nobody wants to build. Without a provider, each protocol needs its own indexer, accounting, anti-abuse rules, claim contract and claim page.
Merkl takes over that whole job. In traditional finance, a paying agent is the bank that pays a company's dividends and bond coupons to its holders. Merkl calls itself the paying agent of onchain finance, and has distributed $1.8B+ to 5M+ wallets, on 60+ chains, for 1000+ companies.
A protocol pays rewards to whoever holds its token at midnight on Friday. What happens?
People buy or borrow the token on Friday evening and sell it on Saturday morning, so the protocol pays for a few hours of holding. Rewarding balance × time removes the trick.
How Merkl works
This module is the core of the hour. It covers two words of vocabulary, one pipeline, one data structure and one formula.
Opportunity and campaign
An opportunity is an action on an asset in a protocol: "supply USDC on Aave v3 on Base", or "provide liquidity to the ETH/USDC pool on Uniswap v4". A campaign is a budget aimed at one opportunity, with a reward token, a start and end date, and rules. Several campaigns can stack on one opportunity, for instance when both the protocol and the chain pay for it. The APR shown on an opportunity is the sum of its campaigns.
Users browse opportunities in the Merkl App. Creators set up campaigns in Merkl Studio.
One campaign, start to finish
- CreatorPeople · protocol, chain, companybudget + rulesDistributionCreatorOnchain contracts · stores rules + budget
Create
A creator, say a stablecoin issuer, sets up a campaign in Merkl Studio: the opportunity, the reward token, the budget, the dates and the rules. The budget and the rules go onchain, into Merkl's DistributionCreator contract.
Why a Merkle tree
Merkl owes rewards to millions of addresses. Writing every balance onchain at every update would cost a fortune in gas. So the engine:
- puts each user's total earned so far, per reward token, in a leaf, and hashes it;
- hashes the leaf hashes in pairs, then those results in pairs, until one hash is left, the Merkle root;
- writes only the root onchain: 32 bytes, whatever the number of users.
To claim, a user sends their leaf plus the sibling hashes on the path to the root, called a Merkle proof. The Distributor contract recomputes the root from them. If it matches, the leaf was in the tree, and the contract pays the difference between the leaf's total and what that user has already claimed. With 5 million users, a proof is only 23 hashes long.
Think of the root as a fingerprint of the whole reward list. Change any amount and the root changes completely, so nobody can edit a balance after publishing, and anyone with the published reward file can rebuild the root and check it. Pick a user below to see their proof, then edit an amount.
0x81546b8e0x9bddb4af0xed77bc1a0x81ff06c30x1a80b0d30xb028858d0x3e1aa2e60xf5bea74e0x3baaa4bc0x298f7cfc0x54d4599f0xcf3918940xf10dcb180xb6ec3b2d0xf65ee16f- Root, stored onchain
0x81546b8e 0x9bddb4af0x81ff06c30xf5bea74e- Proof
0x3baaa4bc - Proof
0x1a80b0d3 0x298f7cfc0x54d4599f- Proof
0xed77bc1a 0xb028858d0xcf3918940xf10dcb180x3e1aa2e60xb6ec3b2d0xf65ee16f
Alice's proof is 3 hashes (dashed). The contract hashes Alice's leaf with the first one, the result with the second, then the third, and compares the final hash to the root. With 8 users a proof has 3 hashes; with 5,000,000 users, 23.
Edit any amount to see the root change.
The demo uses a short stand-in hash so it runs in your browser. Ethereum contracts use keccak-256; the mechanics are identical.
How much does a user earn?
On a standard campaign, called a variable distribution, the budget is fixed and split among everyone eligible in proportion to position size and time. The APR Merkl shows is:
APR = daily rewards × 365 ÷ eligible TVL
Assumes the TVL stays constant for the whole campaign and includes your deposit.
Other distribution types change who carries the risk when TVL moves:
| Type | How it pays | What users see |
|---|---|---|
| Variable | A fixed budget shared by everyone eligible | APR falls as more money joins |
| Fixed APR | A set rate per dollar deposited | APR stays flat; the creator's cost grows with TVL |
| Capped | Like variable, with a maximum APR | APR falls as TVL grows and never exceeds the cap |
| Target total APR | Tops up native yield to a target, say 8% | If Aave pays 6%, Merkl adds 2%; at 12%, it adds nothing |
For fixed, capped and target campaigns, any unspent budget goes back to the creator.
Rules a creator can add
- Whitelists and blacklists: exclude a team wallet or an exploiter, or reward only a known list of addresses.
- Boosts: multiply rewards for users who hold a given token or NFT, or who came through a referral.
- Eligibility checks: a minimum holding period, a loan's health factor, sanctions screening.
- Forwarding: send rewards to the right person when a position sits inside another contract, such as a vault.
- Other formats: points instead of tokens, private campaigns, raffles, and retroactive campaigns that reward past activity.
Behind all this, the engine supports more than 200 campaign types, roughly one per kind of position on each protocol it integrates.
Why trust an offchain engine?
- Open dataEvery reward file is published, so anyone can recompute any root.
- Independent checksDispute bots verify each root before it goes live. Merkl's reference bot is open source.
- Limited admin powerThe admin contract is held by a 4-of-6 multisig with independent signers, and it cannot change distributions.
- Fail closedIf the engine's totals disagree with onchain values, computation pauses until they match.
You earned rewards in the last 30 minutes, but the App says they aren't claimable yet. Why?
The engine computes about every 2 hours, the next root goes onchain within roughly 8 hours (4 to 12 depending on the chain), and then the 1 to 2 hour dispute window has to pass. The rewards aren't lost. They show up in a later root.
The products, and where you'd fit
Merkl serves two sides: the people who earn rewards and the teams who pay them. Each side has its own product, and both run on the same engine.
- For users
Merkl App
Find opportunities ranked by APR, TVL and daily rewards, see how to take part, track positions and rewards, and claim across campaigns.
app.merkl.xyz - For creators
Merkl Studio
Create campaigns from templates, simulate the APR a budget will buy before launch, launch campaigns in batches, and follow results.
studio.merkl.xyz - For integrators
Engine, API, contracts
Computes rewards, publishes roots and serves proofs. Wallets and apps use the API to show and claim Merkl rewards inside their own products. Developers start on the developer portal, then the docs.
developers.merkl.xyzdocs.merkl.xyz
What makes it interesting to build
- Merkl can distribute anything. It started with DeFi incentives, and the same engine now pays salaries (onchain payroll), dividends to holders of tokenized stocks and funds, gas rebates and airdrops. AI is bringing new cases too, and some are starting to be used. Each new case comes with its own rules, users and screens.
- Amounts are big integers. Every token has its own decimals, and dollar values depend on prices that move. Formatting, rounding and sorting by value are real work.
- Several clocks run at once. TVL refreshes about every 10 minutes, rewards about every 2 hours, and claimable balances every 8 hours or so, after a dispute window. The interface has to make "earned" and "claimable" clear without a lecture.
- APR is an estimate that moves. New deposits dilute it and the reward token's price changes it. Users want to know why it changed since yesterday.
- 60+ chains, one claim per chain. The same address lives on many chains, and the wallet has to switch network before each write.
- Writes are slow and cost money. A claim is a transaction with gas, a pending state, a confirmation and failure modes. On Ethereum mainnet, a small reward can be worth less than the gas to claim it.
- Two very different users. A DeFi user hunting yield in the App, and a growth lead at a protocol planning a six-figure budget in Studio, who needs to predict cost and results before launching.
Try it: 10 minutes, optional, no wallet needed
- Open app.merkl.xyz and browse the opportunities. Pick one lending opportunity and one liquidity opportunity.
- On each opportunity page, find the TVL, the APR and how it breaks down, the active campaigns and their reward tokens, and the instructions to take part.
- Note one thing a newcomer would find confusing, and how you'd fix it. Bring it to the interview.
- Skim the Studio guides to see the creator's side.
Check yourself
Eight questions. Pick an answer to see the explanation right away.
Glossary
- AMM
- Automated market maker. A pool that prices swaps with a formula from its token balances, instead of an order book.
- APR
- Annual percentage rate, without compounding. On Merkl: daily rewards × 365 ÷ eligible TVL, summed over an opportunity's campaigns.
- APY
- Annual percentage yield: APR with compounding included.
- Boost
- A multiplier on a user's rewards, for example for holding a given token or NFT, or for a referral.
- Bridge
- A service that moves tokens from one chain to another.
- Campaign
- A budget pointed at one opportunity, with a reward token, dates and rules. Created in Merkl Studio.
- Claim
- The transaction a user sends to the Distributor, with a Merkle proof, to receive the rewards they earned.
- CLAMM
- Concentrated liquidity AMM, such as Uniswap v3 and v4. LPs choose a price range; positions are NFTs.
- Collateral
- Assets deposited to back a loan. If their value falls too far, they can be liquidated.
- DEX
- Decentralized exchange: swaps run by smart contracts and pools, with no company holding user funds.
- Dispute period
- The 1 to 2 hours after a new root during which anyone can challenge it before it becomes claimable.
- Distributor
- Merkl's contract on each chain that stores the current root, holds reward tokens and pays claims.
- DistributionCreator
- Merkl's contract that stores each campaign's configuration and receives its budget.
- ERC-20
- The standard interface for fungible tokens on EVM chains (balanceOf, transfer, approve).
- EVM
- Ethereum Virtual Machine. Chains that run it (Base, Arbitrum, Optimism, Polygon...) share address formats and contract code.
- Gas
- The fee paid to the network for a transaction, in the chain's native currency.
- Health factor
- How safe a loan is. Below 1, the position can be liquidated.
- Impermanent loss
- The value an LP gives up, versus holding, when the prices of the pool's tokens move apart.
- In range
- A concentrated liquidity position whose price range contains the current price. Only in-range liquidity earns fees.
- Layer 2
- A cheaper, faster network that settles to Ethereum, such as Base, Arbitrum or Optimism.
- Liquidation
- When a loan gets too risky, anyone can repay part of it and take collateral at a discount.
- Liquidity provider (LP)
- Someone who deposits tokens into a pool so others can trade, in exchange for fees.
- LTV
- Loan-to-value: the maximum share of collateral value you can borrow.
- Merkle proof
- The sibling hashes on the path from a leaf to the root. Lets a contract verify one balance against the root.
- Merkle root
- The single hash at the top of a Merkle tree. Merkl writes it onchain to commit to every user's rewards at once.
- Opportunity
- An action on an asset in a protocol, such as supplying USDC on Aave v3 on Base. Campaigns stack on it.
- Paying agent
- In traditional finance, the bank that pays dividends and coupons to a security's holders. Merkl plays that role onchain.
- Points
- Offchain scores some campaigns distribute instead of tokens, often ahead of a future token launch.
- Protocol
- A set of smart contracts offering a financial service, like Aave (lending) or Uniswap (exchange).
- RPC
- The JSON-RPC endpoint of a blockchain node. Frontends read chain data and submit transactions through it.
- Smart contract
- A program deployed on a blockchain, with public code and state, callable by anyone.
- Stablecoin
- A token that tracks a currency, usually the US dollar: USDC, USDT, PYUSD.
- Token wrapper
- A token Merkl Studio can deploy around a reward token so the creator keeps custody of the budget instead of depositing it all upfront.
- TVL
- Total value locked: the dollar value deposited in a pool, vault or protocol.
- Utilization
- The share of a lending pool that is borrowed. Higher utilization pushes rates up.
- Vault
- A contract that takes deposits of one token and runs a strategy with them. Depositors get shares (ERC-4626).
- Wallet
- An app or device that holds a user's private keys and signs transactions.
- Whitelist / blacklist
- Lists of addresses a campaign rewards exclusively, or excludes.
Go further
- Merkl Developer Portaldevelopers.merkl.xyz · start here: API guides, how campaigns are built as payloads, chains and contracts, API keys
- Architecture and technical overviewMerkl docs · engine, roots, disputes, claims in detail
- Distribution typesMerkl docs · variable, fixed, capped and target APR with worked examples
- What is Merkl? A simple guide for everyoneMerkl blog · the product from a user's point of view
- Merkl Studio guidesHow a creator sets up a first campaign
- Distribute dividends onchain with MerklStudio guide · a use case beyond DeFi incentives
Prepared by Merkl's product team for candidates. The videos are third-party and were made between 2017 and 2021: the app screens in them look dated, and the mechanics they explain still apply.