---
id: BI0063
title: "Non-vote TPS meter"
url: https://carbium.sh/library/blockchainideas/non-vote-tps-meter
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
---

# Non-vote TPS meter

A dashboard TPS number that leaves validator votes out comes straight from performance samples. Read two counters per sample, divide by the period, and check one block's count beside them, starting from a runnable main.ts.

## The two counters in a sample

`getRecentPerformanceSamples` answers with one row per sample window, newest first. A row says where the window ended and how many transactions the node saw inside it, and it keeps two separate counts. `numTransactions` counts every transaction in the window, validator votes included. `numNonVoteTransactions` counts the same window with the votes taken out. A dashboard that wants user activity reads the second one and never has to scan a block.

| Field | What it holds |
|---|---|
| `slot` | the slot where the window ended |
| `numSlots` | how many slots the window spans |
| `numTransactions` | all transactions in the window, votes included |
| `numNonVoteTransactions` | the same window without validator votes |
| `samplePeriodSecs` | the length of the window in seconds |

Validators used to send their votes as ordinary transactions, so the two counters sat far apart and the headline TPS on most explorers was mostly consensus traffic. Since the Alpenglow switch on mainnet (2026-10-21), blocks carry no vote transactions. On a current sample the two counters hold the same number and the vote share comes out at 0%. The subtraction stays in the meter because a series you stored earlier, or any chart that reaches back over the switch, still has votes inside it.

## The arithmetic per sample period

Every figure on the meter is a count divided by a length of time, taken from the same row. Read the period from `samplePeriodSecs` on each row. A window is about a minute wide, and reading the field keeps the meter correct if the node ever changes it.

- Total TPS is `numTransactions` divided by `samplePeriodSecs`.
- Non-vote TPS is `numNonVoteTransactions` divided by `samplePeriodSecs`. This is the number the dashboard shows.
- Votes in the window are the first count minus the second.
- Vote share is those votes divided by `numTransactions`, shown as a percentage, with a guard for a window whose total is 0.
- Transactions per slot is a count divided by `numSlots`, which is the figure to compare with a single block.

The counts arrive as bigint values, so the code converts each count with `Number` on read. A minute of mainnet traffic sits far below the point where a double loses whole numbers, and the TPS figures are decimals anyway.

> A sample counts every transaction that landed in a block, failed ones included. Non-vote TPS is a count of landed transactions, and a count of successful ones needs a block read.

## Cross-checking one block

Read the head with `getSlot` at confirmed commitment. `getSlot` sits in the cheap cached read class at 1 cell a call, which is 5 req/s on Free, 30 on Dev, 100 on Business and 500 on Pro.

Then ask `getBlock` for a slot a few behind the head with `transactionDetails: "signatures"`. The answer holds the signature list and no transaction bodies, and the length of that list is the block's transaction count. The head block can still be arriving, so the code starts three slots back and steps further back when a slot produced no block.

Mainnet carries v1 transactions, so `getBlock` needs `maxSupportedTransactionVersion: 1`. Leave it out, or send 0, and a block that holds a v1 transaction answers -32015 without a charge. The code passes 1 inline, which the kit types accept without a cast.

One block will not equal the per-slot average of a minute. Blocks vary in size, and the check passes when the block's count sits in the same range as the newest sample's non-vote transactions per slot. Because mainnet blocks hold no votes, the signature count and the non-vote count measure the same thing. On a block from before the switch the signature list includes votes, and telling them apart takes full transaction detail.

## Charting a rolling window

A sample changes once per period, so polling faster than the period only fetches rows you already hold. Fetch a full chart's worth with one call at start, say 60 samples for an hour, then ask for the last two or three rows each minute and add the ones whose `slot` you have not stored.

Key the stored points by `slot`. Two polls that overlap then cannot draw a point twice, and a missed poll leaves a visible gap in the chart that the next call fills, since the node still returns the rows you skipped.

For a smoothed line, divide the sum of non-vote counts over the window by the sum of the periods. That weights each sample by its length. An average of per-sample TPS values gives a different number whenever the periods differ, and the summed form stays correct.

