Tenzro
Tutorial — Agents

Register an ERC-8004 agent

ERC-8004 is the EVM standard for trustless agents. Tenzro implements the registry, reputation, and validation components at 0x101a, 0x101b, and 0x101c. The SDK's erc8004() client returns hex calldata that you sign and submit through your wallet of choice.
Level
Intermediate
Time
~20 min
Prerequisites
EVM wallet, machine DID
Stack
TypeScript · EVM
01

Register with the identity contract

encodeRegister returns the calldata for ERC8004_IDENTITY at0x101a. The derived agentId iskeccak256(utf8(did_string)).

import { TenzroClient } from "tenzro-sdk";
const client = new TenzroClient({ endpoint: "https://rpc.tenzro.network" });
const erc8004 = client.erc8004();

const callData = await erc8004.encodeRegister(
  "did:tenzro:machine:...",
  "https://agent.example.com",
  "0xWALLET_ADDRESS",
);
// Sign + submit `callData` to 0x101a from your wallet.
02

Submit reputation feedback

encodeFeedback targets ERC8004_REPUTATION at 0x101b.

const fbCallData = await erc8004.encodeFeedback(
  targetAgentId,
  5, // score 1..5
  "fast and accurate",
);
03

Request work validation

ERC8004_VALIDATION at 0x101c records that a job was performed.

const reqCallData = await erc8004.encodeValidationRequest(jobId, agentId);
const respCallData = await erc8004.encodeValidationResponse(jobId, true, "{...evidence...}");
04

Read back the agent record

Use the agent ID returned by deriveAgentId to read the record back via aneth_call against the registry.

const { agent_id } = await erc8004.deriveAgentId("did:tenzro:machine:...");
const getCallData = await erc8004.encodeGetAgent(agent_id);
// eth_call 0x101a with getCallData, then erc8004.decodeGetAgent(returnData).
Related
← All tutorials