---
id: SI0026
title: "Agent registry reader"
url: https://carbium.sh/library/si/agent-registry-reader
collection: AI and blockchain
category: Agent sign-up and keys
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Agent registry reader

Give the reader a list of registry record addresses and the program that should own them. It prints which records are genuine, which are owned by someone else or missing, and when each record last showed activity on chain.

## What a registry holds

An agent registry on Solana is a set of accounts. Each record is an account that a registry program owns, and its data describes one agent: usually an identity, the wallet it acts with and a link to a longer description such as an agent card. The layout is the registry program's choice. This reader treats the data as bytes it can measure, hash and scan for a link, and leaves field decoding to code written against that program's published layout.

The reader answers three questions an engineer asks before one agent trusts another: does the record exist, did the registry program write it, and has anything touched it lately.

## Why the owner is the proof

Only the program that owns an account can change its data. Anyone can deploy their own program and use it to write bytes that look like a registry record into an account it owns, so the bytes alone prove nothing. The owner field is the check. A record counts as genuine when its owner is the program you set in `REGISTRY_PROGRAM`. A record under any other owner prints as `FOREIGN` with that owner's address.

The owner tells you who wrote the bytes. It says nothing about how strict the registry's rules were. A registry that lets any signer register still produces genuine records for agents you have no reason to trust, so reputation is a separate step you build on top. When a registry derives record addresses from a seed, derive the address yourself from the agent's key and pass that one in. A lookalike at another address then cannot be handed to you. The file takes addresses as given and derives nothing.

## The reader file

One file. Node 24 runs the TypeScript directly, `@solana/kit` 8.6.0 makes the RPC calls and `node:crypto` hashes the data. Set `CARBIUM_KEY` and `REGISTRY_PROGRAM`, then pass up to 100 record addresses as arguments. The file exits with a message when the key, the program or the addresses are missing. `CARBIUM_RPC_URL` overrides the endpoint, which defaults to `https://services.carbium.sh`.

`main.ts` (run: `node main.ts <record address>...`)

```ts
// SI0026 · Agent registry reader
// https://carbium.sh/library/si/agent-registry-reader
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

// Agent registry reader, read only. Run: CARBIUM_KEY=... REGISTRY_PROGRAM=<program> node main.ts <record address>...
import { createHash } from "node:crypto";
import { address, createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";

const key = process.env.CARBIUM_KEY;
const program = process.env.REGISTRY_PROGRAM;
const records = process.argv.slice(2);
if (!key || !program || records.length === 0 || records.length > 100) {
  console.error("Set CARBIUM_KEY and REGISTRY_PROGRAM, then pass 1 to 100 record addresses.");
  process.exit(1);
}
const apiKey: string = key;
const expected = address(program);
const accounts = records.map((r) => address(r));
const rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({
    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",
    headers: { "x-api-key": apiKey },
  }),
);

try {
  const { value } = await rpc.getMultipleAccounts(accounts, { encoding: "base64", commitment: "confirmed" }).send();
  const results = await Promise.allSettled(
    accounts.map(async (addr, i) => {
      const acct = value[i];
      if (!acct) return `${addr} missing`;
      // Only the owning program can write the data, so the owner is the check.
      if (acct.owner !== expected) return `${addr} FOREIGN owner ${acct.owner}`;
      const data = Buffer.from(acct.data[0], "base64");
      const hash = createHash("sha256").update(data).digest("hex");
      const uri = /https?:\/\/[\x21-\x7e]{4,120}/.exec(data.toString("latin1"))?.[0] ?? "none";
      const [last] = await rpc.getSignaturesForAddress(addr, { limit: 1, commitment: "confirmed" }).send();
      const when = last?.blockTime ? new Date(Number(last.blockTime) * 1000).toISOString() : "no signature in 30 days";
      return `${addr} registered ${data.length} bytes sha256 ${hash} uri ${uri} last activity ${when}`;
    }),
  );
  results.forEach((r, i) => {
    console.log(r.status === "fulfilled" ? r.value : `${accounts[i]} failed: ${(r.reason as Error).message}`);
  });
} catch (e) {
  console.error("read failed:", (e as Error).message);
  process.exit(1);
}
```

One `getMultipleAccounts` call reads every record at `confirmed` with base64 data. For each record that is present and owned by the registry, the file hashes the data, looks for the first `http` link in it and reads the newest signature that mentions the record. Those reads run side by side and each can fail alone, so a failure prints on its own line and the other records still print. The link is printed and never fetched: it is text an unknown party wrote, and an agent that follows it should treat the page as untrusted input.

