services
Get a key

library / How to use Solana / HS0060

Recent slot check for lookup tables

One TypeScript file reads the SlotHashes sysvar, prints the newest and oldest slot it records, checks the processed, confirmed and finalized slots against it, and tells you whether the slot in your create-table instruction passes.

By Carbium · Versioned transactions and lookup tables · HS0060 · updated 2026-11-22

01

What the check is

Creating an address lookup table takes a recent slot in the instruction. The address lookup table program derives the table address from the authority and that slot, so the same pair always gives the same table. Before it creates anything, the program looks the slot up in the SlotHashes sysvar. When the slot is not listed there, the instruction fails with <slot> is not a recent slot and no table is made.

SlotHashes is an account at SysvarS1otHashes111111111111111111111111111. It holds up to 512 entries, newest first. The data starts with a little-endian u64 count, followed by 40-byte entries: an 8-byte slot and the 32-byte hash of that slot. At about 200 ms a slot, 512 entries cover roughly the last 100 seconds of the chain.

$The slot is chosen when you build the transaction and tested when the cluster runs it. The failure comes from the gap between those two moments, or from a slot that never had an entry.
02

Why a good-looking slot fails

A slot that looks current can still be absent from the list. Four causes cover almost every report of this error.

  • Too old. The slot is more than 512 recorded slots behind the tip. A slot saved in a config file, copied from a tutorial, or kept from a transaction that was built offline and sent later ends up here.
  • Too new. The sysvar lists slots up to the one before the slot that runs the transaction. The slot getSlot returns at processed is the newest the node has, and a sysvar read at the same moment often does not list it yet.
  • Skipped. A slot whose leader produced no block has no entry, so some numbers inside the range are absent. A slot seen at processed can also belong to a fork the cluster later drops.
  • Stale in the client. A retry that reuses the slot from the first attempt, a signing service holding a transaction built minutes ago, or a cached value in a wallet adapter all send an old number.

The first cause shows up as a failure that appears after a delay, and the second as a failure on a slot you read a moment ago. The skipped case is the only one a delay does not explain, which is why it helps to see the whole list instead of guessing.

03

Which slot to pass

Pick a slot the sysvar already lists, and send soon after reading it. The newest recorded slot is the best default: the first line of the output prints it, and it is in the list by definition. A getSlot value at any commitment, finalized included, can sit past the tip of the list on the same read, and the file flags it as not recorded yet. Read, build the instruction, send, and rebuild from a fresh read on every retry.

Verdict the file printsWhat it meansWhat to do
recorded, passesThe slot is in the list on this read.Build and send now.
newer than the newest recorded slotThe slot is at or past the tip of the list.Use the newest recorded slot from the first output line, or wait a slot or two and read again.
older than the oldest recorded slotThe slot fell out of the 512 entries.Take a fresh slot and rebuild the transaction.
inside the range but absentNo block was produced for that slot.Pick another slot from the recorded list.

The three getSlot values can tie, and finalized can print one slot above confirmed, so judge each against the list on its own. For how the three levels differ on a read, see Solana commitment levels.

04

The code

Install @solana/kit at 8.6.0, export CARBIUM_KEY and run the file with Node 24, which strips the types on load. The slot to check is an optional argument and defaults to the one from the failing query.

