---
id: BI0019
title: "Program health dashboard"
url: https://carbium.sh/library/blockchainideas/program-health-dashboard
collection: Blockchain ideas
category: Dashboards and explorers
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Program health dashboard

Health numbers for a program you shipped or depend on. One poll of its newest signatures gives a failure rate and error buckets, and getTransaction reads the logs of failed runs. Costs per plan and a runnable main.ts are included.

## Who uses it

A team that ships an on-chain program wants to know within a minute whether it is healthy after a release. A team that builds on someone else's program wants the same answer before it blames its own code. Both can read it from the chain: every transaction that touches the program has a signature, and the signature list carries an `err` field that is null for a success.

The `err` field gives the dashboard two of its figures: the share of recent transactions that failed, and which error each failure carried. The call rate comes from the same signatures call, as its row count. Only the chain position and the failed-run logs come from other calls. The dashboard then opens a couple of failed runs and prints their last log lines, so a jump in `{"Custom":"6003"}` arrives with the program's own message beside it.

A hackathon crew can point it at any busy program on mainnet for a demo. A protocol team can run it in a terminal next to a deploy, with its own program id as the argument, and watch the failure share before and after the upgrade.

## What it shows

Each round prints one summary line and then the sampled failures. The window holds up to the newest 500 signatures, which on a busy program means the last five pages of 100, so one poll moves the failure share by at most a fifth of the window. The call rate comes from the newest round alone.

| Figure | Where it comes from | Example |
|---|---|---|
| Failure rate | `err` on every signature in the window | 7 failed of 100, 7.0% |
| Error buckets | the inner error of each failed `err` | `{"Custom":"6003"}` 5, `{"Custom":"6001"}` 2 |
| Call rate | the rows a round just fetched, divided by the wall-clock seconds since the previous round; a full page prints as a floor | about 3 transactions per second, or `100+ rows, over 6.7 tx/s` |
| Chain position | getSlot at `confirmed` and getHealth | a slot number and `ok` |
| Compute units and error lines | getTransaction on up to two new failures per round | `units 187402` and the program's own message |

The error key drops the instruction index and keeps the inner error, so one custom code is one bucket whichever instruction raised it. Every transaction that lists the address counts, including one that fails in a calling or unrelated program before the target runs, and on a busy program a high rate is mostly such callers. The log lines name the program that raised the error.

## The build

The dashboard is one file that needs `@solana/kit` and what Node 24 ships. It is read-only: no private key, nothing sent, nothing stored.

1. Take the program address from the first argument. With no argument it reads a busy mainnet program, so the first run shows numbers.
2. Every 15 seconds, send three reads together: getHealth, getSlot and getSignaturesForAddress with `limit: 100`. After the first round the signatures call carries `until` set to the newest signature already seen, so a round returns only what arrived since.
3. Put the new rows at the front of the 500-row window. Count failures and bucket them by inner error. Divide the round's new rows by the seconds since the previous round for the call rate, and print a full page of 100 as a floor.
4. Send up to two of the new failures to getTransaction. Print the transaction's compute units and the last two log lines that mention an error or a failure.
5. Settle every call alone. A failed getHealth or getSlot prints "failed", a failed signatures call prints its message, and the other reads still report.

`main.ts` (run: `CARBIUM_KEY=<YOUR_KEY> node main.ts <PROGRAM_ADDRESS>`)

