inSOLvent v0.1 // kamino liquidations on solana
[kamino]

How liquidations work on Kamino

┤ man explanation ├

When a loan goes under

inSOLvent follows every liquidation on Kamino Lend, one of the biggest lending protocols on Solana. A liquidation is what happens when a loan stops being safe: someone else pays part of it back, and takes some of the borrower's deposit, plus a reward, in exchange.

This page explains how that works, without the jargon, then how every liquidation shown here was collected from the blockchain.

liquidations
318,810
loans liquidated
40,992
liquidators
293
of debt repaid
$242.17M

› since the first one, on oct 23, 2023, live from the index

┤ 1 borrowing on kamino ├

Kamino is a lending market that runs on its own, as a program on the Solana blockchain. No bank, no credit check: people deposit tokens, and can borrow other tokens against them.

It works like a pawn shop. What you deposit is your collateral, and you can only borrow less than it's worth. If you don't pay back, the shop keeps the collateral.

The difference: prices move all the time. If your collateral loses value, or your debt gains some, your loan can grow too big for what backs it. Kamino draws a line for each loan: how much debt its collateral can carry. Past that line, the loan can be liquidated.

Kamino doesn't sell anything itself. It lets anyone repay part of a loan that crossed the line, and pays them in collateral, at a discount. Bots watch every loan, all the time, to be the first to do it.

collateral
what the borrower deposited, e.g. SOL
debt
what they borrowed against it, e.g. USDC
the line
a share of the collateral's value; set per token, lower for riskier ones
obligation
Kamino's name for one loan account: its collateral and its debt together

┤ 2 a liquidation, step by step ├

A made-up loan, with round numbers. Real ones work the same way.

step 1 of 6

She deposits 100 SOL

Alice deposits 100 SOL into Kamino. At $200 a SOL, that's $20,000 of collateral: it earns interest, and it can back a loan.

SOL price
$200
collateral
$20,000
the line
$15,000
debt
$0
debt ÷ collateral
0.0%

┤ 3 who liquidates, and why ├

Liquidators are mostly bots. They watch every loan and every price, and the moment a loan crosses its line, they send a transaction to liquidate it. Only the first one gets it. And they rarely use their own money to repay the debt: they borrow it for the length of one transaction (flash loans, below).

Their pay is the bonus: the extra collateral they get on top of what they repaid. On Kamino it's a few percent, bigger the further a loan has drifted past its line, up to a cap per token. Kamino keeps a small part of it as a protocol fee.

For the borrower, that bonus is the penalty: what they lost on top of the debt that was repaid for them. They keep their loan, smaller, and what's left of their collateral.

Racing costs money: to land before the other bots, liquidators pay Solana a priority fee, a Jito tip, or both (the race, below). Each liquidation's detail shows what its transaction paid, and the profit left after it.

Most liquidations are tiny: leftovers of loans already liquidated, swept for fractions of a cent by a couple of bots. Anything repaying under $1,000 of debt is dust here: it's counted in the totals and in each liquidator's figures, but kept out of the feeds and the cascades, so it doesn't drown the real ones. Liquidators that only ever sweep dust aren't on the leaderboard.

When prices crash, liquidations come in waves. A cascade is 10 or more liquidations above dust, each less than 5 minutes after the one before.

The race: paying to land first

When a loan crosses its line, every bot sees it in the same instant, and only one of them can liquidate that slice. So they send their transaction every way they can, and the first to land wins. The others arrive too late and fail.

On Solana, each block is built by one validator, the leader of that moment, who picks the order of the transactions. There are two ways to get ahead in its line, and a bot usually uses both at once:

of all liquidations tipped Jito
6.8%
over the last 30 days
31.1%

through Solana itself

priority fee

Every transaction pays a base fee: 5,000 lamports (0.000005 SOL) per signature, half burned, half to the leader.

On top, it can offer a priority fee: a price for each unit of computing work it asks for. The leader schedules the best-paying transactions first, and keeps all of it.

Paid even when the transaction fails: a bot that loses the race this way still pays.

through Jito

jito tip

Most validators run Jito's version of the software. It takes bundles: transactions sent through Jito with a tip, a SOL transfer to one of Jito's tip accounts.

When a Jito validator is the leader, bundles are auctioned by tip, and run all or nothing.

A bundle that loses the race doesn't land at all, so it costs nothing.

Whichever copy lands first does the liquidation. If it came through the regular network, it paid a priority fee; through Jito, a tip, often with a priority fee too.

What the index sees is that winning transaction only. Its network fee is the base fee and the priority fee together, as Solana charges them; its Jito tip is the transfer to a tip account inside it. Each liquidation's detail shows both, in SOL and in dollars. The losers' attempts, and what they paid, aren't counted. 1 SOL is a billion lamports.

Flash loans: liquidating without the money

To liquidate, you repay part of someone's debt. A liquidator could keep piles of every token for that, but most don't: they borrow it for a moment, with a flash loan.

