Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Liquidation Bot

An automated program (a type of keeper) that monitors lending protocols for undercollateralized positions and executes liquidation transactions for profit.
Chainscore © 2026
definition
DEFINITION

What is a Liquidation Bot?

A technical definition of automated programs that execute liquidations in decentralized finance (DeFi).

A liquidation bot is an automated software program designed to monitor and execute liquidation events on decentralized finance (DeFi) lending protocols. It functions by continuously scanning blockchain data for undercollateralized loan positions—where the value of the borrowed assets exceeds a predefined threshold relative to the collateral—and then programmatically submitting the first valid transaction to liquidate that position, earning a liquidation bonus or fee as a reward. These bots are essential for maintaining protocol solvency by ensuring bad debt is promptly resolved, and they operate in a highly competitive, low-latency environment.

The core mechanism relies on the health factor or collateral ratio of a user's position. When market volatility causes the value of a borrower's collateral to fall or the debt to rise, this ratio dips below a protocol's liquidation threshold. Bots, which are typically run by sophisticated operators or liquidators, use dedicated nodes and optimized transaction strategies to be the first to detect this and submit a liquidation transaction. This often involves paying a portion of the debt in the borrowed asset to receive a discounted portion of the collateral, a process known as a liquidation auction or fixed discount sale on platforms like Aave and Compound.

Operating these bots requires significant technical infrastructure, including low-latency connections to blockchain nodes, efficient gas price bidding strategies to outpace competitors, and robust risk management to handle failed transactions and gas costs. The profitability is a function of the liquidation penalty, network congestion, and the fierce competition among other bots, making it a specialized domain of DeFi maximal extractable value (MEV). While crucial for protocol stability, the race between bots can also contribute to network congestion and high transaction fees during periods of market stress.

From a systemic perspective, liquidation bots are a critical component of DeFi's risk management framework. They provide the liquidity and incentive structure necessary to ensure that over-leveraged positions are automatically and efficiently closed without requiring manual intervention from the protocol itself. This automated enforcement of collateral requirements helps protect the protocol's solvency and the funds of other depositors, making the lending markets more resilient. However, their activity is also a key consideration in protocol design, influencing parameters like liquidation thresholds, bonus sizes, and auction mechanisms.

how-it-works
MECHANISM

How Does a Liquidation Bot Work?

A liquidation bot is an automated program that monitors decentralized finance (DeFi) protocols to identify and execute liquidations of undercollateralized loans, profiting from the associated liquidation penalty or fee.

A liquidation bot operates by continuously scanning the blockchain state of lending protocols like Aave or Compound. It tracks the health factor or collateralization ratio of user positions in real-time. When a position falls below the protocol's required threshold—typically due to asset price volatility—the bot's logic triggers. It then races other bots to be the first to submit a liquidation transaction, as most protocols offer the liquidation reward to the first valid execution. This process is often called liquidation racing or MEV (Maximal Extractable Value) extraction.

The core technical challenge involves latency optimization. Bots use several strategies to win the race: connecting to high-performance RPC (Remote Procedure Call) nodes, placing transactions with higher gas fees (priority fees), and even employing private mempool services like Flashbots to submit transactions without revealing them to the public network. Advanced bots may also simulate transactions locally before broadcasting to ensure they will be profitable after accounting for gas costs and the specific liquidation bonus offered by the protocol.

Upon a successful execution, the bot repays a portion of the user's outstanding debt using its own capital or flash loans and receives the corresponding collateral at a discounted rate. For example, if a protocol offers a 10% liquidation bonus, the bot repays $100 of debt to seize $110 worth of collateral. The bot then typically sells this collateral on a decentralized exchange (DEX) in the same transaction to realize a profit and repay any flash loan, completing the arbitrage cycle. This entire process often occurs within a single block.

The ecosystem surrounding these bots is complex, involving searchers (who run the bots), block builders who order transactions, and validators who produce blocks. While they provide a critical service by enforcing protocol solvency and removing bad debt, their activity can contribute to network congestion and high gas fees during periods of market volatility. The design and incentives of liquidation bots are a fundamental component of DeFi's risk management infrastructure.

key-features
MECHANISM

Key Features of Liquidation Bots

Liquidation bots are automated programs that monitor and execute liquidations on lending protocols and perpetual exchanges. Their core features are designed for speed, efficiency, and risk management.

01

Real-Time Monitoring

