erc8004-identity-viewer / tree / README.md ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)

ERC-8004 identity viewer

A static page that shows an AI agent's ERC-8004 identity (owner, tokenURI, registration file) and its reputation feedback, on Base and Base Sepolia. HTML, CSS and JavaScript only: no backend, no wallet, no dependency. The page calls the chain with eth_call through a public RPC.

Live demo: https://agentgate-source.pages.dev/erc8004-identity-viewer/demo/ (try https://agentgate-source.pages.dev/erc8004-identity-viewer/demo/?network=base&agent=1, or Base Sepolia agent 1, which has reputation feedback: https://agentgate-source.pages.dev/erc8004-identity-viewer/demo/?network=base-sepolia&agent=1).

Tests: npm test runs the offline A1 to A6 tests with a fake RPC (no network). VIEWER_LIVE=1 npm test adds one live read from Base.

Use it

Open index.html from any static host (GitHub Pages works), or run npm run serve and open http://localhost:8080. Deep links: ?network=base&agent=1 or ?network=base-sepolia&agent=1. The Advanced panel takes your own RPC URL and IPFS gateway.

Library

viewer.js is an ES module that runs in the browser and in Node 20.

import { loadAgent, httpRpc, httpFetchJson, REGISTRIES } from './viewer.js';

const cfg = REGISTRIES['base-sepolia'];
const agent = await loadAgent({
  agentId: 1,
  network: 'base-sepolia',
  identityRegistry: cfg.identity,
  reputationRegistry: cfg.reputation, // optional
  rpc: httpRpc(cfg.rpcUrl),           // rpc(method, params) -> Promise
  fetchJson: httpFetchJson(),         // fetchJson(url) -> Promise
});
// { status: 'ok' | 'empty' | 'error', agentId, owner, tokenURI, registration, feedback, error? }

Registries (config.js)

Network Identity registry Reputation registry
base (8453) 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
base-sepolia (84532) 0x8004A818BFB912233c491871b3d84c89A494BD9e 0x8004B663056A597Dffe9eCcC1965A193B7388713

Source: the ERC-8004 reference deployment, https://github.com/erc-8004/erc-8004-contracts (README, Contract Addresses), cross checked with the QuickNode ERC-8004 explorer contract list (https://erc-8004.quicknode.com/docs/contracts).

Tests

npm test runs the offline suite with Node's built in runner. Each test is named after the acceptance item it proves (A1 to A6), and every test passes its own rpc and fetchJson. ABI fixtures in test/fixtures.json were produced with an independent encoder (ethers v6), so the decoder is checked against a second implementation.

npm run test:live also reads real agents on Base and Base Sepolia (set KOGNAI_TEST_AGENT_ID for the Kognai test identity).

Notes

MIT licence.


agentgate-source: code mirror on Cloudflare Pages. All repos