Build a liquidation keeper.

Connect your liquidation keeper to Solana account data, protocol checks and transaction delivery.

Read the whole position.

A Kamino Obligation contains the borrower’s deposits and borrows. Its health depends on the reserves, accrued interest, oracle prices and market configuration behind them.

Track lending positions, recheck the protocol’s rules, and submit a bounded repayment. This Kamino example connects your keeper to Solana account data and transaction infrastructure.

A candidate, before execution

Illustrative values. One collateral asset and one debt asset.

Collateral value
$10,000
Debt at a 100% borrow factor
$8,100
Liquidation threshold
80% × $10,000 = $8,000

$8,100 ≥ $8,000 Candidate for a fresh protocol check

Use the liquidation threshold.

The borrowing limit controls how much a user can borrow. The liquidation threshold determines when an existing position can be liquidated. They serve different checks.

Kamino adjusts debt with borrow factors and blends thresholds across collateral reserves. A simple debt-to-collateral ratio can miss those rules.

This example covers ordinary price-triggered liquidations. Elevation groups, auto-deleverage and fixed-term debt can change the applicable rules.

Inspect the liquidation engine

Recheck before every attempt.

Oracle updates, interest, a borrower's repayment or another keeper's liquidation can change the next valid action. Refresh the candidate before each attempt.

Your keeper’s state machine
  1. ObserveLoad Obligation, reserves, oracle dependencies and config.
  2. EvaluateRefresh the view. Recompute health and permitted pair.
  3. BoundApply protocol caps, available capital and minimum received.
  4. SimulateBuild refresh + liquidation instructions. Inspect errors.
  5. SubmitSign locally. Send through RPC or optional TPU Sender.
  6. VerifyCheck status, token balances and the updated Obligation.

Fresh check rejects the candidateReturn to watching. Do not repay.

Data missing, stale or disconnectedPause, reread the snapshot and evaluate again.

Submission outcome is unknownFollow the known signature before creating another attempt.

Supanode carries the data.

RPC reads account state and supports simulation and status queries. Optional Yellowstone gRPC streams account updates.

Your keeper owns the decision.

You decode Kamino accounts, track dependencies, refresh stale state, size the action, manage the signer and maintain the attempt log.

Kamino enforces the action.

The program validates the transaction against its current state. A local candidate and a successful simulation cannot reserve an opportunity.

Scope prices have their own validation and refresh flow. Read the oracle configuration used by each reserve; an observed DEX price is not a substitute for a price the program accepts.

One repayment has several bounds.

A keeper selects a debt asset to repay and collateral to receive. The position’s health is only the first gate.

Checks for a Kamino price-triggered liquidation
ConstraintWhat your keeper checks
Pair priorityThe lowest-threshold collateral and highest-borrow-factor debt take priority, with protocol-defined small-value exceptions.
Partial close factorRead the market’s current limit. Re-evaluate after each round; do not hardcode a universal percentage.
Collateral and value capsRespect available collateral, maximum liquidatable value and dust rules. Deposit-only collateral with LTV 0 cannot be seized.
Client capitalBound the repayment by available debt tokens. Reserve SOL for transaction fees and any sender tip.
Minimum receivedSet a protocol-aware minimum after inspecting the applicable bonus, fee and redemption conditions.

Available capital can be the tighter bound.

Illustrative continuation of the $8,100 debt example.

Assumed close factor
10%
Close-factor ceiling
$810
Available debt-token budget
$500

In this sample, repayment is at most $500 before any tighter collateral or protocol value limit.

Account for the liquidation bonus, its caps and any protocol share. Include funding costs and the cost of selling collateral when calculating the net result.

Pseudocode
snapshot = read_position_and_dependencies()
if incomplete_or_stale(snapshot): pause()
if not protocol_eligible(snapshot): watch()

pair = choose_protocol_permitted_pair(snapshot)
repay = bound_by_caps_and_available_capital(pair)
tx = build_refresh_and_liquidation(repay, min_receive)
if simulation_has_error(tx): recheck()

signed = sign_with_fresh_lifetime(tx)
signature = submit(signed)
status = follow_known_signature(signature)
if status.err: record_failure_and_refresh()
if required_confirmation(status):
    verify_tokens_and_position()

Conceptual keeper functions. Add an optional sender tip before signing.

Keep funding and execution distinct.

A self-funded keeper holds the debt token. If it must swap into that token first, confirm the funding swap and then recheck the position. A separate swap and liquidation are separate transactions.

Kamino’s builder assembles support and liquidation instructions. You still select the amount, minimum received, compute settings and accounts for the SDK version you use.

The official tutorial and current SDK use different state-time parameters. Pin and test the SDK version you use.

After simulation, sign with a valid transaction lifetime. Before another attempt, account for changes to the position and any previous submission.

Start with the positions you can maintain.

A bounded watchlist is a practical first implementation. Discovering every obligation in a market adds scanning, indexing and load management to your keeper.

Connect your keeper to Supanode RPC, optional account streams and transaction delivery.

Solana

RPC + WebSocket

STARTER · entry Bundle