```ts
// BI0019 · Program health dashboard
// https://carbium.sh/library/blockchainideas/program-health-dashboard
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, type Signature } from "@solana/kit";

const key = process.env.CARBIUM_KEY;
if (!key) {
  console.error("Set CARBIUM_KEY to your Carbium API key.");
  process.exit(1);
}
// Any program id works; with no argument the default is a busy mainnet program.
const PROGRAM = address(process.argv[2] ?? "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4");
const rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({
    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",
    headers: { "x-api-key": key },
  }),
);

const EVERY_MS = 15_000; // one signatures call is 0.07 req/s and two samples are 0.13 req/s, each under Free's 0.24
const WINDOW = 500;
const PAGE = 100;
type Row = { signature: Signature; err: unknown };
let rows: Row[] = [];
let newest: Signature | undefined;
let lastRound: number | undefined;

const show = (v: unknown) => JSON.stringify(v, (_, x) => (typeof x === "bigint" ? x.toString() : x));
// {InstructionError: [ix, {Custom: 6003n}]} prints as {"Custom":"6003"}; other errors as they come.
const errorKey = (err: unknown): string =>
  show(typeof err === "object" && err !== null && "InstructionError" in err
    ? (err.InstructionError as unknown[])[1]
    : err);

async function sample(signature: Signature): Promise<void> {
  const tx = await rpc
    .getTransaction(signature, { commitment: "confirmed", encoding: "json", maxSupportedTransactionVersion: 1 })
    .send();
  if (!tx) {
    console.log(`  ${signature.slice(0, 8)} null: below the ledger floor or not readable yet`);
    return;
  }
  console.log(`  ${signature.slice(0, 8)} units ${tx.meta?.computeUnitsConsumed ?? "n/a"}`);
  for (const line of (tx.meta?.logMessages ?? []).filter((l) => /error|fail/i.test(l)).slice(-2)) {
    console.log(`    ${line}`);
  }
}

async function round(): Promise<void> {
  const [health, slot, page] = await Promise.allSettled([
    rpc.getHealth().send(),
    rpc.getSlot({ commitment: "confirmed" }).send(),
    rpc.getSignaturesForAddress(PROGRAM, { limit: PAGE, commitment: "confirmed", ...(newest ? { until: newest } : {}) }).send(),
  ]);
  const now = Date.now();
  const chain = `health ${health.status === "fulfilled" ? health.value : "failed"}, slot ${slot.status === "fulfilled" ? slot.value : "failed"}`;
  if (page.status === "rejected") {
    console.error(`${chain}; signatures failed:`, page.reason instanceof Error ? page.reason.message : page.reason);
    return;
  }
  const fresh: Row[] = page.value.map((s) => ({ signature: s.signature, err: s.err }));
  if (fresh.length) newest = fresh[0].signature;
  rows = [...fresh, ...rows].slice(0, WINDOW);
  const failed = rows.filter((r) => r.err !== null);
  // blockTime is whole seconds, so the rate divides this round's rows by wall-clock seconds since the last round.
  const secs = lastRound === undefined ? 0 : (now - lastRound) / 1000;
  lastRound = now;
  const perSec = (fresh.length / secs).toFixed(1);
  const rate = secs === 0 ? "n/a (first round)" : fresh.length >= PAGE ? `${fresh.length}+ rows, over ${perSec} tx/s` : `${perSec} tx/s`;
  const buckets = new Map<string, number>();
  for (const r of failed) buckets.set(errorKey(r.err), (buckets.get(errorKey(r.err)) ?? 0) + 1);
  console.log(`${chain}; ${fresh.length} new rows`);
  console.log(`  window ${rows.length} rows, ${failed.length} failed (${rows.length ? ((100 * failed.length) / rows.length).toFixed(1) : "0.0"}%), ${rate}`);
  console.log(`  errors ${show(Object.fromEntries(buckets))}`);
  const results = await Promise.allSettled(fresh.filter((r) => r.err !== null).slice(0, 2).map((r) => sample(r.signature)));
  for (const r of results) if (r.status === "rejected") console.error("  getTransaction failed:", r.reason instanceof Error ? r.reason.message : r.reason);
}

async function main(): Promise<void> {
  for (;;) {
    await round().catch((e) => console.error("round failed:", e instanceof Error ? e.message : e));
    await new Promise((resolve) => setTimeout(resolve, EVERY_MS));
  }
}

void main();
```

Each call names `confirmed`, so the figures do not depend on the client's default. getHealth takes no commitment.