Bots continuously poll blockchain nodes and mempools to monitor collateralization ratios and funding rates. They track health factors on Aave and Compound, and margin ratios on perpetual DEXs like dYdX. This constant surveillance is the first line of defense, allowing bots to identify undercollateralized positions the instant they become eligible for liquidation.

02

Gas Optimization & Priority Fee Bidding

To win liquidation auctions, bots must submit transactions that are mined first. They employ sophisticated strategies:

  • Dynamic Gas Estimation: Calculating optimal gas prices based on network congestion.
  • Priority Fee Bidding: Outbidding competitors by attaching higher fees to their transactions.
  • Bundle Building: Submitting transactions in bundles via services like Flashbots to avoid public mempool frontrunning.
03

Risk & Profitability Calculation

Before executing, bots perform an on-chain simulation to assess the liquidation's viability. They calculate:

  • Liquidation Bonus: The discount (e.g., 5-15%) received on the seized collateral.
  • Gas Cost: The expected cost of the transaction.
  • Net Profit: Bonus Value - Gas Cost. Bots only proceed if this value is positive and exceeds their minimum profitability threshold, managing MEV (Maximal Extractable Value) capture risk.
04

Atomic Execution

Liquidations are executed in a single, atomic transaction to eliminate execution risk. This transaction bundle typically includes:

  • Repaying the borrowed debt.
  • Seizing the discounted collateral.
  • Immediately swapping the seized assets (e.g., via a flash loan or DEX aggregation) to repay the initial loan and realize profit. If any step fails, the entire transaction reverts, protecting the bot's capital.
05

Cross-Protocol Arbitrage

Advanced bots operate across multiple protocols to capture cross-protocol arbitrage. For example, a position may become liquidatable on Compound before Aave due to slight differences in oracle prices or health factor calculations. Bots monitor these discrepancies to be the first to liquidate wherever the opportunity arises, increasing their total addressable market.

06

Infrastructure Redundancy

To ensure maximum uptime and reliability, professional bot operations deploy redundant infrastructure:

  • Multiple RPC Nodes: Connections to several node providers (Alchemy, Infura, private nodes) to avoid single points of failure.
  • Geographic Distribution: Servers in multiple regions to reduce latency.
  • Fallback Mechanisms: Automated failover systems that switch providers if latency spikes or errors occur.
ecosystem-usage
LIQUIDATION BOT

Protocols & Ecosystem Usage

A liquidation bot is an automated program that monitors and executes liquidation transactions on lending and borrowing protocols to capture associated fees or penalties.

01

Core Function

A liquidation bot's primary function is to monitor the health factor or collateralization ratio of user positions on DeFi protocols like Aave, Compound, and MakerDAO. When a position falls below the required threshold, the bot automatically submits a transaction to liquidate it, repaying the borrower's debt in exchange for their collateral at a discount, known as the liquidation bonus.

02

Key Components & Strategy

Effective bots require several components:

  • Monitoring: Continuously scans the blockchain or uses protocol events for undercollateralized positions.
  • Transaction Building: Constructs the precise calldata for the liquidation function call.
  • Gas Optimization: Uses techniques like gas bidding and private mempools (e.g., Flashbots) to win liquidation auctions.
  • Risk Management: Calculates profitability after gas costs and slippage.

Strategies often involve liquidation cascades, where one liquidation triggers others.

03

Economic Incentives & Risks

Bots are driven by the liquidation incentive, a discount (e.g., 5-15%) on the seized collateral. This creates a competitive, MEV (Maximal Extractable Value)-intensive environment.

Risks include:

  • Gas Wars: High network congestion can make transactions unprofitable.
  • Slippage: Price volatility between transaction simulation and execution.
  • Smart Contract Risk: Bugs in the bot's own code or the underlying protocol.
  • Regulatory Scrutiny: The automated nature may attract legal attention in some jurisdictions.
04

Examples & Ecosystem Tools

Liquidation bots are a subset of DeFi MEV. Common examples and tools include:

  • Keeper Networks: Like Keep3r Network or Gelato Network, which automate and reward keepers for executing jobs.
  • MEV Bots: Many generalized MEV searchers run liquidation strategies.
  • Monitoring Dashboards: Services like DeFi Saver or Instadapp offer liquidation protection for users, often powered by similar bot logic.
  • Flash Loans: Bots frequently use flash loans from protocols like Balancer or Uniswap to fund large liquidations without upfront capital.
