---
id: SI0079
title: "Slot-cited chain answers"
url: https://carbium.sh/library/si/slot-cited-chain-answers
collection: AI and blockchain
category: RAG and embeddings
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Slot-cited chain answers

Each chain fact the model receives carries the slot it was read at, the commitment of the read and the block time of that slot. The model cites facts by number, and a reader rechecks any citation with minContextSlot.

## What a citation holds

A researcher who checks an answer from a language model needs more than the number in it. A bare supply figure cannot be checked later: supply changes between slots, and nothing says which state of the chain the model was shown. A citation fixes that by travelling with the value, so the reader can name the exact read behind a sentence.

| Part | Where it comes from | What it lets the reader do |
|---|---|---|
| Value | the result of the call | compare it with a fresh read |
| Context slot | `context.slot` in the response | name the state the node answered from |
| Commitment | the `commitment` the call asked for | know how settled that state was |
| Block time | `getBlockTime` for the context slot | place the read on a calendar in UTC |

The slot comes back in the `context` object of the account, balance and supply reads, next to `value`. Commitment is something you choose, so the code writes it down. The JSON-RPC server answers at finalized when a call names no commitment, while `@solana/kit` 8.6.0 fills in confirmed. The same call can therefore cite two different levels depending on the client, which is why the file passes `commitment` on every read and prints it on every line.

> A slot dates a read. It does not freeze the state: a later read of the same account at a later slot may differ, and that difference is normal.

## Building the context block

The file reads four facts at once. It takes the USDC mint's supply at confirmed and again at finalized, the mint account itself at confirmed, and the balance of the wrapped SOL address at confirmed. Each read goes through `Promise.allSettled`, so one failing call prints a message and the others still land. Node 24 runs the TypeScript directly and the only import is `@solana/kit`. Set `CARBIUM_KEY` first. `CARBIUM_RPC_URL` overrides the endpoint, which defaults to `https://services.carbium.sh`.

`main.ts` (run: `node main.ts`)

```ts
// SI0079 · Slot-cited chain answers
// https://carbium.sh/library/si/slot-cited-chain-answers
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

// Slot-cited chain answers: read facts with slot, commitment and block time, print a numbered context block, recheck one.
// Run: CARBIUM_KEY=... node main.ts [mint] [address]
import { address, createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";
import type { Slot } 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 MINT = address(process.argv[2] ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
const WALLET = address(process.argv[3] ?? "So11111111111111111111111111111111111111112");

type Commitment = "confirmed" | "finalized";
type Fact = { id: string; text: string; commitment: Commitment; slot: Slot };

async function supply(commitment: Commitment): Promise<Fact> {
  const { context, value } = await rpc.getTokenSupply(MINT, { commitment }).send();
  return { id: "supply", text: `mint supply ${value.uiAmountString}, decimals ${value.decimals}`, commitment, slot: context.slot };
}
async function mintAccount(commitment: Commitment): Promise<Fact> {
  const { context, value } = await rpc.getAccountInfo(MINT, { commitment, encoding: "base64" }).send();
  const size = value ? Buffer.from((value.data as unknown as [string, string])[0], "base64").length : 0;
  const text = value ? `mint account owner ${value.owner}, ${size} data bytes` : "mint account not found";
  return { id: "account", text, commitment, slot: context.slot };
}
async function balance(commitment: Commitment, minContextSlot?: Slot): Promise<Fact> {
  const { context, value } = await rpc.getBalance(WALLET, { commitment, minContextSlot }).send();
  return { id: "balance", text: `address balance ${value} lamports`, commitment, slot: context.slot };
}

const settled = await Promise.allSettled([supply("confirmed"), supply("finalized"), mintAccount("confirmed"), balance("confirmed")]);
const facts: Fact[] = [];
for (const r of settled) {
  if (r.status === "fulfilled") facts.push(r.value);
  else console.error("read failed:", String(r.reason).slice(0, 200));
}

const times = new Map<bigint, string>();
await Promise.all(
  [...new Set(facts.map((f) => f.slot))].map(async (slot) => {
    try {
      const t = await rpc.getBlockTime(slot).send();
      times.set(slot, t === null ? "unavailable" : new Date(Number(t) * 1000).toISOString());
    } catch {
      times.set(slot, "unavailable");
    }
  }),
);

console.log(
  [
    "Answer from the numbered context only.",
    "Put the number of the supporting fact in square brackets after every claim, such as [2].",
    "Copy a value as written in the context. Do not round it or recompute it.",
    "When two facts disagree, cite both and say which has the more settled commitment.",
    "When the context cannot answer, say so in one sentence and cite nothing.",
    ...facts.map((f, i) => `[${i + 1}] ${f.text} | slot ${f.slot} | ${f.commitment} | block time ${times.get(f.slot)}`),
  ].join("\n"),
);

const first = facts.find((f) => f.id === "balance");
if (first) {
  try {
    const again = await balance(first.commitment, first.slot);
    const same = again.text === first.text ? "value unchanged" : "value changed";
    console.log(`recheck: first slot ${first.slot}, again slot ${again.slot}, minContextSlot ${first.slot}, ${same}`);
  } catch (e) {
    console.error("recheck failed:", String(e).slice(0, 200));
  }
}
```

