Nitride.xyz
Use case · Updated November 17, 2026

Shreds for liquidation bots

Nitride.xyz team

Liquidation bots compete to repay an unhealthy loan before anyone else and collect the protocol's bonus. Shreds help by showing oracle price updates and rival liquidation attempts while the leader is still broadcasting its block, ahead of RPC confirmation. You still need position state from your own node or RPC, and a way to land transactions.

What does a liquidation bot need to know?#

Lending markets and perpetuals venues on Solana let anyone close out a position whose collateral no longer covers its debt, and they pay a bonus for doing it. The first valid liquidation of a position takes it; later attempts against the same position fail and still pay fees.

A liquidation bot keeps three things current:

  1. Positions. The account state of every obligation or margin account on the markets it covers: deposits, borrows, and the parameters that set the liquidation threshold.
  2. Prices. The oracle accounts each market reads. A position becomes liquidatable when a price moves, far more often than when the borrower acts.
  3. Competition. Which positions other bots are already going after.

The bot recomputes health whenever an input changes and sends a liquidation when a position crosses the line. The data problem is noticing that change soon enough. That makes it a cousin of arbitrage on Solana, which reacts to price gaps between venues rather than to loan health.

What do shreds show a liquidator before RPC does?#

On Solana, oracle prices change because a transaction writes them. That transaction travels in the leader's shreds like any other, and that is the main reason a liquidator reads shreds.

  • Oracle updates, with the price inside. Many oracle designs pass the new price, or a signed price message, in the update instruction's data. Your decoder parses it with the oracle's documented layout and you re-price affected positions before the block confirms. Where the instruction does not carry a usable price, the shred still tells you which price account is about to change, and you wait for its new state.
  • Rival liquidations. A liquidate instruction aimed at a position you were about to hit tells you to stand down and save the fee.
  • Borrower activity. Repayments, deposits and withdrawals by watched obligations change their health in both directions.
  • Large swaps on AMMs, for markets whose prices depend on them.

Shreds do not carry account state after execution, whether a transaction succeeded, or the result of the protocol's own staleness checks on a price. Position state comes from your own node, a Geyser plugin, or RPC subscriptions such as accountSubscribe, and shreds tell you when to look again.

Ultra or Standard for a liquidation bot?#

For contested liquidations on large lending markets, choose Ultra Low Latency Shreds. It costs $200 for one destination for 30 days and travels directly from our server to yours with no relay hop, so it arrives sooner than Standard. If the bots you compete with on those markets read shreds, a contested position goes to whoever acts soonest.

Be honest about the other half of the race. Seeing the price is only the trigger. How you build, prioritise and land the liquidation decides who wins, and Nitride.xyz sells none of that: we deliver the inbound shred feed, not transaction submission, bundles or block space.

Standard Shreds, at $100 for one destination for 30 days through our relay, fits keepers on smaller markets with thin competition, desks that watch their own borrowing positions and want an early warning, and teams studying liquidation behaviour before they commit capital. The shreds are identical on both plans; only the path differs. We publish no latency figure, so measure the gap on your own server. See Ultra Low Latency vs Standard Shreds for the full trade-off.

A receiver sketch in Node.js#

This sketch keeps shreds in per-slot buckets, using the slot (a little-endian u64 at offset 65, 8 bytes). When a newer slot starts, it decodes slots that are two behind, then looks for oracle updates on price accounts you track and for liquidations on the markets you cover. The decoder and the health maths are yours.