main.ts
// HS0060 · Recent slot check for lookup tables// https://carbium.sh/library/howsolana/recent-slot-check-for-lookup-tables// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { address, createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) {  console.error("Set CARBIUM_KEY to your Carbium API key.");  process.exit(1);}const url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";const rpc = createSolanaRpcFromTransport(  createDefaultRpcTransport({ url, headers: { "x-api-key": key } }),);const SLOT_HASHES = address("SysvarS1otHashes111111111111111111111111111");const levels = ["processed", "confirmed", "finalized"] as const;const candidate = BigInt(process.argv[2] ?? "157405384");const [[sysvar], slots] = await Promise.all([  Promise.allSettled([rpc.getAccountInfo(SLOT_HASHES, { commitment: "confirmed", encoding: "base64" }).send()]),  Promise.allSettled(levels.map((commitment) => rpc.getSlot({ commitment }).send())),]);const reply = sysvar.status === "fulfilled" ? sysvar.value : null;if (!reply?.value) {  console.error(`Could not read the SlotHashes sysvar: ${sysvar.status === "rejected" ? sysvar.reason : "no account"}`);  process.exit(1);}// Layout: u64 count, then count entries of (u64 slot, 32-byte hash), newest first.const raw = Buffer.from(reply.value.data[0], "base64");const count = Number(raw.readBigUInt64LE(0));if (count === 0) {  console.error("SlotHashes holds no entries.");  process.exit(1);}const slotAt = (i: number) => raw.readBigUInt64LE(8 + i * 40);const recorded = new Set(Array.from({ length: count }, (_, i) => slotAt(i)));const newest = slotAt(0);const oldest = slotAt(count - 1);function verdict(slot: bigint): string {  if (recorded.has(slot)) return "recorded, passes";  if (slot > newest) return `newer than the newest recorded slot by ${slot - newest}, not recorded yet`;  if (slot < oldest) return `older than the oldest recorded slot by ${oldest - slot}, too old`;  return "inside the range but absent, a skipped slot";}console.log(`SlotHashes read at slot ${reply.context.slot}: ${count} entries, newest ${newest}, oldest ${oldest}`);slots.forEach((r, i) => {  if (r.status === "fulfilled") console.log(`getSlot at ${levels[i].padEnd(9)} ${r.value}: ${verdict(r.value)}`);  else console.error(`getSlot at ${levels[i]} failed: ${r.reason}`);});console.log(`your slot ${candidate}: ${verdict(candidate)}`);

run: node main.ts [slot]

The file sends one getAccountInfo for the sysvar with base64 encoding at confirmed, and three getSlot calls, one for each commitment. Both groups run through Promise.allSettled, so a failed slot read is printed and the rest still run. The sysvar bytes are read with a little-endian u64 for the count and then every 40 bytes for a slot. The hashes are skipped, since the check only needs the slots.

The first output line gives the entry count and the newest and oldest slot, with the slot the read answered at. The next three lines give each commitment's slot and the verdict. The last line gives the verdict for your own slot. Run it twice a few seconds apart and the newest slot moves while the count stays at 512.

05

On Carbium

getAccountInfo is an account read at 10 cells, with 0.5 requests per second on Free, 15 on Dev, 50 on Business and 400 on Pro. getSlot is a cheap cached read at 1 cell, with 5, 30, 100 and 500 requests per second on the same plans. One run of the file makes one account read and three slot reads, 13 cells in all, which fits inside one burst on any plan.

If you loop the file on Free, space the runs out. Every key on the account draws on one budget.

To keep a transaction fresh between building and signing on a machine that is offline, see Blockhash relay for offline signers.

06

Where it ends

The file reports one node's view at one moment. A slot that passes now can still fail if the transaction lands more than 512 slots later, or if the node that runs it sees a different fork. Treat a pass as a reason to send at once.

It does not build the create-table instruction, derive the table address, sign or send anything. It only answers whether the slot would pass. The authority, the payer and the extend step are outside it.

A new table also needs time before it is usable in a transaction, and its later life, such as how long it lives and when it can be closed, is not read here.

07

When it goes wrong

what goes wrongwhat to do
The error appears right after a slot read from getSlot at processed.The newest slot is often not in the sysvar yet. Pass the newest recorded slot from the first output line, and send at once.
The instruction worked when built and fails after a delay.The slot left the 512 entries, about 100 seconds at the current slot time. Rebuild with a fresh slot before every send, retries included.
The file says the slot is inside the range but absent.No block was produced for that slot. Choose another slot from the recorded list.
getAccountInfo answers 429 with a retry-after hint.Wait the hinted seconds and run once more. One account read per transaction build is enough.
The file stops with Set CARBIUM_KEY to your Carbium API key.Export CARBIUM_KEY in the shell that runs node main.ts. The file reads it from the environment and never prints it.
08

Questions

How many slots back can I go?

The sysvar holds up to 512 entries, and the file prints the count and the oldest slot it found. At about 200 ms a slot that is roughly 100 seconds.

Which slot should I pass to the create-table instruction?

The newest recorded slot, which the first output line prints. Any recorded slot passes, while a finalized slot read from getSlot can sit past the tip of the list and show up as not recorded yet.

Why can preflight simulation reject a slot that would land fine a slot later?

Preflight checks the slot against the bank it simulates on, and that bank can sit a slot or two behind the tip you just read. A slot past that bank's list is rejected, even though the same slot is listed by the time the transaction lands.

Why does the same slot always give the same table address?

The address comes from the authority and the slot. Reusing both points at the address you already made, so a second table needs a different slot.