DeFi Liquidation Bots: How to Profit from Aave & Compound Liquidations
DeFi liquidation bots are among the most consistently profitable automated strategies in decentralized finance. Every time a borrower on Aave or Compound falls below their collateral threshold, a liquidation opportunity opens up — and bots race to capture it. With over $2.5 billion in historical liquidations across Aave and Compound alone, this is a massive and recurring market. In this guide, we break down exactly how DeFi liquidations work, how bots exploit them, and how platforms like JaredFromSubway give operators the infrastructure to compete in this high-speed arena.
What Are DeFi Liquidations and Why Do They Happen?
DeFi lending protocols like Aave and Compound allow users to borrow crypto assets by depositing collateral. Unlike traditional loans with credit checks, these protocols rely entirely on over-collateralization: borrowers must deposit more value than they borrow. If the value of a borrower's collateral drops (or their debt increases due to accrued interest), the position becomes undercollateralized and is eligible for liquidation.
Liquidation is the process by which a third party — anyone on the blockchain — repays part of the borrower's debt and receives a portion of the borrower's collateral at a discount as a reward. This mechanism is critical for protocol solvency. Without liquidations, bad debt would accumulate and threaten the entire lending pool. Protocols therefore incentivize liquidators with a bonus, making liquidation a profitable activity for anyone fast enough to execute it.
Liquidations are triggered by market movements. A sudden 10% drop in ETH price, for example, can push thousands of positions below their liquidation thresholds simultaneously. These cascading liquidation events create enormous profit opportunities for automated bots monitoring the protocols in real time. JaredFromSubway operators have historically captured significant value during these volatility spikes.
Health Factor Explained: LTV Ratio and Liquidation Threshold
The health factor is the single most important metric for liquidation bots to monitor. It represents the safety of a borrowing position and is calculated as:
The Loan-to-Value (LTV) ratio determines how much a user can borrow against their collateral. For example, if ETH has an LTV of 80%, depositing $10,000 worth of ETH allows borrowing up to $8,000. The liquidation threshold is always higher than the LTV — typically 82.5% for ETH on Aave. This buffer gives borrowers a margin before liquidation kicks in.
When the health factor drops below 1.0, the position becomes liquidatable. A health factor of 1.0 means the position is exactly at the liquidation threshold. Below 1.0, any liquidator can step in to repay a portion of the debt and claim collateral at a discount. The closer the health factor is to 1.0, the more at-risk the position is — and sophisticated bots begin pre-positioning for the liquidation before it even triggers.
Different assets have different liquidation thresholds. Stablecoins like USDC may have thresholds of 90% or higher, while volatile assets like smaller-cap tokens might have thresholds of 65-70%. Bots must track the specific parameters for every asset on every protocol to accurately predict which positions will become liquidatable next.
How Liquidation Bots Work
A liquidation bot continuously monitors all open borrowing positions on protocols like Aave and Compound. The core workflow follows three steps: monitor health factors, trigger the liquidation transaction when a position drops below threshold, and collect the liquidation bonus.
Step 1: Monitor Health Factors
The bot maintains a local database of all active borrowing positions. It subscribes to price oracle updates and recalculates health factors with every new block (or even within the mempool for pending price updates). Positions are sorted by health factor so the bot can instantly identify which ones are closest to liquidation. Advanced bots also simulate future price movements to predict liquidations before they happen.
Step 2: Trigger the Liquidation
When a position's health factor drops below 1.0, the bot calls the protocol's liquidation function. On Aave, this is the liquidationCall function, which takes the collateral asset, the debt asset, the borrower's address, the amount of debt to repay, and whether to receive the collateral as aTokens. The bot submits this transaction with optimal gas pricing — often through Flashbots bundles to avoid front-running by competing bots.
Step 3: Collect the Bonus
Upon successful liquidation, the bot receives the borrower's collateral at a discount. If the liquidation bonus is 5%, the bot repays $10,000 of debt but receives $10,500 worth of collateral. The $500 difference is the gross profit, from which gas costs and any builder bribes must be subtracted.
Aave Liquidation Mechanics: Close Factor and Bonuses
Aave's liquidation system is the most widely targeted by bots due to its large TVL and well-defined mechanics. The protocol uses a 50% close factor, meaning a liquidator can repay up to 50% of a borrower's outstanding debt in a single liquidation call. This design prevents the entire position from being liquidated at once, giving borrowers a chance to recover if the market rebounds.
The liquidation bonus varies by asset and ranges from 5% to 10% on Aave V3. Major assets like ETH and WBTC typically carry a 5% bonus, while more volatile or less liquid assets offer up to 10% to compensate liquidators for the added risk. These bonuses are configured by Aave governance and can change through on-chain proposals.
For example, consider a borrower who deposited 10 ETH (worth $30,000) and borrowed $20,000 in USDC. If ETH drops to $2,400, the collateral is now worth $24,000 with a liquidation threshold of 82.5%, giving a health factor of (24,000 x 0.825) / 20,000 = 0.99 — below 1.0. A liquidator can repay up to $10,000 of the USDC debt (50% close factor) and receive ETH collateral worth $10,500 (with a 5% bonus), netting a $500 gross profit.
Using Flash Loans for Liquidations
Flash loans have revolutionized the liquidation bot space by eliminating the need for upfront capital. A flash loan allows a bot to borrow any amount of tokens within a single transaction, as long as the loan is repaid before the transaction completes. This enables a powerful liquidation workflow:
- Borrow: Flash-borrow the debt asset (e.g., USDC) from Aave or another flash loan provider
- Liquidate: Call the liquidation function, repaying the borrower's debt with the flash-borrowed tokens
- Collect collateral: Receive the borrower's collateral (e.g., ETH) at a discount including the liquidation bonus
- Swap: Convert the received collateral back to the debt asset on a DEX like Uniswap
- Repay: Repay the flash loan plus the flash loan fee (typically 0.05-0.09%)
- Profit: Keep the remaining tokens as profit
The entire sequence executes atomically — if any step fails, the whole transaction reverts and the bot only loses the gas fee for the failed transaction. This makes flash loan liquidations essentially risk-free in terms of capital. The only costs are gas fees and the flash loan premium. JaredFromSubway's infrastructure optimizes this entire flow with custom smart contracts that minimize gas consumption and maximize execution speed.
MEV Competition in Liquidations
Liquidation MEV is one of the most competitive segments of the MEV ecosystem. With over $2.5 billion liquidated historically across Aave and Compound combined, the stakes are enormous. Multiple sophisticated bots monitor the same positions, and when a liquidation opportunity appears, they all race to capture it within the same block.
This competition has evolved through several phases. Early on, bots competed through gas price bidding — submitting liquidation transactions with increasingly high gas prices to get included first. This "gas war" approach wasted value on inflated transaction fees. The introduction of Flashbots and MEV-Share shifted competition to sealed-bid auctions, where bots submit transaction bundles with explicit payments to block builders.
Today, winning liquidation MEV requires more than just speed. Successful operators use latency-optimized infrastructure to detect liquidation opportunities milliseconds before competitors. They run simulations on every pending mempool transaction to predict which price oracle updates will trigger liquidations. They also build relationships with block builders for preferential bundle inclusion. This is exactly the type of infrastructure that JaredFromSubway provides to its operators — enterprise-grade mempool monitoring, optimized contract execution, and direct builder connections.
How JaredFromSubway's Infrastructure Applies to Liquidation Strategies
JaredFromSubway has built its reputation as the most profitable MEV operation on Ethereum, and the same infrastructure that powers sandwich attacks and arbitrage strategies translates directly to liquidation MEV. The platform offers several key advantages for liquidation bot operators:
- Real-time mempool monitoring: Detect pending oracle price updates before they confirm, giving you a head start on calculating which positions will become liquidatable
- Flashbots integration: Submit liquidation bundles through private channels with optimized builder bribes to maximize inclusion rate while minimizing costs
- Low-latency execution: Co-located infrastructure ensures your liquidation transactions reach block builders faster than competitors
- Custom smart contracts: Gas-optimized liquidation contracts that combine flash loans, liquidation calls, and DEX swaps in a single efficient transaction
- Multi-protocol support: Monitor and liquidate across Aave V2, Aave V3, Compound V2, Compound V3, and other lending protocols simultaneously
By leveraging JaredFromSubway's battle-tested MEV infrastructure, liquidation bot operators can focus on strategy optimization rather than building low-level infrastructure from scratch. The platform's proven track record on Ethereum demonstrates the reliability and performance that operators need to compete in the liquidation MEV arena.
Start Running Liquidation Strategies with JaredFromSubway
Access enterprise-grade MEV infrastructure for DeFi liquidations. Flash loan integration, real-time health factor monitoring, and optimized Flashbots execution — all ready to deploy.
Get Started NowBuilding a Basic Liquidation Bot: Architecture Overview
A production liquidation bot consists of several interconnected components. Here is the high-level architecture that successful operators use:
Data Layer
The foundation is an Ethereum node (Geth or Reth) with mempool access, connected to price oracle feeds. The bot indexes all active borrowing positions from Aave and Compound subgraphs or direct contract reads, storing them in a local database sorted by health factor. A websocket connection listens for new blocks and pending transactions that could affect health factors — particularly oracle price updates and large swaps on DEXs that feed into oracle calculations.
Simulation Engine
Before submitting any liquidation, the bot simulates the entire transaction locally using a forked EVM state. This simulation calculates the exact profit after gas costs, flash loan fees, DEX slippage, and builder bribes. Only profitable liquidations pass the simulation filter. The engine must handle edge cases: partial liquidations, multi-asset positions, and situations where the DEX swap after collecting collateral might suffer high slippage.
Execution Layer
The execution layer handles transaction construction and submission. For maximum competitiveness, it constructs Flashbots bundles containing the flash loan, liquidation call, and collateral swap in a single atomic transaction. The bundle includes an optimal builder bribe calculated from the expected profit margin. The MEV bot building guide covers the general principles of bundle construction in more detail.
Profitability: Gas Costs vs Liquidation Bonus Calculation
Understanding the economics of liquidation is essential for running a profitable bot. The profit equation for a single liquidation is straightforward:
Consider a concrete example on Aave V3: a position with $100,000 in ETH collateral and $80,000 in USDC debt becomes liquidatable. With a 50% close factor, you can repay up to $40,000 of debt. With a 5% liquidation bonus, you receive $42,000 worth of ETH collateral — a gross profit of $2,000.
From that $2,000 gross profit, subtract: gas costs (typically $20-100 for a complex liquidation transaction at normal gas prices), flash loan fee (0.05% of $40,000 = $20), and the builder bribe (which in competitive scenarios can be 80-90% of the remaining profit). In a highly competitive liquidation, your net profit might be $200-400 from a $2,000 gross opportunity.
Smaller liquidations — positions with only a few thousand dollars of debt — are often unprofitable after gas costs, especially during periods of high network congestion. Conversely, large liquidations during volatile market conditions can yield thousands of dollars in net profit per transaction. The most profitable operators focus on large positions during high-volatility events, where the liquidation bonus far exceeds all costs. Using an optimized platform like JaredFromSubway reduces overhead costs and increases the percentage of gross profit that operators retain. For complementary strategies, explore the arbitrage bot approach which pairs well with liquidation MEV.
Risks and Considerations
While flash loan liquidations are capital-efficient, they are not without risk. Failed transactions still cost gas — and during volatile periods when gas prices spike, failed liquidation attempts can accumulate losses. Smart contract risk is always present: interacting with lending protocols and DEXs exposes the bot to potential bugs or exploits. Price oracle manipulation attacks can also create false liquidation signals that trap bots into unprofitable transactions.
Operators should also consider protocol-specific risks. Aave governance can change liquidation parameters, bonuses, and close factors through on-chain votes. Compound's migration from V2 to V3 changed liquidation mechanics significantly. Staying current with protocol upgrades and governance proposals is essential for maintaining profitable liquidation operations. The JaredFromSubway MEV bot platform keeps operators informed of protocol changes that affect liquidation strategy.
Frequently Asked Questions
How much profit can a DeFi liquidation bot make?
Profitability varies widely based on market volatility, gas costs, and competition. During high-volatility events, a single liquidation can yield hundreds or thousands of dollars in profit from the liquidation bonus (typically 5-10% on Aave). However, gas costs and MEV competition reduce net margins. Consistent operators using flash loans and optimized infrastructure like JaredFromSubway can generate steady returns across market conditions.
Do I need capital to run a liquidation bot?
Not necessarily. Flash loans allow you to borrow the entire repayment amount within a single transaction, execute the liquidation, collect the collateral bonus, and repay the loan — all without upfront capital. You only need enough ETH to cover gas fees for the transaction. Learn more about this technique in our flash loans guide.
What is the difference between Aave and Compound liquidations?
Aave uses a health factor system where positions with a health factor below 1.0 become liquidatable, with a 50% close factor and liquidation bonuses of 5-10% depending on the asset. Compound uses a similar model but calculates shortfall based on the difference between borrowed value and collateral value multiplied by the collateral factor. Both protocols incentivize liquidators with a bonus on the seized collateral, though the exact mechanics and bonus amounts differ.
How does MEV competition affect liquidation bot profitability?
MEV competition is intense in the liquidation space. Multiple bots monitor the same positions and race to submit liquidation transactions first. This competition has shifted largely to Flashbots and MEV-Share, where bots submit bundles with builder bribes. The result is that a significant portion of the liquidation bonus goes to block builders rather than the liquidator. Using optimized infrastructure and private order flow, as JaredFromSubway provides, gives operators a meaningful competitive edge in capturing liquidation MEV.
Ready to Capture Liquidation MEV?
JaredFromSubway gives you the infrastructure to compete in DeFi liquidations — flash loan contracts, mempool monitoring, Flashbots integration, and multi-protocol support. Join the most profitable MEV operation on Ethereum.
Launch Your Liquidation Bot