## What the reader prints

| Line | Meaning | What to do |
|---|---|---|
| `<address> registered 82 bytes sha256 <64 hex characters> uri none last activity 2026-11-22T10:00:00.000Z` | The record exists and the registry program owns it. The full sha256 digest identifies this exact data. | Store the digest and compare it on the next read to catch a change. |
| `<address> FOREIGN owner <address>` | The account exists and a different program owns it. | Reject it as a registry record. |
| `<address> missing` | No account sits at that address. | The agent is unregistered, the record was closed, or the address is wrong. |
| `last activity no signature in 30 days` | No signature in the address index mentions the record. | Treat the record as quiet, or older than the index reaches. |
| `failed: <message>` | The signature read for one record failed. | Retry that record after a pause. |

## Cost and keys

`getMultipleAccounts` charges 10 cells per pubkey. A 100-pubkey call is 1000 cells, or 1001 once the body passes 4 KiB, and the 1024-cell burst caps a call at 100 pubkeys below Pro. The call takes up to 300 pubkeys on Pro, which is why the file stops at 100. Account reads run at 0.5 req/s on Free, 15 on Dev, 50 on Business and 400 on Pro. Each signature read costs 50 cells, at 0.24 req/s on Free, 1.2 on Dev, 100 on Business and 500 on Pro. On Free, keep the signature reads for the records you are about to trust.

Limits are per account, and an account's keys share one budget. The key goes out in the `x-api-key` header and the file never prints it. An agent that runs this reader holds a Carbium key, and [Agent RPC key safety](https://carbium.sh/library/si/agent-rpc-key-safety) covers where that key lives.

## Where it ends

- The reader does not list a registry. `getProgramAccountsV2` is not served and answers -32601, which is not worth retrying. The addresses come from elsewhere: the registry's own index, an address an agent publishes, or the signatures of the registry program.
- The hash shows that data changed and says nothing about what changed. Field decoding needs the registry program's published layout.
- A genuine record is not a trustworthy agent. The registry's own rules decide who may register.
- Last activity is the newest signature that lists the record account. That is a write to the record or a read of it by another program, and it is not necessarily a transaction by the agent. The address index keeps up to 30 days, so older history is not served, and an empty page past that is the index's age limit: the record may have older transactions.
- A record can change between your read and your action. Read it again just before an action that depends on it and compare the hash.
- A closed record reads as `missing`, the same as an address nobody ever used.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| Every record prints `FOREIGN`. | `REGISTRY_PROGRAM` is the wrong program address. Read one record you know the registry wrote and copy the owner it prints. |
| The call answers 401. | An unknown key gets 401 at the door. Attach the whole key; a clipped value never matches. |
| A program-wide scan answers -32601. | `getProgramAccountsV2` is not served. Do not retry it. Pass the record addresses to the reader instead. |
| A list of more than 100 addresses prints the usage message and exits. | The file refuses more than 100 addresses on every plan. Run it once per group of 100 and pause between runs. |
| Signature reads answer 429 on Free. | A signature read costs 50 cells and Free refills 0.24 req/s. Wait the retry-after hint, and read signatures only for records you intend to trust. |
| A record that has an agent card prints `uri none`. | The link sits in a field the plain text scan cannot see, such as an encoded or hashed form. Decode that field with the registry program's layout. |

## Questions

### Is there one official Solana agent registry?

The reader assumes none. Any registry that keeps records as accounts owned by a program works, and you name the program in `REGISTRY_PROGRAM`. Take that address from the registry's maintainers before you set it.

### Can the reader register an agent?

No. It holds no keypair and sends nothing. Registering is a signed transaction built by the registry's own client.

### Why check the owner instead of the data?

Anyone can deploy a program and write lookalike bytes into an account it owns. Only the owning program can change the data of a program-owned account, so the owner shows who wrote it.

### How often should an agent read a record again?

Before each action that depends on it. The printed sha256 digest makes the comparison quick: a match with the stored digest means the data is unchanged.

### Can a model call this as a tool?

Yes. Wrap it as one read-only tool that takes addresses and returns the printed lines. [LLM tool calling](https://carbium.sh/library/si/llm-tool-calling) covers the loop around it.

## Related

- [SOL balances for many accounts](https://carbium.sh/library/howsolana/sol-balances-for-many-accounts) (How to use Solana, HS0016)
- [Agent RPC key safety](https://carbium.sh/library/si/agent-rpc-key-safety) (AI and blockchain, SI0006)
- [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#errors](https://carbium.sh/docs#errors)
