---
id: I0146
title: "Make wallet transaction polling"
url: https://carbium.sh/library/integrate/make-wallet-transaction-polling
collection: Integrations
category: No-code automation
revision: 1
updated: 2026-11-23
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Make wallet transaction polling

A Node poller asks Carbium for the newest signatures of one wallet every 15 seconds, keeps a cursor so each transaction is sent once, and posts each new one to your automation tool's webhook.

## What the poller does

The poller is one Node process with one dependency, `@solana/kit`. Give it an address, and every 15 seconds it reads that address's newest transaction signatures from Carbium's [RPC endpoint](https://carbium.sh/docs/endpoints). Each new signature is handled oldest first: one JSON line goes to `events.jsonl` in the working directory and, when `MAKE_WEBHOOK_URL` is set, the same JSON is posted to that webhook. Your automation tool gets one request per transaction and never has to fetch the list itself.

It only reads. It signs nothing, holds no wallet and decodes no instructions. Each row carries the signature, the slot, the block time and whether the transaction failed.

## How the cursor keeps each event to one pass

The poller keeps a cursor, the signature of the newest transaction it has handled, in `cursor.json`. Solana's `until` parameter returns the signatures newer than the one given, newest first, and stops there. So each poll asks with `until` set to the cursor, reverses the answer, and moves the cursor forward after each event is written and, when a webhook is set, accepted.

The cursor moves one event at a time. If the webhook refuses the fifth of seven new transactions, the first four stay sent, the cursor rests on the fourth, and the next poll starts at the fifth. A restart picks up from the same file. The file records the address, so a cursor saved for another address is ignored.

On the first run there is no cursor. The poller reads the newest five signatures and handles them, so the first output shows real activity instead of an empty file.

## The Carbium call and its cost

The key goes in the `x-api-key` header, as [auth](https://carbium.sh/docs/auth) sets it for RPC, and the endpoint comes from `CARBIUM_RPC_URL` with the default as fallback. Each poll makes one call, `getSignaturesForAddress`, at commitment `confirmed`. The code names that commitment on purpose. @solana/kit also fills in `confirmed` when a call leaves it out, but a named value stays visible when someone edits the call.

On Free, `getSignaturesForAddress` costs 50 cells and runs at 0.24 req/s. A 15 second poll is four calls a minute, about 0.07 req/s or 28% of that rate, and 200 cells a minute. [Limits are per account](https://carbium.sh/docs/limits), so every key on the account draws from one budget, and a poll that gets a 429 is logged and retried at the next interval.

> The first run asks with no `until` and a limit of 5. Later polls ask for up to 100 signatures a call, the page size this code uses.

## Connecting the automation tool

In your automation tool, start a scenario from a custom webhook trigger and copy the URL it gives you into `MAKE_WEBHOOK_URL`. Treat that URL as a secret, since anyone who holds it can post into the scenario.

| Field | What it holds |
|---|---|
| signature | The transaction signature. An explorer or a `getTransaction` call takes the same string. |
| slot | The slot the transaction landed in, as a decimal string. |
| blockTime | Unix seconds for the block, or null when the node reports none. |
| status | `success` when the transaction has no error, `failed` when it has one. |
| seen | The UTC time the poller wrote the row. |

To read what an event did, add a `getTransaction` step in the tool with the `signature` field. That call costs 50 cells, and it needs `maxSupportedTransactionVersion: 1` with an encoding, because mainnet carries v1 transactions and the call answers -32015 for one when the version is absent or 0.

## Run it and read the first output

Export `CARBIUM_KEY`, then run `node main.ts` with the address as its argument. Without an argument the poller watches the SPL Token program, which has steady traffic. Under a supervisor such as a systemd user unit the process restarts after a crash or reboot, and the cursor file lets it resume where it stopped.

The first lines after start should show five events, each with a signature and a slot. Check the file with `tail -n 5 events.jsonl`, and look up one signature in a block explorer to confirm the row matches what landed. Between events the log stays quiet.

## The poller

Install the one dependency with `npm install @solana/kit@8.6.0`, and set `"type": "module"` in `package.json`. Node 24 strips the types on load. The file exits with a message when `CARBIUM_KEY` is unset. `MAKE_WEBHOOK_URL`, `CARBIUM_RPC_URL` and `POLL_MS` are optional, and `POLL_MS` defaults to 15000.

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

```ts
// I0146 · Make wallet transaction polling
// https://carbium.sh/library/integrate/make-wallet-transaction-polling
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import {
  address,
  createDefaultRpcTransport,
  createSolanaRpcFromTransport,
} from "@solana/kit";
import type { Signature } from "@solana/kit";
import { appendFile, readFile, rename, writeFile } from "node:fs/promises";

const key = process.env.CARBIUM_KEY;
if (!key) {
  console.error("Set CARBIUM_KEY to your Carbium key.");
  process.exit(1);
}
const target = address(process.argv[2] ?? "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
const webhook = process.env.MAKE_WEBHOOK_URL;
const POLL_MS = Number(process.env.POLL_MS ?? 15_000);
const CURSOR = "cursor.json";

const rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({
    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",
    headers: { "x-api-key": key },
  }),
);

// The newest signature already handled, kept across restarts.
let cursor: Signature | undefined;
try {
  const saved = JSON.parse(await readFile(CURSOR, "utf8")) as { address: string; until: string };
  if (saved.address === target) cursor = saved.until as Signature;
} catch {
  cursor = undefined; // no file yet: first run
}

async function saveCursor(sig: Signature) {
  await writeFile("cursor.json.tmp", JSON.stringify({ address: target, until: sig }));
  await rename("cursor.json.tmp", CURSOR);
}

async function poll() {
  const rows = await rpc
    .getSignaturesForAddress(target, { limit: cursor ? 100 : 5, until: cursor, commitment: "confirmed" })
    .send();
  // The answer is newest first; handle the oldest new signature first.
  for (const r of [...rows].reverse()) {
    const line = JSON.stringify({
      signature: r.signature,
      slot: r.slot.toString(),
      blockTime: r.blockTime?.toString() ?? null,
      status: r.err ? "failed" : "success",
      seen: new Date().toISOString(),
    });
    await appendFile("events.jsonl", line + "\n");
    if (webhook) {
      const res = await fetch(webhook, {
        method: "POST",
        headers: { "content-type": "application/json" },
        body: line,
        signal: AbortSignal.timeout(5_000),
      });
      if (!res.ok) throw new Error(`webhook answered ${res.status}`);
    }
    await saveCursor(r.signature);
    cursor = r.signature;
    console.log(`event ${r.signature} slot ${r.slot}`);
  }
}

console.log(`watching ${target} every ${POLL_MS / 1000} s`);
for (;;) {
  await poll().catch((err: unknown) => {
    console.error("poll failed:", err instanceof Error ? err.message : err);
  });
  await new Promise((done) => setTimeout(done, POLL_MS));
}
```

## Where it ends

- Events reach the tool on the first poll after they land, so the delay is at most one poll interval, 15 seconds by default.
- One call reads one page of 100. A poll that finds more than 100 new signatures handles the newest 100 and passes over the rest, so a busy address needs a shorter interval.
- The address index keeps 30 days at most, so the poller starts from the newest five and never backfills older history.
- Rows come from `confirmed`. A transaction seen at that level can still be dropped if its fork is abandoned, and the file keeps the row either way.
- A crash between a webhook's acceptance and the cursor write repeats one event after restart. Use `signature` as the key in your tool and skip repeats.
- The poller reads signatures and status only. It does not show token amounts, balances or instruction data.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The log shows `poll failed: HTTP error (401)` and no row is written. | The key is missing or cut short. Set `CARBIUM_KEY` to the whole key, which goes in the [`x-api-key` header](https://carbium.sh/docs/auth), and restart. The cursor has not moved, so no transaction is skipped. |
| The log shows `poll failed: HTTP error (429)` on most polls. | The account's budget is spent, usually by other traffic on the same account. Raise `POLL_MS` to 30000, or lower the other traffic; [limits are per account](https://carbium.sh/docs/limits). |
| The log shows `poll failed: webhook answered 404`, and the tool stops getting rows. | The URL is wrong or the scenario is off. Copy the current webhook URL into `MAKE_WEBHOOK_URL` and restart. Rows before the failure stay sent, and the run resumes at the first one not sent. |
| The tool shows one transaction twice after a restart. | The cursor is written after the webhook accepts an event, so a crash in that gap repeats one event. Key the tool on `signature` and skip a signature it has already stored. |
| A poll reports exactly 100 rows, or the slots in the file jump over busy stretches. | One page holds 100 signatures, so a poll that finds more handles the newest 100 only. Shorten `POLL_MS` so each poll sees fewer new signatures, or pick a quieter address. |
| `getTransaction` answers null or -32015 for a row's signature. | Null means the record sits below the validator's ledger floor, which the address index can reach, so the tool must handle null. -32015 means the call lacks `maxSupportedTransactionVersion: 1`. |

## Questions

### Why poll instead of subscribing over WebSocket?

A plain SOL wallet sends nothing on `accountSubscribe`, so a [WebSocket](https://carbium.sh/docs/websocket) path would use `logsSubscribe` with a mention of the address and a `getBalance` read. That pushes each log as it arrives, but Free carries 5 sockets and a subscription costs credits to open. Polling needs no socket and costs 50 cells a call.

### Does the poller see every transaction an address ever had?

No. It reads the newest five on the first run and then what lands after that. The address index keeps 30 days at most, so older history never reaches the file.

### Can it sign or send anything for the wallet?

No. It reads signatures and writes a file or posts to your webhook. Nothing in it signs, sends or holds a private key.

## Related

- [Wallet watch list at scale](https://carbium.sh/library/integrate/wallet-watch-list-at-scale) (Integrations, I0011)
- [Wallet activity tracker](https://carbium.sh/library/blockchainideas/wallet-activity-tracker) (Blockchain ideas, BI0005)
- [carbium.sh/docs/endpoints](https://carbium.sh/docs/endpoints)
- [carbium.sh/docs/auth](https://carbium.sh/docs/auth)
- [carbium.sh/docs/rpc](https://carbium.sh/docs/rpc)
- [carbium.sh/docs/limits](https://carbium.sh/docs/limits)
- [carbium.sh/docs/websocket](https://carbium.sh/docs/websocket)
