Under the hood, yield farming works by depositing tokens into a DeFi smart contract, such as a lending market or a liquidity pool on a decentralized exchange, in exchange for a return that is usually quoted as an annual percentage yield. Farmers often receive a receipt token representing their deposit, which can then be redeposited elsewhere to stack additional rewards, a technique known as "restaking" or "auto-compounding."
Returns come from several sources at once: a share of trading fees paid by traders swapping through a pool, interest paid by borrowers on a lending market, and, on many platforms, bonus emissions of the protocol's own governance token. Early "DeFi Summer" farms in 2020, sparked by projects like Compound rewarding lenders and borrowers with COMP tokens, briefly advertised APYs in the hundreds or thousands of percent, almost entirely funded by token inflation rather than real economic activity. The market has since matured toward "real yield," where sustainable returns are backed by actual fee revenue and borrowing demand rather than speculative emissions.
Yield farming carries meaningful risk. A liquidity provider supplying two different assets to a pool can suffer impermanent loss if their prices diverge, sometimes outweighing the fees earned. Smart contracts can also contain bugs or be exploited, and unusually high advertised APYs are a common lure in rug pulls. Because of this, experienced farmers stick to audited, established protocols and diversify across pools rather than chasing the highest headline rate.