Alerting on this series is a separate job. [Network congestion alerts](https://carbium.sh/library/blockchainideas/network-congestion-alerts) shows thresholds on chain-state readings, and [Grafana network metrics](https://carbium.sh/library/integrate/grafana-network-metrics) moves a series like this one into a time-series store with panels already built.

## The build

The script reads two things in parallel, the last few samples and the head slot, settles both, then reads one block. It needs `@solana/kit` and what Node 24 ships, and it never signs or sends.

1. Take the number of samples from the command line, 5 by default, capped at 60, and the key from `CARBIUM_KEY`.
2. Build one RPC client with the key in the `x-api-key` header and keep it for the run.
3. Call `getRecentPerformanceSamples` and `getSlot` together with `Promise.allSettled`, so one failing call leaves the other's output intact.
4. Print each sample oldest first with total TPS, non-vote TPS and vote share, then the window's non-vote TPS.
5. Step back from the head slot until `getBlock` answers, and print that block's count beside its slot and the newest sample's per-slot average.

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

```ts
// BI0063 · Non-vote TPS meter
// https://carbium.sh/library/blockchainideas/non-vote-tps-meter
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { 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 rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({
    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",
    headers: { "x-api-key": key },
  }),
);
// How many samples to print. Each one covers about a minute.
const COUNT = Math.min(Math.max(Number(process.argv[2] ?? 5) || 5, 1), 60);
const why = (e: unknown) => (e instanceof Error ? e.message : String(e));

const [samples, head] = await Promise.allSettled([
  rpc.getRecentPerformanceSamples(COUNT).send(),
  rpc.getSlot({ commitment: "confirmed" }).send(),
]);

let perSlot = 0; // non-vote transactions per slot in the newest sample
if (samples.status === "rejected") {
  console.error(`samples failed: ${why(samples.reason)}`);
} else {
  const rows = [...samples.value].reverse(); // the node answers newest first
  let nonVote = 0;
  let secs = 0;
  for (const s of rows) {
    const total = Number(s.numTransactions);
    const user = Number(s.numNonVoteTransactions);
    const period = s.samplePeriodSecs;
    const share = total > 0 ? ((total - user) / total) * 100 : 0;
    console.log(
      `slot ${s.slot} | total ${(total / period).toFixed(0)} TPS | non-vote ${(user / period).toFixed(0)} TPS | votes ${share.toFixed(1)}%`,
    );
    nonVote += user;
    secs += period;
    perSlot = user / Number(s.numSlots);
  }
  console.log(`window of ${rows.length}: ${(nonVote / secs).toFixed(0)} non-vote TPS`);
}

if (head.status === "rejected") {
  console.error(`getSlot failed: ${why(head.reason)}`);
} else {
  for (const back of [3n, 4n, 5n, 6n, 7n]) {
    const slot = (head.value - back) as typeof head.value;
    try {
      const block = await rpc
        .getBlock(slot, {
          commitment: "confirmed",
          transactionDetails: "signatures",
          rewards: false,
          maxSupportedTransactionVersion: 1,
        })
        .send();
      if (!block) {
        console.log(`slot ${slot} has no block`);
        continue;
      }
      console.log(
        `block at slot ${slot}: ${block.signatures.length} transactions | newest sample averages ${perSlot.toFixed(0)} non-vote per slot`,
      );
      break;
    } catch (e) {
      console.error(`getBlock ${slot} failed: ${why(e)}`);
    }
  }
}
```

## Where it ends

- A sample covers about a minute, so the meter cannot show a spike that lasts seconds. A burst inside one window raises that window's average and nothing sharper.
- The node keeps a limited run of recent samples. A chart that reaches back days comes from rows your own store kept.
- A series stored before the Alpenglow switch has its votes inside the total. Chart the non-vote counter for the whole range, and keep the two eras apart when you chart totals.
- The count includes failed transactions. A meter of successful transactions needs block reads and a status check on each, which costs far more calls.
- One block is a spot check. Blocks vary in size, so a single block that differs from the per-slot average does not mean the meter is wrong.
- The block read at `confirmed` can answer null for a slot with no block, and an error for a skipped or not yet available slot. The code steps back past both.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| getBlock answers -32015. | The block holds a v1 transaction and the call left out `maxSupportedTransactionVersion`. Pass 1 in the config object. The failed call is uncharged. |
| Total TPS and non-vote TPS are equal on every row. | That is the expected reading on current mainnet, where blocks carry no vote transactions. The vote share column reads 0.0%. Rows from before the switch, in a stored series, still show a gap. |
| The block line never prints. | Each slot tried had no block or the call failed, and the script prints why for each. Widen the list of steps back from the head, or run again a few seconds later. |
| A call answers 429. | Wait for the retry-after hint and slow the poll to once per sample period. Limits belong to the account, so other tools on the same keys draw on the same budget. |
| The chart repeats the same point after a poll. | The row is already stored. Key the points by `slot` and skip a slot you have seen, since the sample only changes once a period. |

## Questions

### Why not count votes by reading blocks myself?

The sample already holds the split, so a full block scan adds calls and bytes for a number the node has counted. Read blocks only for a spot check, as the script does.

### Can I get per-second TPS from this?

No. The finest figure is the sample window, about a minute. A per-second view needs your own count taken from blocks or a stream as they arrive.

### Do I still need the vote share column?

Keep it while any stored series reaches back before 2026-10-21. On current samples it reads 0%, and a value above 0 on a new row tells you something about the data is off.

### Which commitment do the samples use?

`getRecentPerformanceSamples` takes no commitment. The two calls beside it, `getSlot` and `getBlock`, run at `confirmed` in this script.

## Related

- [Network congestion alerts](https://carbium.sh/library/blockchainideas/network-congestion-alerts) (Blockchain ideas, BI0026)
- [Grafana network metrics](https://carbium.sh/library/integrate/grafana-network-metrics) (Integrations, I0017)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
- [carbium.sh/docs#endpoints](https://carbium.sh/docs#endpoints)