05

Impact on Protocol Health

Liquidation bots are critical infrastructure for DeFi lending markets. Their presence ensures:

  • System Solvency: Bad debt is quickly cleared, protecting lenders.
  • Market Efficiency: Collateral is rapidly recapitalized and returned to the market.
  • Price Stability: By enforcing collateral requirements, they mitigate the risk of death spirals during market crashes.

Without efficient bots, protocols would carry more systemic risk, potentially requiring larger safety funds or more conservative risk parameters.

economic-incentives
LIQUIDATION BOT

Economic Incentives & Profit Model

An automated program designed to profit from liquidations in decentralized finance (DeFi) by executing transactions faster than other network participants.

A liquidation bot is a specialized, automated software agent that monitors blockchain networks for undercollateralized positions in lending protocols like Aave or Compound and executes liquidation transactions to claim a reward. These bots compete in a race against time and other bots, as the first valid transaction to complete the liquidation earns a liquidation bonus or penalty fee, typically a percentage of the seized collateral. Their operation is a critical, profit-driven component of DeFi's risk management, ensuring protocol solvency by swiftly closing risky loans.

The core profit model for a liquidation bot hinges on maximal extractable value (MEV) strategies, primarily arbitrage and liquidations. Bots generate revenue by identifying and capitalizing on these profitable opportunities faster than anyone else. To win the transaction race, operators employ sophisticated techniques like gas price bidding wars, private transaction pools (e.g., Flashbots), and optimized smart contract code. Their profitability is a direct function of capital efficiency, transaction speed, and the ability to accurately model gas costs and network congestion.

Running a successful bot involves significant technical and financial resources. Developers must maintain robust node infrastructure for low-latency blockchain data, write efficient smart contract logic for the liquidation call, and manage gas optimization strategies. Furthermore, they require substantial capital to front the gas costs for transactions and, in some protocols, to temporarily cover the debt of the position being liquidated. This creates a high barrier to entry and a competitive landscape dominated by professional operators.

The economic activity of liquidation bots has profound effects on the broader network. While they provide the essential service of enforcing loan health, their competition for profitable transactions drives up gas prices during periods of market volatility, increasing costs for all network users. This interplay exemplifies the complex incentive structures within DeFi, where private profit-seeking behavior aligns with public protocol safety but can also contribute to network congestion and heightened expenses for regular participants.

security-considerations
LIQUIDATION BOT

Security & Systemic Considerations

Liquidation bots are automated programs that monitor and execute liquidation transactions on lending protocols, playing a critical role in maintaining protocol solvency and creating a competitive market for risk.

01

Core Function & Purpose

A liquidation bot is an automated program that continuously monitors on-chain lending protocols (like Aave or Compound) for undercollateralized positions. Its primary function is to repay a borrower's debt in exchange for their collateral at a discount, ensuring the protocol remains solvent. This process is essential for risk management, as it protects the protocol and its lenders from bad debt by closing risky positions before they become insolvent.

02

Mechanics of Execution

The bot's operation follows a precise sequence:

  • Monitoring: Scans the mempool and blockchain state for positions where the collateralization ratio falls below the liquidation threshold.
  • Bidding: When a position is eligible, the bot submits a transaction to repay part or all of the debt.
  • Seizure: In return, the bot receives the user's collateral, typically at a liquidation bonus (e.g., 5-10% discount).
  • Profit Realization: The bot sells the seized collateral on the open market, aiming to profit from the discount after accounting for gas fees and slippage.
03

Systemic Risks & Considerations

While vital for protocol health, liquidation bots introduce systemic considerations:

  • Network Congestion: During market crashes, a "liquidation cascade" can occur, where mass liquidations spike gas prices and congest the network.
  • Centralization Risk: The profitability of liquidation is often dominated by a few sophisticated, well-capitalized operators, creating a potential point of failure.
  • Oracle Manipulation: Bots rely on price oracles; attacks or delays in price feeds can lead to unfair liquidations or missed opportunities.
  • MEV Extraction: Liquidations are a prime source of Maximal Extractable Value (MEV), where bots compete via priority gas auctions, often passing high costs to end-users.
04

Bot Strategies & Competition

