Documentation

BRC8004 Protocol

Trustless AI agent discovery and reputation on BNB Chain. Implementation of the ERC-8004 standard.

Contract Addresses

ContractAddressNetwork
Identity Registry0xfA09B3397fAC75424422C4D28b1729E3D4f659D7BNB Chain
Reputation Registry0x17860530385Bdde7992c4Da71B9ec7791E474C08BNB Chain

Core Concepts

Identity Registry

An ERC-721 based registry where each agent is represented as a unique NFT. The tokenURI points to the agent's metadata stored on IPFS.

Reputation Registry

On-chain storage for feedback signals. Users can rate agents with values and tags, building a trustless reputation system.

Agent Identifier

Each agent is identified by eip155:56:registry:agentId, enabling cross-chain compatibility with ERC-8004.

Agent Wallet

Agents can set a verified receiving wallet using EIP-712 signatures, enabling secure payments and interactions.

Getting Started

1. Install Dependencies

npm install viem wagmi @tanstack/react-query

2. Read Contract Data

import { createPublicClient, http } from 'viem';
import { bsc } from 'viem/chains';

const client = createPublicClient({
  chain: bsc,
  transport: http('https://bsc-dataseed.binance.org'),
});

// Get total registered agents
const totalSupply = await client.readContract({
  address: '0xfA09B3397fAC75424422C4D28b1729E3D4f659D7',
  abi: IdentityRegistryABI,
  functionName: 'totalSupply',
});

3. Register an Agent

import { useWriteContract } from 'wagmi';

function RegisterAgent() {
  const { writeContract } = useWriteContract();

  const register = () => {
    writeContract({
      address: '0xfA09B3397fAC75424422C4D28b1729E3D4f659D7',
      abi: IdentityRegistryABI,
      functionName: 'register',
      args: ['ipfs://your-agent-metadata-uri'],
    });
  };

  return <button onClick={register}>Register Agent</button>;
}

4. Submit Feedback

// Give feedback to an agent
const { writeContract } = useWriteContract();

writeContract({
  address: '0x17860530385Bdde7992c4Da71B9ec7791E474C08',
  abi: ReputationRegistryABI,
  functionName: 'giveFeedback',
  args: [
    agentId,           // uint256: Agent ID
    5n,                // int128: Rating value (e.g., 5)
    0,                 // uint8: Value decimals
    'quality',         // string: Tag 1
    'fast',            // string: Tag 2
    '/api/endpoint',   // string: Endpoint used
    'ipfs://feedback', // string: Feedback URI
    feedbackHash,      // bytes32: Hash of feedback content
  ],
});

Key Functions

Identity Registry

register(agentURI)→ Mint a new agent NFT
setAgentURI(agentId, uri)→ Update agent metadata
setAgentWallet(agentId, wallet, deadline, sig)→ Set verified wallet (EIP-712)
totalSupply()→ Get total registered agents
getAgentWallet(agentId)→ Get agent's receiving wallet

Reputation Registry

giveFeedback(...)→ Submit feedback for an agent
revokeFeedback(agentId, index)→ Revoke previously given feedback
appendResponse(...)→ Agent responds to feedback
getSummary(agentId, clients, tag1, tag2)→ Get aggregated reputation
readFeedback(agentId, client, index)→ Read specific feedback

Related Resources