---
id: HS0003
title: "Solana commitment levels"
url: https://carbium.sh/library/howsolana/solana-commitment-levels
collection: How to use Solana
category: Confirmation and retries
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Solana commitment levels

One TypeScript file reads the current slot and an account balance at all three commitment levels, then prints the gaps from processed to confirmed and to finalized, so you can see what each level returns.

## What the three levels mean

Every Solana RPC read answers from one node's view of the chain. The commitment level says how far along a block must be before the node will answer from it. It travels as a parameter on the call, and it decides which block your answer comes from.

| Level | What the node has seen | Can it be undone |
|---|---|---|
| processed | The newest block this node has received and processed. Few or no votes may be behind it yet. | Yes. The block can sit on a fork the cluster later drops. |
| confirmed | A block that a supermajority of stake has voted for. | Very unlikely. Most applications treat it as settled for display. |
| finalized | A block the cluster has finalized and can no longer drop. On the current cluster it is reached about a slot after the tip. | No. |

The levels are ordered by what they guarantee. Finalized is never ahead of what the cluster has confirmed, and confirmed is never ahead of what this node has processed. Each read is its own call, so one read of the numbers can show them equal or briefly out of order. Each step up buys certainty and gives up freshness. Most bugs around commitment come from reading a value at one level and then acting on it as if it had come from another.

## The code

Install `@solana/kit` at 8.6.0, export `CARBIUM_KEY` and run the file with Node 24, which strips TypeScript types on its own. The address is an optional argument and defaults to the USDC mint, whose lamports rarely move. The processed-versus-finalized difference in the balance lines shows only when you pass an address with transfers in the last few slots. Any public account works.

`main.ts` (run: `node main.ts [address]`)

```ts
// HS0003 · Solana commitment levels
// https://carbium.sh/library/howsolana/solana-commitment-levels
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { setTimeout as sleep } from "node:timers/promises";
import {
  address,
  createDefaultRpcTransport,
  createSolanaRpcFromTransport,
  isSolanaError,
  SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,
} 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 wallet = address(process.argv[2] ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
const levels = ["processed", "confirmed", "finalized"] as const;

// One 429 gets one retry after the hint; any other error surfaces at once.
async function once<T>(call: () => Promise<T>): Promise<T> {
  try {
    return await call();
  } catch (e) {
    if (!isSolanaError(e, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) || e.context.statusCode !== 429) throw e;
    const seconds = Number(e.context.headers.get("retry-after")) || 1;
    console.error(`429: waiting ${seconds}s, then one more try`);
    await sleep(seconds * 1000);
    return call();
  }
}

// Three getSlot calls go out together, to keep their answers as close in time as possible.
const replies = await Promise.allSettled(
  levels.map((commitment) => once(() => rpc.getSlot({ commitment }).send())),
);
const slot: Partial<Record<(typeof levels)[number], bigint>> = {};
replies.forEach((reply, i) => {
  if (reply.status === "fulfilled") slot[levels[i]] = reply.value;
  else console.error(`getSlot at ${levels[i]} failed: ${reply.reason}`);
});
const gap = (a?: bigint, b?: bigint) => (a === undefined || b === undefined ? "n/a" : a - b);
console.log(`getSlot  ${levels.map((l) => `${l}=${slot[l] ?? "failed"}`).join(" ")}`);
console.log(`gap processed-confirmed=${gap(slot.processed, slot.confirmed)} processed-finalized=${gap(slot.processed, slot.finalized)}`);

for (const commitment of levels) {
  try {
    const { context, value } = await once(() => rpc.getBalance(wallet, { commitment }).send());
    console.log(`getBalance at ${commitment.padEnd(9)} answered at slot ${context.slot}: ${value} lamports`);
  } catch (e) {
    console.error(`getBalance at ${commitment} failed: ${e}`);
  }
}
```

The file makes two kinds of read. First it asks `getSlot` at each level, all three sent together to keep their answers as close in time as possible. Then it asks `getBalance` for the address at each level in turn. A `getBalance` reply carries a `context.slot`, the slot of the view the node read from, and the file prints it next to the lamports.

The `rpc` object is created once and reused for every call. An error on any call is printed with the level that failed, and the run moves on to the next call.

## Reading the output

The first two lines show the ladder: the three slot numbers, then the two gaps. The three numbers usually sit within a slot or two of each other and can briefly come back out of order, because the parallel calls each answer from a slightly different moment. The gaps move with the cluster and its protocol version, so measure them on your own run and do not hard code a number from a blog post.

The `getBalance` lines show what each level buys you. For an address that has not changed lately, all three print the same lamports and a `context.slot` that sits near the slot for that level. If the address received a transfer in the last few slots, the processed line can show the new amount while the finalized line still shows the old one. Both are correct answers to different questions: what has this node seen, and what can no longer change.

The `context.slot` values will not match the `getSlot` numbers exactly. The calls run one after another at different moments, and the chain advances between them.

> A wider gap between processed and finalized means finalization is trailing the tip for the moment. On its own it does not mean anything is broken. Compare the gap to your own earlier runs.

## Which level for which job

