Liquidation Bot

Software that watches positions and closes the ones that fall below the threshold, for a fee.

Basically

A liquidation bot is software that watches loans in decentralised finance (DeFi). It closes a loan automatically when the assets backing it fall below the required value.

Key Takeaways

  • A liquidation bot is automated software that monitors DeFi lending positions and liquidates them when a borrower's health factor drops below 1. It earns a discount on the seized collateral, typically 5 to 15 percent depending on the asset and protocol.
  • Multiple bots competing for the same liquidation create MEV opportunities. Bots bid up transaction fees or use private relay channels to be included first, and research shows that roughly 74% of early Aave and Compound liquidations paid above-average gas fees.
  • Bot competition helps lending protocols close undercollateralised positions quickly. Fast closures protect depositors from bad debt and maintain overall protocol solvency.

What Is a Liquidation Bot?

A liquidation bot is a program that continuously monitors borrowing positions on lending protocols such as Aave, Compound, and MakerDAO. The bot submits a transaction to liquidate a position when the value of the borrower's collateral falls relative to their outstanding debt and pushes their health factor below 1. The bot receives a portion of the collateral at a discount in exchange, known as the liquidation bonus or liquidation incentive.

Liquidation bots play a key role in DeFi infrastructure. Without them, undercollateralised loans would remain open indefinitely, risking insolvency for the entire protocol. Lending protocols provide a financial incentive for third parties to close unhealthy positions, outsourcing risk management to a competitive market of bot operators, sometimes called keepers.

How It Works

A liquidation bot operates in a continuous loop: monitoring positions, detecting opportunities, and executing transactions. The core workflow follows a consistent pattern across most lending protocols:

Health Factor and Liquidation Thresholds

The health factor is a single number that summarises a position's safety. The health factor is calculated as:

Protocols typically allow partial liquidation when the health factor is between 0.95 and 1.0, often up to 50% of the collateral, and full liquidation when it drops below 0.95. The exact thresholds vary by protocol and collateral type.

The Liquidation Bonus

The liquidation bonus is the discount a bot receives on seized collateral, typically ranging from 5% to 15% on Aave depending on the asset's risk profile. Lower-risk assets like ETH and stablecoins carry smaller bonuses, while more volatile or illiquid assets carry larger ones. For example, a 5% bonus on a $10,000 liquidation means the bot pays $10,000 of debt but receives $10,500 worth of collateral.

Flash Loan Liquidations

Many liquidation bots use flash loans to execute liquidations without holding any capital upfront. The entire sequence happens atomically within a single transaction:

The entire transaction reverts if any step fails, meaning the bot risks only the gas cost of a failed transaction. The barrier to entry falls dramatically because operators do not need large capital reserves.

A Simplified Liquidation Contract

A flash loan liquidation contract follows a general pattern. The simplified pattern is:

Competitive Dynamics and MEV

Liquidation is one of the most competitive areas of MEV extraction. Every bot monitoring a protocol detects an opportunity simultaneously when an oracle price update makes a position liquidatable. The result is a race to be included first in the next block.

Priority Gas Auctions

Priority gas auctions (PGAs) drove competition in the early days of DeFi liquidation bots. Bots would submit the same liquidation transaction with progressively higher gas prices, bidding against each other for block inclusion. Research from 2021 found that roughly 74% of liquidations on Aave and Compound paid above-average transaction fees, confirming the intensity of this competition.

Modern MEV Infrastructure

Most competitive liquidation bots now bypass the public mempool entirely. They submit transaction bundles through private relay channels such as MEV-Share on Ethereum, Timeboost on Arbitrum, or similar mechanisms on other chains. Private submission avoids front-running by other bots that might copy the liquidation transaction from the mempool.

Some block builders run their own liquidation bots, giving them a structural advantage. They can include their liquidation transaction at the optimal position within the block they are constructing, immediately after the oracle update that triggers the opportunity.

Backrunning Oracle Updates