A flash loan is borrowed and paid back inside one transaction. Kamino lends it with no collateral at all, because it checks that the repayment is in the same transaction, for the same amount from the same reserve. If anything in between fails, the whole transaction fails, and the loan never happened.

So the debt repaid you see on this site is rarely the liquidator's own money. What it spends is the transaction's fees and the flash loan's small fee, which isn't taken out of the profits shown here.

one transaction, in order

  1. 1Flash-borrow the debt token, say USDC, from a Kamino reserve.
  2. 2Liquidate: repay the loan's USDC debt with it, and receive its collateral, say SOL, plus the bonus.
  3. 3Swap the SOL back to USDC, on an exchange.
  4. 4Repay the flash loan, plus its fee.
  5. 5What's left of the USDC is the liquidator's: the bonus, minus Kamino's cut, the swap's cost and the fees.

┤ 4 where the data comes from ├

No third-party dataset, no Kamino API. Everything here is rebuilt from the chain itself: the full history of Kamino Lend's program, over 90 million transactions, of which about one in 300 is a liquidation.

  1. 01
    solana

    mainnet, where every Kamino Lend transaction is public and permanent

  2. 02
    helius

    its API, queried for every transaction of Kamino Lend

  3. 03
    indexer

    archives each transaction, then reads its logs for liquidations

  4. 04
    database

    every liquidation, with the loan as it stood just before

  5. 05
    insolvent_

    all of them in memory, checked for new ones every few seconds

Fetching

We query Helius' API for every transaction of Kamino Lend's program (KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD) with getTransactionsForAddress, from the program's first transaction to the latest. A transaction that can't be decoded stops the indexer rather than being skipped, so the history has no gaps.

Archiving, then reading

Transactions are stored compressed before anything is parsed, over 360 GB of them. Parsing is a separate pass over that archive, so a new measure, like the fees each liquidation paid, is a re-read away, not a re-download.

What the logs say

Kamino narrates each instruction in the transaction's logs. A liquidation's ends with pnl: Liquidator repaid … and withdrew … collateral with fees …; before it, refreshing the obligation logs the loan as it stood and the prices Kamino used. The indexer turns that into a liquidation, and follows deposits, borrows and repayments for the obligation timelines. Earlier program versions didn't log the pnl line, so the history starts in October 2023.

Pricing

Every dollar figure is at the prices Kamino itself used in that transaction, the oracle prices that decided the liquidation, never today's. Fees are paid in SOL, and converted at the SOL price the transaction logged, or that of the nearest liquidation in time.

Names and live data

Token names come from Helius' token metadata, market names from the markets' own on-chain accounts. The header follows Solana's latest slot over a websocket, and Kamino's deposits and borrows are read straight from its reserve accounts every minute.

The site

Powered by Rust and Datastar. The indexer and the server are written in Rust; the server holds every liquidation in memory and renders each page itself. Datastar keeps the pages live: the server pushes what changed as new liquidations arrive, with no JavaScript app in the browser.

┤ 5 the words used here ├

Every dollar amount uses the prices in the liquidation's own transaction.

in one liquidation

debt repaid
The part of the loan the liquidator paid back.
collateral seized
What was taken from the borrower's deposit in exchange: the debt repaid, plus the bonus.
bonus, or penalty
Collateral seized minus debt repaid. One amount, seen from two sides: the reward for liquidating, and what the borrower lost.
protocol fee
Kamino's cut of the bonus.
liquidator profit
The bonus minus Kamino's cut: what the liquidator kept. Rarely slightly negative, when what it received was worth a bit less than what it repaid.
network fee
What Solana charged the liquidation's transaction: the base fee, 5,000 lamports per signature, plus any priority fee.
priority fee
Extra paid to the validator building the block, per unit of computing work, to be scheduled ahead of others. Paid even if the transaction fails.
Jito tip
SOL sent to Jito's tip accounts with a bundle, to be placed first by a validator running Jito. A bundle that doesn't land pays nothing.
flash loan
A loan borrowed and repaid within one transaction, with no collateral: how most liquidators get the tokens to repay a debt. Its fee isn't taken out of the profits shown here.
tx fees
The network fee plus the Jito tip: what landing the liquidation cost. Shown on each liquidation, with the profit left after them; every other profit on the site is before fees.

who and what

liquidator
The wallet that sent the liquidation, almost always a bot.
obligation
One loan on Kamino, holding its collateral and its debt. One wallet can have several.
the line
How much debt an obligation's collateral can carry, as a share of its value. Kamino calls it the liquidation threshold.

grouping and filtering

episode
One obligation's liquidations, each less than an hour after the one before: one fall, in several bites.
cascade
A wave across all loans: 10 or more liquidations above dust, each less than 5 minutes after the one before.
dust
A liquidation repaying less than $1,000 of debt. Counted in the totals, left out of the feeds, the leaderboard and the cascades.