| Job | Level | Why |
|---|---|---|
| Show a balance or a position to a person | confirmed | A supermajority has voted, and the answer is current enough that a user does not see stale numbers. |
| Credit a deposit, release goods, run any step you cannot reverse | finalized | The block can no longer leave the chain, so the action cannot be orphaned. |
| Live display that you can redraw on a correction | processed | You see the newest block first and accept that the UI may need to step back. |
| Pre-send simulation or a read right after your own write | confirmed or finalized, with `minContextSlot` | `minContextSlot` makes the node refuse to answer from a view older than that slot. |

The RPC server's own default is `finalized`, but `@solana/kit` fills in `confirmed` when a call leaves commitment out, and `createSolanaRpc` and `createSolanaRpcFromTransport` both do this. Pass `finalized` explicitly when you need it. The file passes the level on every call so it says what it means.

Waiting for a sent transaction uses the same ladder. `signatureSubscribe` takes a commitment and delivers one confirmation for a signature, then the subscription ends. Subscribe at `confirmed` to tell a user the transfer landed, and check the signature again at `finalized` before you ship the order.

## On Carbium

The RPC endpoint is `https://services.carbium.sh`. The key can also go in the URL as [`?api-key=`](https://carbium.sh/docs#auth), and the WebSocket at `wss://services.carbium.sh` takes the same query form.

`getSlot` is a [cheap cached read](https://carbium.sh/docs#rpc) at 1 cell per call, with 5 requests per second on Free, 30 on Dev, 100 on Business and 500 on Pro. The three `getSlot` calls in the file fit in one second of Free's allowance.

Limits belong to the account, so every key on the account draws from one budget. The [limits](https://carbium.sh/docs#limits) page has the rest.

`-32601` means method not found. Do not retry it. A subscription over the WebSocket opens at a credit price set by its filter weight, and signature subscriptions sit in the lightest class, at 5 credits to open.

For the same ladder on a token balance, see [Read an SPL token balance with getTokenAccountBalance](https://carbium.sh/library/howsolana/spl-token-balance). To watch how far a node trails the chain over time, see [Alert Slack when your Solana RPC is over 2 slots behind](https://carbium.sh/library/integrate/slack-slot-lag-alerts).

## Where it ends

A commitment level is a statement by one node about how much of the cluster has agreed. It is not a proof you can carry elsewhere. If you need to show a third party that something happened, keep the signature and let them check it on their own.

A value read at processed can disappear. If your code writes it to a database, it must be able to write it back out when the block is dropped, or it must wait for a higher level. The file prints three levels of one balance but makes no decision from any of them.

The file reads one moment. It does not give history. `getSignaturesForAddress` accepts `confirmed` or `finalized` and rejects `processed`. On Carbium its pages come from our own address index, which keeps up to 30 days. An empty page past that is the index's age limit and says nothing about the address's first transaction. The call costs 50 cells.

The file never sends a transaction, so it shows nothing about how long a send takes to reach a level. That depends on the network at the moment you send.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| HTTP 429 with a retry-after hint. | Wait the number of seconds in the header and try once more, as the file does. If it repeats, slow the loop or move to a plan with a higher rate for the method. |
| Error -32601 method not found. | Fix the method name or use another method. A method Carbium does not serve keeps answering -32601, so do not retry it. |
| A balance read at processed is gone when you read it again. | The block it came from was on a fork the cluster dropped. Read again at confirmed or finalized before you act on the value, and keep processed for views you can redraw. |
| Two reads in a row disagree by a slot or two. | Both answers are valid views at different moments. Pass the same commitment on both and add `minContextSlot` to the later one when it must not be older than the first. |
| getSignaturesForAddress rejects a processed commitment. | That call accepts only `confirmed` and `finalized`. Pass one of them. |
| 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. |

## Questions

### Which commitment should I use if I do not know the job yet?

Start with `confirmed` for anything a person reads and `finalized` for anything that moves money or goods. Move to `processed` only for a display that can correct itself.

### Why does finalized trail processed?

Finalized waits until the cluster's votes make the block final. On the current cluster that takes about a slot, so the trail is short and can show as zero in one read. Processed shows the newest block the node has, before most of the cluster has voted.

### Does the WebSocket take a commitment?

Yes. Subscriptions accept a commitment option, and `signatureSubscribe` sends one confirmation for a signature and then ends. Use it to follow your own transaction up the ladder.

### Can I set one commitment for the whole client?

`@solana/kit` already defaults every call to `confirmed`. A different default needs `createSolanaRpcApi` with `defaultCommitment`, and an explicit level on each call keeps the intent visible.

## Related

- [SPL token balance](https://carbium.sh/library/howsolana/spl-token-balance) (How to use Solana, HS0001)
- [Slack slot-lag alerts](https://carbium.sh/library/integrate/slack-slot-lag-alerts) (Integrations, I0001)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
- [carbium.sh/docs#websocket](https://carbium.sh/docs#websocket)
- [carbium.sh/docs#errors](https://carbium.sh/docs#errors)
- [carbium.sh/docs#migrate](https://carbium.sh/docs#migrate)
