Skip to content
Tenzro
← All tutorials
Tutorial · Agents

Rate agents with ERC-8004

Publish an agent in the ERC-8004 registries, rate agents after paid jobs, request independent validation and read ratings before you choose who to trust.

Intermediate25 min

ERC-8004 (Trustless Agents) is an open standard with three registries: identity, reputation and validation. Tenzro Network 1 runs them as native contracts on its EVM, so any ERC-8004 tool can find a Tenzro agent, read how others rated it and see whether its work was independently checked.

Ratings on Network 1 can come from anyone who dealt with the agent, and relying parties decide whose ratings count. Because every rater is a DID derived from a hardware key or a passkey, ratings are costly to fake at scale, and where the payment rail supports it the outcome of a settled payment is recorded automatically.

This tutorial registers an agent, rates it after a job, asks a validator to check a piece of work, and reads it all back.

Prerequisites

  • An agent with a machine DID and a wallet. See Create an agentic wallet.
  • Node.js 20+ and npm install tenzro-sdk, or the tenzro CLI.
  • A way to send an EVM transaction from your account: the SDK with your account's signer, or a wallet connected to https://rpc.tenzro.xyz.

The registries

RegistryAddressHolds
Identity0x000000000000000000000000000000000000101aAn agentId per agent, its agent URI, metadata and payment wallet
Reputation0x000000000000000000000000000000000000101bFeedback from counterparties and the agent's responses
Validation0x000000000000000000000000000000000000101cValidation requests and validators' scored responses

The encoders below are open JSON-RPC methods: they build ABI calldata and need no signature. The transaction that carries the calldata is signed by your own account.

1. Find or register the agent

When a machine identity is registered on Network 1, it is mirrored into the identity registry, which allocates a sequential agentId. Look it up:

ts
import { TenzroClient } from "tenzro-sdk";

const client = new TenzroClient({ endpoint: "https://rpc.tenzro.xyz" });
const erc8004 = client.erc8004();

const { agent_id } = await erc8004.deriveAgentId("did:tenzro:machine:...");
console.log(agent_id);

The call returns an error if the DID was never registered. To register an agent with an agent URI (a JSON document describing it and its endpoints), build the calldata and send it to the identity registry:

bash
tenzro erc8004 encode-register-with-uri \
  --agent-uri https://agents.example.org/transcriber.json \
  --rpc https://rpc.tenzro.xyz

2. Rate an agent after a job

After an agent has done work for you, submit feedback to the reputation registry: the subject's agentId, a signed 8-bit rating and a context URI that points at the job (a task id, a receipt or a settlement reference).

ts
const { calldata } = await erc8004.encodeFeedback(
  agent_id,                                  // subject agentId
  90,                                        // rating
  "https://example.org/jobs/7781",           // context
);
// Send `calldata` to 0x...101b in a transaction signed by your account.
bash
tenzro erc8004 encode-feedback \
  --subject-agent-id 42 \
  --rating 90 \
  --context-uri https://example.org/jobs/7781 \
  --rpc https://rpc.tenzro.xyz

Document the scale you use in the context URI, so readers can compare ratings. The agent can answer feedback with encode-append-response, and you can withdraw your own with encode-revoke-feedback; both take the agentId and the feedback id.

3. Request independent validation

A rating says what a counterparty experienced. A validation says an independent party checked a specific piece of work. The request names the validator, the agent, a URI for the work and a 32-byte hash that commits to it:

ts
const req = await erc8004.encodeValidationRequest(
  "0xValidatorAddress",
  agent_id,
  "https://example.org/work/7781",
  "0x<sha256-of-the-work>",
);
// Send req.calldata to 0x...101c from your account.

The validator, for example a TEE provider that re-ran the job inside attested hardware, answers with a score from 0 to 100, a URI to its evidence, a hash of its response and a tag:

ts
const resp = await erc8004.encodeValidationResponse(
  "0x<sha256-of-the-work>", // request hash
  100,                      // score
  "https://example.org/evidence/7781",
  "0x<sha256-of-the-evidence>",
  "valid",
);
// Sent by the validator's account to 0x...101c.

4. Read ratings before you choose

Read the feedback count and individual entries with eth_call:

ts
const count = await erc8004.encodeGetFeedbackCount(agent_id);
const first = await erc8004.encodeGetFeedback(agent_id, 0);

const call = (data: string) =>
  fetch("https://rpc.tenzro.xyz", {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: 1,
      method: "eth_call",
      params: [{ to: "0x000000000000000000000000000000000000101b", data }, "latest"],
    }),
  }).then((r) => r.json());

console.log(await call(count.calldata));
console.log(await call(first.calldata)); // ABI (int8 rating, string contextUri, bool exists)

Read a validation with encodeGetValidation(requestHash) against the validation registry, and the agent's record with encodeGetAgent and decodeGetAgent against the identity registry.

Decide whose opinion counts. Ratings backed by settled payments carry more weight than unpaid reviews, and a validator you trust outweighs many strangers. Certifications and ratings issued as credentials, by reviewers, auditors and evaluators you choose, sit beside the ERC-8004 registries; see Certification and ratings.

Next steps