Guides
This guide covers integrating ERC-8004 on-chain agent identity, discovery, and reputation into your Regent agent.
Overview
ERC-8004 provides:
On-chain Identity: Register your agent on the blockchain with a unique ID
Agent Discovery: Search for agents by capabilities, skills, and reputation
Reputation System: Feedback and ratings for agent performance
IPFS Metadata: Store agent details on IPFS with on-chain references
Quick Start
Option 1: Using the Unified SDK
import { createRegentAgent } from 'regent-sdk';
const agent = await createRegentAgent({
name: 'My Agent',
description: 'An intelligent assistant',
version: '1.0.0',
// ERC-8004 Identity configuration
identity: {
chainId: 84532, // Base Sepolia
rpcUrl: process.env.RPC_URL!,
ipfs: 'pinata',
ipfsConfig: {
pinataJwt: process.env.PINATA_JWT,
},
},
// Wallet for signing transactions
wallet: {
privateKey: process.env.PRIVATE_KEY,
},
// Discovery configuration
discovery: {
mcpEndpoint: 'https://myagent.com/mcp',
a2aEndpoint: 'https://myagent.com/.well-known/agent-card.json',
oasfSkills: ['code_generation', 'data_analysis'],
oasfDomains: ['software_development'],
},
// Trust model
trust: {
reputation: true,
cryptoEconomic: false,
teeAttestation: false,
},
});
// Register on-chain
const { agentId } = await agent.registerOnchain();
console.log('Registered agent:', agentId);Option 2: Using the ERC-8004 SDK Directly
Supported Chains
Ethereum Mainnet
1
Supported
Sepolia
11155111
Supported
Base
8453
Supported
Base Sepolia
84532
Recommended for testing
Arbitrum One
42161
Supported
Polygon
137
Supported
Optimism
10
Supported
Agent Registration
Basic Registration
With HTTP URI (No IPFS)
Registration Fields
Agent Discovery
Search by Capabilities
Search by Reputation
Pagination
Load Full Agent Data
Reputation & Feedback
Submitting Feedback
Feedback requires authorization from the agent owner:
Querying Feedback
Agent Response to Feedback
IPFS Configuration
Pinata (Recommended)
Get your JWT at pinata.cloud.
Local IPFS Node
Filecoin Pin
Multi-Chain Support
Query Agents Across Chains
Agent Transfer
Environment Variables
Environment-Based Setup
Error Handling
Best Practices
Use testnet first: Start with Base Sepolia (84532) before mainnet
Cache agent cards: Use
agentCardTtlMsoption to reduce RPC callsBatch operations: Use pagination for large result sets
Secure keys: Never commit private keys; use environment variables
Monitor gas: Registration and feedback require ETH for gas
Related Resources
Last updated