liquidation-watch.mjs
1// node liquidation-watch.mjs
2import dgram from "node:dgram";
3
4const PORT = 9000;
5const HEADER = 83;
6const ORACLE_PROGRAMS = new Set([/* oracle program ids your markets use */]);
7const PRICE_ACCOUNTS = new Set([/* price accounts your markets read */]);
8const LENDING_PROGRAMS = new Set([/* markets you liquidate on */]);
9
10// Your decoder or an open-source one: FEC recovery, entries, transactions.
11// Returns [{ signature, keys: [static keys, base58], ixs: [{ programIndex, accounts, data }] }]
12function decodeSlot(packets) { throw new Error("plug in your decoder"); }
13function repriceFrom(slot, priceAccount, data) { /* parse with the oracle's layout, recheck health */ }
14function noteRival(slot, tx, ix) { /* stand down on positions another bot is taking */ }
15
16const buckets = new Map();
17let newest = 0n;
18let decodedThrough = 0n;
19
20function decodeUpTo(limit) {
21 for (const [slot, packets] of buckets) {
22 if (slot > limit) continue;
23 buckets.delete(slot);
24 for (const tx of decodeSlot(packets)) {
25 for (const ix of tx.ixs) {
26 const program = tx.keys[ix.programIndex];
27 if (ORACLE_PROGRAMS.has(program)) {
28 for (const a of ix.accounts) {
29 if (PRICE_ACCOUNTS.has(tx.keys[a])) repriceFrom(slot, tx.keys[a], ix.data);
30 }
31 } else if (LENDING_PROGRAMS.has(program)) {
32 noteRival(slot, tx, ix);
33 }
34 }
35 }
36 }
37 if (limit > decodedThrough) decodedThrough = limit;
38}
39
40const sock = dgram.createSocket({ type: "udp4", recvBufferSize: 16 * 1024 * 1024 });
41sock.on("message", (msg) => {
42 if (msg.length < HEADER) return;
43 const slot = msg.readBigUInt64LE(65);
44 if (slot <= decodedThrough) return; // late shred for a slot already decoded
45 if (!buckets.has(slot)) buckets.set(slot, []);
46 buckets.get(slot).push(msg);
47 if (slot > newest) {
48 newest = slot;
49 decodeUpTo(newest - 2n);
50 }
51});
52sock.bind(PORT, "0.0.0.0", () => console.log(`listening on udp://0.0.0.0:${PORT}`));

Two cautions before you build on it. First, a price account referenced through a lookup table is not among the static keys, so tx.keys[a] is undefined for it; keep your own copy of the tables your markets use and resolve those indexes. Second, decoding inside the message handler stalls the event loop, and a stalled loop lets the kernel drop packets. Production code receives in one thread and decodes in another, and decodes each FEC set as it completes rather than waiting for a slot to end.

The Node.js receiver docs cover the plain receive loop, and the Rust receiver page lists every header field. For how a pre-confirmation price differs from a confirmed one, see processed, confirmed and finalized.

What are the limits for liquidators?#

  • Updates can fail or vanish. Shreds include transactions that will fail, and a leader's block can be skipped or lose a fork. A price you acted on may never take effect, and your liquidation then fails and costs fees.
  • Loss hits during volatility. Big price moves bring heavy traffic and the most liquidations. Raw UDP has no retransmission, so a dropped shred that carried an oracle update is gone unless coding shreds from its FEC set recover it.
  • No state. You cannot compute health from shreds alone.
  • You decode. Nothing arrives parsed, and oracle and lending programs change their layouts on upgrades.
  • Delivery comes from Frankfurt only. Where your submission path sits is a separate question; measure both.

Next steps#

Why the feed runs from Frankfurt explains the location. Bots that liquidate often also run MEV searching on shreds strategies, and wallet-following bots are covered in copy trading from shreds. Every other workload is listed on the use cases hub.

Can shreds alone tell me a position is liquidatable?#

No. Shreds show the oracle update or borrower action that changes a position's health. You need the position's account state from your node or RPC to compute whether it crosses the threshold.

Does Nitride.xyz offer transaction submission or bundles for liquidations?#

No. Nitride.xyz delivers raw shreds to your server over UDP. How you send and land transactions is up to you.

Which plan fits a keeper on a small lending market?#

Standard Shreds is usually enough where few bots compete. Ultra is meant for contested markets, where skipping our relay hop can decide the race.

Can one destination feed several liquidation bots?#

Yes, if you fan the packets out on your own side. Each additional destination you want us to send to is a separate purchase.

Sources#