getTransaction passes `maxSupportedTransactionVersion: 1`. Mainnet carries v1 transactions, and without that value a v1 transaction comes back as error -32015, as [Transaction version error -32015](https://carbium.sh/library/howsolana/transaction-version-error-32015) explains.

> A signature on the list can answer null from getTransaction. The address index reaches below the validator's ledger floor, so an older row may have no transaction behind it. The code prints that and moves on.

## What it costs

A round makes up to five calls. getHealth and getSlot are cheap cached reads at 1 cell each. getSignaturesForAddress costs 50 cells and so does each getTransaction, so a round with two samples puts 50 cells into the signatures class and 100 into the transaction class. Each class sits well inside the 1,024-cell burst a rate class absorbs.

| Plan | getSignaturesForAddress req/s | getTransaction req/s | getHealth and getSlot req/s |
|---|---|---|---|
| Free | 0.24 | 0.24 | 5 |
| Dev | 1.2 | 1.2 | 30 |
| Business | 100 | 5 | 100 |
| Pro | 500 | 25 | 500 |

The two classes are counted apart. At 15 seconds a round sends one signatures call, which is 0.07 req/s, and two getTransaction samples, which is 0.13 req/s, each against Free's 0.24. The pace fits Free as written. On Dev both classes allow 1.2 req/s, and the two samples are the tighter one, so the interval can drop to about 2 seconds. On Business and Pro the signatures class has ample room, and the transaction class at 5 and 25 req/s is the limit to watch as the sample count grows.

Limits belong to the account, so a second tool on the same keys spends from the same rates. If the dashboard shares an account with a deposit watcher, add the watcher's calls to the arithmetic before you shorten the interval.

## What to add next

- History: write each round's failure rate and buckets to `node:sqlite` and chart them. A release shows up as a step in the line.
- An alert: post to a channel when the failure rate stays above a number for three rounds, or when a new error code appears that the last 500 rows never had.
- Upgrade marker: read the program account with getAccountInfo, take the program data address from it, and read that account's last-deployed slot. A new error code soon after that slot is the usual sign of a regression.
- Many programs: loop over a list and keep one window per program. Each program adds a 50-cell signatures call per round.
- A push view: for failures as they happen, [Failed-mint monitor](https://carbium.sh/library/blockchainideas/failed-mint-monitor) shows the logsSubscribe version of the same idea.

## Where it ends

- The rate counts transactions that landed. One rejected in preflight, or one whose blockhash expired, never reaches the signature list, so the program can look healthier than its callers experience.
- The headline failure rate is the share of failed transactions that touch the address, which differs from the program's own failure share. A caller that fails before it reaches the program still lists the address and still counts.
- Each poll returns at most 100 rows. A program above about 6.7 transactions a second outruns that in 15 seconds, and the rows between two rounds are skipped, so the window holds gaps. The failure share is then read from a sample of the newest rows. Shorten the interval or page back with `before` to cover the gap.
- The call rate reads as a floor once a round returns a full page. The dashboard prints it as `100+ rows, over 6.7 tx/s`, because the rows past the first 100 are never fetched. The first round has no earlier round to divide by and prints n/a.
- Error codes are bare numbers, shown in quotes because kit reads them as bigint. Names need the program's own error table, which the dashboard does not fetch.
- History is the 30-day address index at most. An empty page past that is the index's age limit and says nothing about the program's first transaction.
- The dashboard reports what happened on chain. It does not check that a program's off-chain parts, such as an API in front of it, are up.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The first round returns no rows. | Check that the address is the program id you meant; an address with no transactions in the 30-day index gives an empty page. The dashboard prints zero rows without failing. |
| getTransaction prints null for a failed signature. | The signature list reaches below the ledger floor, so an older row can have no transaction behind it. Sample from the newest rows, as the code does, and let the null line pass. |
| getTransaction answers -32015. | Pass `maxSupportedTransactionVersion: 1`. The code does, and a copy that drops it fails on any v1 transaction. |
| The signatures call answers 429 on Free. | Widen the interval toward 30 seconds and list what else uses the account's keys, because the rate is shared across them. At 15 seconds the dashboard alone sits under Free's 0.24 req/s on the signatures call, so the 429 comes from other tools on the account or from a Free key over its network's shared budget. |
| Every call answers 401. | The key is unknown at the door. Attach the whole key in `CARBIUM_KEY`, with no trailing space or cut-off characters. |
| The failure rate reads zero on a program everyone knows fails sometimes. | Failures between rounds can fall outside the newest 100 rows. Shorten the interval, or page with `before` until the rows overlap the last round. |

## Questions

### Do I need a WebSocket for this?

No. Polling the signature list is enough for rates and buckets, and it needs one HTTPS endpoint. A subscription pushes each failure as it lands and costs an opening fee set by filter weight, then 20 credits per MiB sent, so polling is the quieter choice for a dashboard.

### Can it tell which instruction failed?

The `err` field carries the instruction index, and the bucket key drops it on purpose. The log lines show the invoke chain, which names the program that raised the error. Keep the index as part of the key if you want one bucket per instruction.

### Does a 5% failure rate mean the program is broken?

Not by itself. Busy programs fail on stale quotes, expired orders and empty accounts all day. Watch the change from the program's usual level and the arrival of an error code that was not in the window before.

### Will it run on the Free plan?

Yes. At the 15-second pace the signatures class runs at 0.07 req/s and the transaction class at 0.13 req/s, against Free's 0.24 on each. A round that returns a full 100 rows has skipped some, so read the failure share as a sample.

### How many transactions does the window cover?

Up to the newest 500 signatures. A quiet program can hold hours of history in those rows. A program busier than about 6.7 transactions a second adds a full page of 100 each round, so the window holds the last five pages, which is about 75 seconds of rounds at the 15-second pace.

## Related

- [Failed-mint monitor](https://carbium.sh/library/blockchainideas/failed-mint-monitor) (Blockchain ideas, BI0001)
- [Transaction version error -32015](https://carbium.sh/library/howsolana/transaction-version-error-32015) (How to use Solana, HS0012)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
- [carbium.sh/docs#errors](https://carbium.sh/docs#errors)
- [carbium.sh/docs#endpoints](https://carbium.sh/docs#endpoints)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
