-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathllms-full.txt
More file actions
290 lines (223 loc) · 8.62 KB
/
llms-full.txt
File metadata and controls
290 lines (223 loc) · 8.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# ERC-8004 Agent Creator — Full Technical Reference
> Comprehensive reference for AI assistants integrating with ERC-8004 trustless AI agent on-chain identity.
## Overview
ERC-8004 defines a standard for registering AI agents as ERC-721 NFTs on EVM-compatible blockchains. The standard introduces three registries:
1. **IdentityRegistry** — Extends ERC-721 with `agentURI`, on-chain metadata, and wallet binding
2. **ReputationRegistry** — On-chain scored feedback (-128 to +127) with comments
3. **ValidationRegistry** — Third-party attestation and verification
Live at https://erc8004.agency. Source at https://github.com/nirholas/erc8004-agent-creator.
---
## Contract Addresses
All addresses share the `0x8004` vanity prefix deployed via CREATE2 through the SAFE Singleton Factory.
### BSC Testnet (Chain ID: 97)
- IdentityRegistry: `0x8004A818BFB912233c491871b3d84c89A494BD9e`
- ReputationRegistry: `0x8004B663056A597Dffe9eCcC1965A193B7388713`
- ValidationRegistry: `0x8004Cb1BF31DAf7788923b405b754f57acEB4272`
- RPC: `https://data-seed-prebsc-1-s1.bnbchain.org:8545`
- Explorer: `https://testnet.bscscan.com`
### BSC Mainnet (Chain ID: 56)
- IdentityRegistry: `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`
- ReputationRegistry: `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63`
- RPC: `https://bsc-dataseed.bnbchain.org`
- Explorer: `https://bscscan.com`
### Ethereum Mainnet (Chain ID: 1)
- IdentityRegistry: `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`
- ReputationRegistry: `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63`
- RPC: `https://eth.llamarpc.com`
- Explorer: `https://etherscan.io`
### Ethereum Sepolia (Chain ID: 11155111)
- IdentityRegistry: `0x8004A818BFB912233c491871b3d84c89A494BD9e`
- ReputationRegistry: `0x8004B663056A597Dffe9eCcC1965A193B7388713`
- RPC: `https://rpc.sepolia.org`
- Explorer: `https://sepolia.etherscan.io`
### CAIP-10 Agent Registry Format
```
eip155:97:0x8004A818BFB912233c491871b3d84c89A494BD9e # BSC Testnet
eip155:56:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 # BSC Mainnet
eip155:1:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 # Ethereum
eip155:11155111:0x8004A818BFB912233c491871b3d84c89A494BD9e # Sepolia
```
---
## ABI — IdentityRegistry
```solidity
// Registration
function register() external returns (uint256 agentId)
function register(string agentURI) external returns (uint256 agentId)
function register(string agentURI, MetadataEntry[] metadata) external returns (uint256 agentId)
// URI Management
function setAgentURI(uint256 agentId, string newURI) external
function tokenURI(uint256 tokenId) external view returns (string)
// Metadata
function setMetadata(uint256 agentId, string metadataKey, bytes metadataValue) external
function getMetadata(uint256 agentId, string metadataKey) external view returns (bytes)
// Ownership
function getAgentWallet(uint256 agentId) external view returns (address)
function ownerOf(uint256 tokenId) external view returns (address)
function balanceOf(address owner) external view returns (uint256)
// Info
function getVersion() external pure returns (string)
function name() external view returns (string)
function symbol() external view returns (string)
// Events
event Registered(uint256 indexed agentId, string agentURI, address indexed owner)
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
// MetadataEntry struct
struct MetadataEntry {
string metadataKey;
bytes metadataValue;
}
```
## ABI — ReputationRegistry
```solidity
function submitFeedback(uint256 agentId, int8 score, string comment) external
function getFeedbackCount(uint256 agentId) external view returns (uint256)
function getAverageScore(uint256 agentId) external view returns (int256)
function getFeedback(uint256 agentId, uint256 index) external view returns (
address reviewer, int8 score, string comment, uint256 timestamp
)
event FeedbackSubmitted(uint256 indexed agentId, address indexed reviewer, int8 score, string comment)
```
## ABI — ValidationRegistry
```solidity
function validate(uint256 agentId, string attestationType, bytes attestationData) external
function isValidated(uint256 agentId, string attestationType) external view returns (bool)
function getValidation(uint256 agentId, string attestationType) external view returns (
address validator, bytes attestationData, uint256 timestamp
)
event Validated(uint256 indexed agentId, address indexed validator, string attestationType)
```
---
## Agent Metadata JSON Schema
When registering via the web UI, the agent URI points to JSON metadata:
```json
{
"name": "My DeFi Agent",
"description": "Autonomous DeFi trading agent on BSC",
"version": "1.0.0",
"agentId": "42",
"agentRegistry": "eip155:97:0x8004A818BFB912233c491871b3d84c89A494BD9e",
"services": [
{
"type": "a2a",
"endpoint": "https://myagent.com/.well-known/agent.json"
},
{
"type": "mcp",
"endpoint": "https://myagent.com/mcp"
}
],
"trustModels": ["reputation", "crypto-economic"],
"x402Enabled": true,
"metadata": {
"did": "did:web:myagent.com",
"ens": "myagent.eth"
}
}
```
### URI Storage Options
1. **On-chain base64**: `data:application/json;base64,eyJuYW1l...` (stored directly in contract)
2. **IPFS**: `ipfs://QmXx...` (content-addressed, immutable)
3. **HTTPS**: `https://myagent.com/agent.json` (mutable, requires hosting)
---
## Code Examples
### Register an Agent (ethers.js v6)
```javascript
import { ethers } from 'ethers';
const IDENTITY_ABI = [
"function register(string agentURI) external returns (uint256 agentId)",
"event Registered(uint256 indexed agentId, string agentURI, address indexed owner)"
];
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const registry = new ethers.Contract(
'0x8004A818BFB912233c491871b3d84c89A494BD9e',
IDENTITY_ABI,
signer
);
const metadata = {
name: "My Agent",
description: "DeFi trading bot",
version: "1.0.0",
services: [{ type: "a2a", endpoint: "https://myagent.com/.well-known/agent.json" }]
};
const uri = "data:application/json;base64," + btoa(JSON.stringify(metadata));
const tx = await registry['register(string)'](uri);
const receipt = await tx.wait();
console.log("Registered! TX:", receipt.hash);
```
### Look Up an Agent
```javascript
const tokenURI = await registry.tokenURI(42);
const base64 = tokenURI.replace('data:application/json;base64,', '');
const metadata = JSON.parse(atob(base64));
console.log(metadata);
```
### Submit Reputation
```javascript
const REPUTATION_ABI = [
"function submitFeedback(uint256 agentId, int8 score, string comment) external"
];
const reputation = new ethers.Contract(
'0x8004B663056A597Dffe9eCcC1965A193B7388713',
REPUTATION_ABI,
signer
);
await reputation.submitFeedback(42, 100, "Excellent DeFi agent");
```
### Using the MCP Server
```bash
# Install and run
npx @nirholas/erc8004-mcp
# Claude Desktop config
{
"mcpServers": {
"erc8004": {
"command": "npx",
"args": ["@nirholas/erc8004-mcp"],
"env": { "PRIVATE_KEY": "0x..." }
}
}
}
```
---
## Integration Patterns
### Embed via iframe
```html
<iframe src="https://erc8004.agency" width="100%" height="800" frameborder="0"></iframe>
```
### Direct Link
```
https://erc8004.agency
```
### Self-Host
Download `index.html` and serve from any static host. Zero dependencies.
### React Hook
```typescript
import { ethers } from 'ethers';
function useERC8004(chainId: number) {
const addresses = {
97: '0x8004A818BFB912233c491871b3d84c89A494BD9e',
56: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
1: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
};
// ... implementation
}
```
---
## Trust Models
ERC-8004 supports three trust models:
1. **Reputation-based** — On-chain feedback scoring via ReputationRegistry
2. **Crypto-economic** — Staking/bonding for economic security (planned)
3. **TEE attestation** — Trusted Execution Environment verification (planned)
---
## Keywords
erc-8004, erc8004, trustless agents, ai agents, on-chain identity, agent nft, erc-721, a2a protocol, mcp server, model context protocol, agent discovery, agent reputation, web3 ai, defi agents, autonomous agents, x402, micropayments, agent economy, vibecoder, vibe coding, ai agent creator, agent registry, bsc, bnb chain, ethereum, multi-chain, zero dependency
---
## Links
- Web UI: https://erc8004.agency
- GitHub: https://github.com/nirholas/erc8004-agent-creator
- MCP Server: https://www.npmjs.com/package/@nirholas/erc8004-mcp
- EIP Spec: https://eips.ethereum.org/EIPS/eip-8004
- Contracts Source: https://github.com/erc-8004/erc-8004-contracts
- BNB Chain AI Toolkit: https://github.com/nirholas/bnb-chain-toolkit
- Documentation: https://erc8004.agency/docs