A common strategy is to backrun oracle price updates rather than front-run other liquidators. The bot monitors the mempool for pending oracle transactions, calculates which positions will become liquidatable once the new price is confirmed, and bundles its liquidation transaction to execute immediately after the oracle update. The approach captures opportunities at the earliest possible moment.

Infrastructure Requirements

A competitive liquidation bot requires significant infrastructure. The requirements include:

These requirements create a high barrier to entry. In practice, a small number of sophisticated operators capture the majority of liquidation revenue on major protocols.

Protocol Risk Management

Liquidation bots are the primary mechanism through which DeFi lending protocols manage credit risk. Bots ensure that positions are closed before the debt exceeds the collateral value when asset prices move sharply. Without this layer, protocols would accumulate bad debt during market downturns, threatening depositor funds.

Liquidation Cascades

Liquidation bots trigger liquidation cascades during severe market drops: selling seized collateral pushes prices lower, which triggers more liquidations. Cascades can amplify volatility, but they also rapidly de-risk the protocol and prevent worse outcomes. The speed of automated liquidation bots helps protocols survive events that would overwhelm manual intervention.

Keeper Networks

Some protocols formalise the liquidation bot role through keeper networks. These networks coordinate bot operators, distribute opportunities more evenly, and reduce the MEV waste from redundant gas spending. MakerDAO's keeper ecosystem is one of the longest-running examples, using a Dutch auction mechanism where collateral starts at a high price and decreases until a keeper bids.

Cross-Protocol Arbitrage

Advanced liquidation bots integrate with multiple protocols and DEXs, routing seized collateral through the most efficient swap path. Some bots combine liquidation with arbitrage: if the seized collateral is mispriced across venues, the bot captures both the liquidation bonus and the arbitrage spread in a single atomic transaction.

Why It Matters

Liquidation bots are essential infrastructure for DeFi lending. The security model of protocols like Aave and Compound depends entirely on external actors rationally liquidating undercollateralised positions. Bad debt accumulates and depositors bear the loss if bots fail or become unprofitable, for example when gas costs exceed the liquidation bonus on small positions.

The dynamic matters particularly for stablecoin lending. Protocols that issue collateral debt positions rely on liquidation bots to maintain their peg, because the stablecoin becomes undercollateralised if its collateral drops in value and is not promptly liquidated. For a deeper look at how stablecoins manage these risks, see the research article on stablecoin peg mechanisms compared.

Bitcoin Layer 2 networks take a different approach. Platforms like Spark focus on self-custodial architecture that minimises the need for complex liquidation mechanics by using a different security model. For more context on how Bitcoin-native approaches handle these challenges, see What Is Spark.

Unprofitable Small Positions

Positions may go unliquidated where the liquidation bonus does not cover gas costs, creating bad debt. The issue is sometimes called "dust risk" and becomes more acute during periods of high network congestion. Some protocols address this with insurance funds or backstop mechanisms to handle positions that bots ignore.

Smart Contract Risk

Liquidation bots interact with multiple protocols in a single transaction: the lending protocol, flash loan provider, and DEX. A bug in any of these contracts or an unexpected interaction between them can result in lost funds. Bot operators must audit their liquidation contracts carefully and use simulation before submitting live transactions.

Oracle Dependency

Liquidation bots depend on accurate oracle price feeds. A manipulated oracle may cause bots to execute illegitimate liquidations by seizing collateral that should not be liquidatable, or miss legitimate ones because the oracle reports a stale price. Both scenarios harm either borrowers or the protocol's solvency.

Centralisation Concerns

The high infrastructure costs of running competitive liquidation bots mean that a small number of operators capture most liquidation revenue. The concentration creates a systemic risk: liquidations stall if dominant bot operators go offline during a market crash. Keeper networks and protocol-operated backstop bots, such as Aave's own liquidation bot, aim to mitigate this risk by ensuring a baseline level of coverage.

The glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.

0

← All 1876 glossary terms