After the reads, the file asks `getBlockTime` once for each distinct slot. That call answers null when no timestamp is stored for a slot, and it can fail outright for a slot that was skipped, so both outcomes print `unavailable` and the line stays in the block. The result is a numbered list: the value, then `slot`, the commitment and the block time, in the same order on every line.

Since the October 2026 switch, finalized trails processed by 0 to 1 slots, so the two supply lines often show the same slot or neighbours, and because they are separate calls one can land a slot after the other. Read the slot on each line instead of assuming an order. The mint account read is a [`getAccountInfo`](https://carbium.sh/docs#rpc) call, which costs 10 cells.

All four reads come from separate calls, so they can carry different slots. The block prints each slot as read and does not pretend to one shared state. When a question needs several accounts at exactly one slot, read them in one `getMultipleAccounts` call, as [Live account RAG](https://carbium.sh/library/si/live-account-rag) does.

## Instructing the model to cite

The block opens with these rules, then the numbered facts:

1. Answer from the numbered context only.
2. Put the number of the supporting fact in square brackets after every claim, such as [2].
3. Copy a value as written in the context. Do not round it or recompute it.
4. When two facts disagree, cite both and say which has the more settled commitment.
5. When the context cannot answer, say so in one sentence and cite nothing.

A reader who sees [2] finds line 2 in the stored block and has its slot, commitment and block time. Keep that block next to the answer in your records. The model's reply alone is not enough to audit, because the chain no longer shows the state of an earlier slot.

Check the reply with plain code before showing it. Pull every `[n]` out of the text, refuse the answer when a number is larger than the count of facts, and refuse a reply with a numeric claim and no marker. A model can still attach a marker to the wrong sentence, so this check catches a missing or invented source and leaves wrong attribution to a human sample.

## Rechecking with minContextSlot

A recheck is a fresh read, answered from the node's current state. A past slot cannot be read again. What you can do is set a floor with `minContextSlot`: the node answers only when its own context slot is at least the one you give. Pass the slot from the citation and the reply comes from that slot or a later one, so the recheck cannot silently come from an older view.

After the context block, the file reads the wrapped SOL balance again at the same commitment with `minContextSlot` set to the cited slot. It prints both slots and says whether the balance changed. `getBalance` and `getAccountInfo` take the option. `getTokenSupply` takes a commitment only, so a supply citation is rechecked by reading the mint account with `getAccountInfo` and decoding its supply field.

| Recheck outcome | What it tells the reader |
|---|---|
| Same value, later or equal slot | the cited value still holds |
| Different value, later slot | the state moved after the cited slot, so cite both reads |
| Error -32016 | the node's context slot is below your floor, so retry after a short pause |

Do not lower the floor to make an error go away. The error is the check doing its job: it says the node you reached has not yet seen the slot you cited.

## Where it ends

- A citation records that the numbered fact was read at that slot and commitment; whether the model's sentence follows from it is checked separately.
- Past state cannot be fetched again. Keep the stored block as the record. Transaction history comes from `getSignaturesForAddress`, whose address index keeps up to 30 days. An empty page past that marks the index's age limit, and the address may still have older transactions.
- Block time is the cluster's timestamp for the slot in whole seconds. It places the read in time and does not time it to the millisecond.
- A confirmed read is settled enough for most answers. Cite finalized when the claim has to hold after the answer is published, and print both when the reader should see the gap.
- Facts read in separate calls carry separate slots. Reading several accounts at one slot takes a `getMultipleAccounts` call of at most 100 pubkeys below Pro.
- The file is read-only: no signing, no sending, no keys beyond the Carbium key.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| A citation names no commitment, and the reader cannot tell how settled the value was. | Pass `commitment` on every call and print it on every line. The client's default and the server's default differ, so leaving it out makes the citation ambiguous. |
| The model cites [5] when the block holds four facts. | Extract every `[n]` from the reply and refuse the answer when n is above the fact count. Ask again with the same block. |
| `getBlockTime` answers null or an error for a slot, and the line loses its time. | Print `unavailable` for the time and keep the fact. The slot and commitment still make the citation usable. |
| The recheck fails with -32016. | The node answered from a slot below `minContextSlot`. Retry after a short pause or on the next call; keep the floor at the cited slot. |
| The two supply lines show the same slot, or finalized shows a slot after confirmed. | Both are expected from separate calls close together. Cite the slot printed on each line, and do not assume an order between commitments. |

## Questions

### Which commitment should a citation use?

Use confirmed for a live answer and finalized for a claim that must hold afterwards. Whichever you pick, print it on the line, because the reader needs to know what was asked.

### Can I read the state at the cited slot again later?

No. The node answers from its current state. `minContextSlot` guarantees the answer is from the cited slot or later, so a changed value shows up in a read at a later slot, and the old state stays only in your stored block.

### Why print block time when the slot is already there?

A slot number means little to a reader outside the chain. The block time puts the read on a UTC calendar, so a research note can say when its data was read.

### Does a citation prove the model's answer is correct?

No. It shows which read supported a sentence and lets anyone recheck that read. Whether the sentence follows from the value is still a review step.

## Related

- [Consistent reads with minContextSlot](https://carbium.sh/library/howsolana/consistent-reads-with-mincontextslot) (How to use Solana, HS0029)
- [Live account RAG](https://carbium.sh/library/si/live-account-rag) (AI and blockchain, SI0011)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#endpoints](https://carbium.sh/docs#endpoints)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