Read selected Obligation accounts and their dependencies through RPC. Use WebSocket notifications where appropriate, and reread state after a gap. Measure your method-weight budget, reads and simulation/send traffic before selecting a tier.

For a focused account list and a measured workload.

  • 15 RPS · 5 TPS
  • 10 WebSocket connections
  • 100 subscriptions / connection · 1,000 total
  • No gRPC in this tier
From $40
/ 30 days

Request a free trial up to 24h; our team confirms availability and setup. Purchase with a Solana wallet and USDC portal balance.

Solana

RPC + WebSocket + gRPC

BUILD · broader discovery and updates

Add program-account discovery and a local index. Use filtered gRPC updates for the account set you actually track; keep RPC for snapshots and recovery.

  • 200 RPS budget; subscription/address quotas require a workload check
  • Published RPC/WebSocket/gRPC plan
  • Measure full-market load before selecting capacity
$159
/ 30 days

Request a free trial up to 24h; our team confirms availability and setup. Check subscription and watched-address limits.

Budget scans separately. Supanode documents getProgramAccounts at 30 RPS units per call against STARTER's nominal 15 RPS budget. Confirm admission rules and measure discovery load before choosing a plan.

Solana

TPU Sender

Optional · transaction delivery

Forward signed transactions through parallel delivery channels, including staked TPU connections with SWQoS. Use your RPC for reads, simulation, network confirmation and execution status.

  • 50 requests/s per client profile by default
  • Plus Solana network fees
  • No monthly subscription · trial on request

Use HTTP JSON-RPC with the issued API key. This client connection is separate from Sender's TPU/SWQoS delivery to validators.

Private HTTP minimum tip: 150,000 lamports per transaction. Budget any priority fees as well as network fees.

Explore TPU Sender

0.00015 SOL
minimum tip / transaction

Request an API key or a free trial up to 24h through Supanode on Telegram. Our team confirms trial availability and setup.

The starting stack uses RPC with optional account streams and delivery. Add Indexer or raw shreds when your keeper needs their data and can support the integration.

Make recovery part of the keeper.

The candidate can disappear at any stage. Record the reason, refresh the inputs and decide whether a new attempt is still valid.

Stale or missing prices

Pause the candidate. Check the configured oracle inputs, refresh requirements and reserve state. Do not substitute a convenient market quote.

Another actor changes the position

A borrower adds collateral or another keeper repays debt. Reread the Obligation and recalculate the permitted pair and amount.

Capital or simulation fails

Inspect balances, token accounts, minimum received, compute usage and program logs. Lower the amount or abandon the attempt when its constraints no longer fit.

The data stream disconnects

Mark the local view incomplete. Reconnect, reread account snapshots and validate the recovered interval before resuming decisions. Solana RPC provides 2 days of replay; gRPC provides 100 slots.

Submission times out

Query the known signature first. While its blockhash is valid, retry the same signed transaction under your retry policy. After expiry without success, recheck state before rebuilding.

The signature is returned, but execution fails

Require the intended confirmationStatus and err = null, then verify tokens and position state. Keep null statuses unresolved until a later check.

Connect and validate your keeper.

Begin with a measured RPC workload and a small, explicit set of positions. Expand discovery and streaming after the keeper can recover correctly.

RPC, WebSocket and gRPC

Bundle subscriptions start in the portal with a Solana wallet. RPC and WebSocket are included in every Bundle; gRPC starts at FOCUS. Request a free trial up to 24 hours from our team; availability and setup are confirmed separately.

Optional TPU Sender

Request an API key from Supanode on Telegram. Include your region and expected rate. Ask our team about a free trial up to 24 hours; availability and setup are confirmed separately. QUIK transport needs separate authorization and setup.

Keep the cost model explicit.

Infrastructure
Bundle subscription, plus your keeper’s compute and storage. Do not add gRPC twice when your Bundle already includes it.
Transaction attempts
Solana base and priority fees. Add an embedded tip only when using the sender path.
Protocol and swaps
Applicable protocol share of the bonus, funding/rebalance swap fees and slippage.
Working capital
Debt tokens to repay and collateral inventory after liquidation. Capital is separate from the infrastructure bill.

Questions before you build

What does my liquidation keeper implement?

Decode protocol accounts, select candidates and size each repayment against your available capital. Add signing, an attempt journal and recovery before enabling execution.

Can the same health check work for every lending protocol?

Each protocol defines its own accounts, oracle inputs, health math and liquidation instructions. Even within Kamino, market modes and configuration can change the action. This page covers the ordinary price-triggered path.

Do I need Indexer or ShredStream for this example?

Start with current account state through RPC and optional account streams. For Kamino position or oracle history, confirm a suitable historical dataset. A raw-shred path also needs your own receiver, decoder and protocol checks.

Does successful simulation guarantee the liquidation will land?

Simulation checks a transaction against a node’s current state. Prices, position health and available amounts can change before execution. Track confirmation and the program result separately.

Is the liquidation bonus the keeper’s profit?

Calculate the net result after reserve, group and solvency limits, any protocol share, network fees, sender tips, swaps and collateral price changes.

Build from the source.

Use the protocol mechanics and service references below to build and test your keeper.