Guides

Liquidating Accounts

A guide for third-party liquidators on Project 0, covering account discovery, evaluation, and execution.

Liquidation is a core part of P0's security model, and it is open to anyone. This guide covers the practical aspects of running a liquidation operation.

Overview

Liquidators earn profit by repaying unhealthy borrowers' debts in exchange for seizing their collateral at a discount. There are two methods available:

MethodMin CapitalMax PremiumComplexity
Classic LiquidationRequires own P0 Account with collateral2.5%Lower
Receivership LiquidationJust SOL for gasUp to 10%Higher

We recommend receivership liquidation for most operators: higher profit potential, no capital requirements, and no slippage risk since unprofitable transactions can simply be aborted.

Step 1: Discover Unhealthy Accounts

Most liquidators maintain a running inventory of accounts above a minimum dollar threshold, along with real-time prices for all relevant assets. With a large number of accounts on P0 (500k+), this requires:

  • Account indexing. Fetch and cache all margin accounts using getProgramAccounts or a similar bulk query.
  • Price monitoring. Subscribe to oracle price updates for all active assets.
  • Health computation. Continuously recalculate Maintenance health for tracked accounts as prices change.

Use lending_account_pulse_health to get the risk engine's own assessment of an account's health. This uses the same oracles and logic as actual risk checks.

Step 2: Evaluate Profitability

Before liquidating, consider:

  • Oracle cranking costs. Switchboard oracles require a crank instruction before use. Pyth oracles are typically fresh.
  • Swap route quality. Check that a profitable route exists to swap seized collateral to the debt token (or your preferred holding currency).
  • Transaction costs. Gas, priority fees, and the flat SOL fee for receivership liquidation.
  • Competition. Other liquidators may be targeting the same account. Consider using Jito bundles for faster inclusion.

Step 3: Execute the Liquidation

Receivership Approach

ComputeBudgetProgram (set compute units + priority fee)
Start Liquidation
  Withdraw Asset A from the account
  Swap A to B via Jupiter
  Repay Liability B
End Liquidation

Key rules:

  • Only withdraw, repay, and compute budget instructions are allowed between start/end.
  • Account health must improve between start and end.
  • Profit is capped at the maximum fee (currently 10%).
  • Cannot open new positions or close existing ones.

Classic Approach

Crank Switchboard oracles (if needed)
lending_account_liquidate

After liquidation, rebalance your own account: withdraw the seized asset, swap to debt token, repay the assumed debt.

Accounts with Kamino Positions

If the target account has wrapped Kamino positions, remember to refresh all reserves and obligations involved before attempting to liquidate. Kamino positions use a different withdraw instruction and consuming CU is significant. It is recommended to handle the Kamino withdraw in a separate transaction from the liquidation instruction in most cases.

Tips for Operators

  • Be conservative with amounts. Start at 70-80% of the theoretically liquidatable amount. Prices may shift by the time your transaction lands.
  • Maintain asset buffers. Keeping small balances of common assets reduces the need to swap within every liquidation transaction.
  • Build a large LUT pool. Lookup Tables are essential for fitting liquidation + swap into Solana's transaction size limits.
  • Optimize for liquidity. Choose collateral/debt pairs where the swap route is deepest. SOL/LST and SOL/USDC are typically the most liquid.
  • Monitor gas market. During volatile periods, priority fees spike and competition intensifies. Budget accordingly.

Liquidation is not inherently profitable. If no viable swap route exists between the seized collateral and the debt token, you can lose money. Receivership liquidation mitigates this: abort the transaction if it is not profitable.

For programmatic liquidation implementation, see the TypeScript SDK and the developer guides on GitHub.

On this page