The field is highly competitive, leading to advanced strategies:

  • Mempool Sniping: Bots monitor the public mempool for pending transactions that will trigger a liquidation, attempting to front-run them.
  • Private Order Flow: Sophisticated operators use services like Flashbots to submit transactions via private relays to avoid public sniping.
  • Gas Optimization: Code is optimized for execution speed and gas efficiency to win auctions where profit margins are slim.
  • Cross-Protocol Monitoring: Bots often monitor multiple protocols simultaneously to maximize opportunity coverage.
05

Examples & Protocol Design

Protocols design specific mechanisms for liquidations that bots must adapt to:

  • Fixed Discount (Compound, Aave): A set bonus is offered to the first liquidator.
  • Dutch Auction (MakerDAO): The collateral discount starts high and decreases over time in an auction.
  • Keeper Networks (Maker's Auction Keepers): A designated network of bots is incentivized to perform liquidations.
  • Health Factor: The universal metric bots track, calculated as (Collateral Value) / (Borrowed Value). A health factor below 1.0 triggers liquidation eligibility.
06

Related Concepts

Understanding liquidation bots requires familiarity with adjacent concepts:

  • Liquidatable Debt: The total value of loans that have fallen below the safety threshold.
  • Liquidation Call: The specific on-chain function invoked to execute a liquidation.
  • Close Factor: The maximum percentage of a borrower's debt that can be repaid in a single liquidation transaction.
  • Bad Debt: The deficit that occurs if collateral value is insufficient to cover the loan after liquidation, a failure state the bots are designed to prevent.
AUTOMATION & EXECUTION

Liquidation Bot vs. Related Concepts

A comparison of automated agents that interact with lending protocols, highlighting their distinct purposes and operational characteristics.

Feature / PurposeLiquidation BotArbitrage BotMarket Maker BotKeeper Network

Primary Objective

Trigger and execute liquidations for profit

Exploit price differences across markets

Provide liquidity and earn fees

Execute predefined on-chain tasks for rewards

Protocol Interaction

Lending/borrowing protocols (e.g., Aave, Compound)

DEXs, CEXs, and oracles

Automated Market Maker (AMM) pools

Any protocol with a keeper/automation job

Revenue Source

Liquidation penalty / bonus

Price delta between venues

Spread and trading fees

Fixed reward or gas reimbursement

Key Risk

Gas auction wars, failed execution

Slippage, front-running, oracle lag

Impermanent loss, inventory risk

Unprofitable execution, reward < gas cost

Execution Speed

< 1 sec (time-sensitive)

< 1 sec (time-sensitive)

Continuous

Variable (depends on job)

Capital Requirement

High (to cover gas & collateral)

High (for arbitrage size)

High (for liquidity provision)

Low to None (often just gas)

Automation Level

Fully automated, monitors health factors

Fully automated, monitors prices

Fully automated, manages inventory

Semi-automated, responds to on-chain conditions

LIQUIDATION BOTS

Common Misconceptions

Liquidation bots are automated programs that monitor blockchain networks for undercollateralized positions to liquidate, but their role is often misunderstood. This section clarifies their function, economic incentives, and relationship with the broader DeFi ecosystem.

Liquidation bots are not inherently harmful; they are a critical, automated component of DeFi's risk management infrastructure. By promptly closing undercollateralized positions, they protect the solvency of lending protocols like Aave and Compound, ensuring lenders are repaid. Their automated, competitive nature is designed to enforce the terms of a smart contract loan agreement, not to target individual users. The negative perception often stems from users experiencing liquidation, but this is a consequence of market volatility and insufficient collateral, not malicious bot behavior. These bots provide the essential service of maintaining protocol health by acting as the first line of defense against bad debt.

LIQUIDATION BOT

Frequently Asked Questions (FAQ)

A liquidation bot is an automated program that monitors blockchain networks for undercollateralized positions and executes liquidations for profit. This FAQ addresses common technical and operational questions about these critical DeFi agents.

A liquidation bot is an automated software agent that monitors lending protocols like Aave or Compound for undercollateralized positions and executes liquidations to earn a reward. It works by continuously querying protocol smart contracts via a node to check if a user's health factor or collateral ratio has fallen below the required threshold. When a qualifying position is detected, the bot races other bots to be the first to submit a liquidation transaction, paying a gas fee to prioritize its transaction in the mempool. If successful, it repays a portion of the user's debt and seizes a corresponding amount of collateral, profiting from the liquidation bonus (e.g., 5-10%) offered by the protocol.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Liquidation Bot: Definition & How It Works in DeFi | ChainScore Glossary