@basecred/openclaw-8004 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/SKILL.md +881 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# OpenClaw ERC-8004 Agent Registration
|
|
2
|
+
|
|
3
|
+
An OpenClaw skill that teaches AI agents to register and manage on-chain identities on Base mainnet via [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) using the [agent0-sdk](https://github.com/agent0lab/agent0-ts).
|
|
4
|
+
|
|
5
|
+
> **HTTP registration only.** This skill covers on-chain registration via HTTP URIs (`agent.registerHTTP()`). IPFS registration is **not** covered.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @basecred/openclaw-8004
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or copy `SKILL.md` directly into your agent's skill directory.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js** >= 22
|
|
18
|
+
- **agent0-sdk** `^1.5.3`
|
|
19
|
+
- A private key with ETH on **Base mainnet** (for gas)
|
|
20
|
+
- A Base RPC URL (default: `https://mainnet.base.org`)
|
|
21
|
+
|
|
22
|
+
## What This Skill Does
|
|
23
|
+
|
|
24
|
+
| Operation | Description |
|
|
25
|
+
|-----------|-------------|
|
|
26
|
+
| **Register** | Create an on-chain agent identity (ERC-721 NFT) |
|
|
27
|
+
| **Update** | Modify name, description, endpoints, skills, metadata |
|
|
28
|
+
| **Give Feedback** | Submit on-chain reputation scores for other agents |
|
|
29
|
+
| **Search Feedback** | Query reputation summaries and feedback history |
|
|
30
|
+
| **Transfer** | Move agent ownership to a new wallet |
|
|
31
|
+
|
|
32
|
+
## Files
|
|
33
|
+
|
|
34
|
+
| File | Description |
|
|
35
|
+
|---|---|
|
|
36
|
+
| **SKILL.md** | Full agent instructions |
|
|
37
|
+
| **README.md** | Quick-start guide (this file) |
|
|
38
|
+
| **IDENTITY.md** | Agent profile card (created after registration) |
|
|
39
|
+
|
|
40
|
+
## Environment Variables
|
|
41
|
+
|
|
42
|
+
| Variable | Required | Description |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `WALLET_PRIVATE_KEY` | Yes | Private key for signing transactions |
|
|
45
|
+
| `BASE_RPC_URL` | No | Base RPC endpoint (default: `https://mainnet.base.org`) |
|
|
46
|
+
| `AGENT0_AGENT_ID` | Auto | Set after registration (e.g. `8453:42`) |
|
|
47
|
+
|
|
48
|
+
Store these in a `.env` file in the project root. Never commit `.env` to version control.
|
|
49
|
+
|
|
50
|
+
## Contracts (Base Mainnet)
|
|
51
|
+
|
|
52
|
+
| Contract | Address |
|
|
53
|
+
|----------|---------|
|
|
54
|
+
| Identity Registry | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` |
|
|
55
|
+
| Reputation Registry | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` |
|
|
56
|
+
|
|
57
|
+
## How It Works
|
|
58
|
+
|
|
59
|
+
1. **First run** — the agent asks the owner for credentials and saves them to `.env`
|
|
60
|
+
2. **Registration** — the agent gathers profile info, previews a draft, and registers on-chain after owner approval
|
|
61
|
+
3. **IDENTITY.md** — after registration, the agent offers to save a local profile card
|
|
62
|
+
4. **Subsequent runs** — the agent presents an action menu (update, feedback, search, transfer, view profile) and waits for the owner's choice
|
|
63
|
+
5. **Every transaction** — the agent always previews a draft and waits for explicit owner approval before signing
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
See [SKILL.md](./SKILL.md) for complete agent instructions including:
|
|
68
|
+
|
|
69
|
+
- Decision tree with action menu for returning users
|
|
70
|
+
- Draft preview before every on-chain transaction
|
|
71
|
+
- Step-by-step registration flow with IDENTITY.md generation
|
|
72
|
+
- SDK code examples for every operation
|
|
73
|
+
- Error handling table
|
|
74
|
+
- Security guidelines
|
|
75
|
+
- Full example interaction
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,881 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openclaw-8004
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Register, manage, and build reputation for your AI agent on-chain via ERC-8004
|
|
5
|
+
metadata:
|
|
6
|
+
emoji: "\U0001F916"
|
|
7
|
+
category: "identity"
|
|
8
|
+
chain: "base"
|
|
9
|
+
chainId: 8453
|
|
10
|
+
contracts:
|
|
11
|
+
identity_registry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
|
|
12
|
+
reputation_registry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# OpenClaw ERC-8004 Agent Registration
|
|
16
|
+
|
|
17
|
+
Register your AI agent on-chain as an ERC-721 identity on Base mainnet. Advertise capabilities, receive feedback, and build reputation — all permissionless, no intermediaries.
|
|
18
|
+
|
|
19
|
+
> **HTTP registration only.** This skill covers on-chain registration via HTTP URIs (`agent.registerHTTP()`). IPFS registration is **not** covered.
|
|
20
|
+
|
|
21
|
+
| File | Description |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **SKILL.md** (this file) | Full agent instructions |
|
|
24
|
+
| **README.md** | Quick-start guide |
|
|
25
|
+
| **IDENTITY.md** | Agent profile card (created after registration) |
|
|
26
|
+
|
|
27
|
+
## When to Use This Skill
|
|
28
|
+
|
|
29
|
+
Use this skill whenever you need to:
|
|
30
|
+
- Register yourself as an on-chain agent identity
|
|
31
|
+
- Advertise your MCP tools, A2A skills, or other capabilities
|
|
32
|
+
- Receive or give feedback to other agents
|
|
33
|
+
- Check your reputation score
|
|
34
|
+
- Update your agent profile (name, description, endpoints)
|
|
35
|
+
- Transfer ownership of your agent identity to a new wallet
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
- **Node.js** >= 22
|
|
42
|
+
- **agent0-sdk** `^1.5.3` (`npm install agent0-sdk`)
|
|
43
|
+
- A **private key** with ETH on Base mainnet (for gas)
|
|
44
|
+
- A **Base RPC URL** (default: `https://mainnet.base.org`)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Start Here (Decision Tree)
|
|
49
|
+
|
|
50
|
+
Run this decision tree every time this skill is invoked:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
1. Load environment from .env file (+ process.env overrides)
|
|
54
|
+
|
|
55
|
+
2. If .env does not exist OR WALLET_PRIVATE_KEY is missing:
|
|
56
|
+
→ Run "First-Time Setup"
|
|
57
|
+
|
|
58
|
+
3. If WALLET_PRIVATE_KEY is present:
|
|
59
|
+
a. If AGENT0_AGENT_ID is missing:
|
|
60
|
+
→ Run "Register Agent"
|
|
61
|
+
b. If AGENT0_AGENT_ID is present:
|
|
62
|
+
→ Agent is registered. Ask the owner what they want to do.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Ask the Owner (Action Menu)
|
|
66
|
+
|
|
67
|
+
When the agent is already registered, **always present this menu** to the owner:
|
|
68
|
+
|
|
69
|
+
> Your agent **{agent_name}** (ID: {agent_id}) is registered on Base.
|
|
70
|
+
>
|
|
71
|
+
> What would you like to do?
|
|
72
|
+
>
|
|
73
|
+
> 1. **Update Agent** — modify name, description, endpoints, skills, or metadata
|
|
74
|
+
> 2. **Give Feedback** — rate another agent on-chain
|
|
75
|
+
> 3. **Search Feedback** — check reputation for any agent
|
|
76
|
+
> 4. **Transfer Ownership** — move your agent identity to a new wallet
|
|
77
|
+
> 5. **View Profile** — show your current IDENTITY.md
|
|
78
|
+
>
|
|
79
|
+
> Pick a number, or describe what you need.
|
|
80
|
+
|
|
81
|
+
**Wait for the owner's choice before proceeding.** Do not assume an action.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## First-Time Setup
|
|
86
|
+
|
|
87
|
+
Before you can register, you need credentials from your owner.
|
|
88
|
+
|
|
89
|
+
Ask your owner directly. Use this message:
|
|
90
|
+
|
|
91
|
+
> I'd like to register as an on-chain agent on Base via ERC-8004. I need:
|
|
92
|
+
> 1. A **private key** for signing transactions (this wallet needs ETH on Base for gas)
|
|
93
|
+
> 2. A **Base RPC URL** (or I'll use the default: `https://mainnet.base.org`)
|
|
94
|
+
>
|
|
95
|
+
> Your private key will be stored in a local `.env` file and never shared.
|
|
96
|
+
|
|
97
|
+
Wait for the private key before proceeding. The RPC URL is optional (defaults to `https://mainnet.base.org`).
|
|
98
|
+
|
|
99
|
+
**Before saving, check for an existing `.env` file:**
|
|
100
|
+
|
|
101
|
+
1. If `.env` already exists, ask the owner: *"I found an existing `.env` file. Does it already contain a `WALLET_PRIVATE_KEY`?"*
|
|
102
|
+
2. If yes — do **not** overwrite it. Only append missing keys (e.g., `BASE_RPC_URL`, `AGENT0_AGENT_ID`).
|
|
103
|
+
3. If no — append the new keys to the existing file.
|
|
104
|
+
4. If `.env` does not exist — create it.
|
|
105
|
+
|
|
106
|
+
**Save credentials to `.env` in the project root:**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
WALLET_PRIVATE_KEY=0x...
|
|
110
|
+
BASE_RPC_URL=https://mainnet.base.org
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Ensure `.env` is in `.gitignore`** — never commit secrets to version control.
|
|
114
|
+
|
|
115
|
+
Proceed to "Register Agent".
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## SDK Initialization
|
|
120
|
+
|
|
121
|
+
Use this code block at the start of every operation:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import 'dotenv/config';
|
|
125
|
+
import { SDK } from 'agent0-sdk';
|
|
126
|
+
|
|
127
|
+
const sdk = new SDK({
|
|
128
|
+
chainId: 8453,
|
|
129
|
+
rpcUrl: process.env.BASE_RPC_URL || 'https://mainnet.base.org',
|
|
130
|
+
privateKey: process.env.WALLET_PRIVATE_KEY!,
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**No IPFS configuration is needed.** This skill uses HTTP registration only.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Transaction Safety (Non-Negotiable)
|
|
139
|
+
|
|
140
|
+
**Before every on-chain transaction (register, update, feedback, transfer), you MUST:**
|
|
141
|
+
|
|
142
|
+
1. **Build a draft preview** summarizing exactly what will be submitted on-chain
|
|
143
|
+
2. **Present the draft to the owner** and ask for explicit approval
|
|
144
|
+
3. **Only sign and submit after the owner confirms**
|
|
145
|
+
|
|
146
|
+
Never skip the preview. On-chain actions cost gas and are irreversible.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Register Agent
|
|
151
|
+
|
|
152
|
+
### Step 1: Pre-Fill from Existing Files
|
|
153
|
+
|
|
154
|
+
Before asking the owner for details, scan the project for files that may already contain agent information. Use any values found as **pre-filled defaults** — the owner can accept, edit, or override them.
|
|
155
|
+
|
|
156
|
+
| File | What to extract |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `IDENTITY.md` | Name, description, image, endpoints (MCP, A2A), ENS, OASF skills/domains, trust models, metadata |
|
|
159
|
+
| `TOOLS.md` | Tool names and descriptions — suggest as MCP capabilities or OASF skills |
|
|
160
|
+
| `README.md` | Project name and description — suggest as agent name and description |
|
|
161
|
+
| `package.json` | `name`, `description`, `homepage` — suggest as agent name, description, HTTP URL |
|
|
162
|
+
| `SKILL.md` (other skills) | Skill names and categories — suggest as OASF skills |
|
|
163
|
+
| `.env` | `AGENT0_AGENT_ID` (skip registration if already set), `BASE_RPC_URL` |
|
|
164
|
+
|
|
165
|
+
**Rules:**
|
|
166
|
+
- Only read files that exist — do not error on missing files
|
|
167
|
+
- Never extract secrets (private keys, API keys) from any file
|
|
168
|
+
- Present all pre-filled values clearly so the owner can review them
|
|
169
|
+
- If no files are found, proceed with empty fields as normal
|
|
170
|
+
|
|
171
|
+
### Step 2: Gather Agent Info
|
|
172
|
+
|
|
173
|
+
Present pre-filled values (if any) and ask the owner to confirm or edit:
|
|
174
|
+
|
|
175
|
+
**Required:**
|
|
176
|
+
- **Agent name** — a display name for your agent (e.g. "Alice's Research Agent")
|
|
177
|
+
- **Description** — what your agent does (e.g. "Analyzes on-chain data and generates reports")
|
|
178
|
+
|
|
179
|
+
**Optional:**
|
|
180
|
+
- **Image URL** — a publicly accessible URL for your agent's avatar
|
|
181
|
+
- **MCP endpoint** — if your agent exposes MCP tools (e.g. `https://mcp.example.com/`)
|
|
182
|
+
- **A2A endpoint** — if your agent exposes A2A skills (e.g. `https://a2a.example.com/agent-card.json`)
|
|
183
|
+
- **ENS name** — a human-readable name (e.g. `myagent.eth`)
|
|
184
|
+
- **HTTP URL** — where to host your registration file (e.g. `https://myserver.com/agents/my-agent.json`)
|
|
185
|
+
- **OASF skills** — standardized skill categories (e.g. `data_engineering/data_transformation_pipeline`)
|
|
186
|
+
- **OASF domains** — standardized domain categories (e.g. `finance_and_business/investment_services`)
|
|
187
|
+
- **Trust models** — which trust models to advertise: `reputation`, `crypto-economic`, `tee-attestation`
|
|
188
|
+
- **Metadata** — key-value pairs for additional info (e.g. `{ version: '1.0.0', category: 'ai-assistant' }`)
|
|
189
|
+
|
|
190
|
+
If pre-filled values were found, present them like this:
|
|
191
|
+
|
|
192
|
+
> I found existing project files and pre-filled some fields. Please review:
|
|
193
|
+
>
|
|
194
|
+
> - **Name:** My AI Agent *(from package.json)*
|
|
195
|
+
> - **Description:** An intelligent assistant for tasks. *(from README.md)*
|
|
196
|
+
> - **MCP Endpoint:** https://mcp.example.com/ *(from IDENTITY.md)*
|
|
197
|
+
> - **Skills:** data_transformation_pipeline *(from TOOLS.md)*
|
|
198
|
+
>
|
|
199
|
+
> Edit any field, or say "looks good" to continue.
|
|
200
|
+
|
|
201
|
+
### Step 3: Create and Configure Agent
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
// Create the agent
|
|
205
|
+
const agent = sdk.createAgent(
|
|
206
|
+
'My AI Agent', // name
|
|
207
|
+
'An intelligent assistant for tasks.', // description
|
|
208
|
+
'https://example.com/agent-image.png' // image URL (optional)
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
// Configure endpoints (optional — each auto-extracts capabilities)
|
|
212
|
+
await agent.setMCP('https://mcp.example.com/'); // extracts tools, prompts, resources
|
|
213
|
+
await agent.setA2A('https://a2a.example.com/agent-card.json'); // extracts skills
|
|
214
|
+
agent.setENS('myagent.eth');
|
|
215
|
+
|
|
216
|
+
// Add OASF skills and domains (optional)
|
|
217
|
+
agent.addSkill('data_engineering/data_transformation_pipeline', true);
|
|
218
|
+
agent.addDomain('finance_and_business/investment_services', true);
|
|
219
|
+
|
|
220
|
+
// Set trust models (optional): reputation, cryptoEconomic, teeAttestation
|
|
221
|
+
agent.setTrust(true, false, false);
|
|
222
|
+
|
|
223
|
+
// Add metadata (optional)
|
|
224
|
+
agent.setMetadata({ version: '1.0.0', category: 'ai-assistant' });
|
|
225
|
+
|
|
226
|
+
// Set agent as active
|
|
227
|
+
agent.setActive(true);
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Step 4: Preview Draft
|
|
231
|
+
|
|
232
|
+
Before signing, present a summary to the owner for approval:
|
|
233
|
+
|
|
234
|
+
> Here's what I'm about to register on-chain:
|
|
235
|
+
>
|
|
236
|
+
> - **Name:** My AI Agent
|
|
237
|
+
> - **Description:** An intelligent assistant for tasks.
|
|
238
|
+
> - **Image:** https://example.com/agent-image.png
|
|
239
|
+
> - **MCP Endpoint:** https://mcp.example.com/
|
|
240
|
+
> - **A2A Endpoint:** https://a2a.example.com/agent-card.json
|
|
241
|
+
> - **ENS:** myagent.eth
|
|
242
|
+
> - **OASF Skills:** data_engineering/data_transformation_pipeline
|
|
243
|
+
> - **OASF Domains:** finance_and_business/investment_services
|
|
244
|
+
> - **Trust Models:** reputation
|
|
245
|
+
> - **Registration URI:** https://myserver.com/agents/my-agent.json
|
|
246
|
+
>
|
|
247
|
+
> This will mint an ERC-721 NFT on Base and cost gas. Shall I proceed?
|
|
248
|
+
|
|
249
|
+
**Do NOT submit the transaction until the owner confirms.**
|
|
250
|
+
|
|
251
|
+
### Step 5: Register On-Chain via HTTP
|
|
252
|
+
|
|
253
|
+
The `registerHTTP()` call does three things:
|
|
254
|
+
1. Serializes your agent's registration file (name, description, endpoints, skills, metadata) as JSON
|
|
255
|
+
2. Mints an ERC-721 NFT on-chain representing your agent identity
|
|
256
|
+
3. Records the HTTP URL on-chain as the agent's URI, pointing to the hosted registration file
|
|
257
|
+
|
|
258
|
+
**The SDK generates the JSON automatically** — the owner must ensure the HTTP URL serves the file. The simplest approach is a static file on any HTTPS-accessible server or CDN.
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// Register with HTTP URI (no IPFS required)
|
|
262
|
+
const txHandle = await agent.registerHTTP('https://myserver.com/agents/my-agent.json');
|
|
263
|
+
const { result: registration } = await txHandle.waitConfirmed();
|
|
264
|
+
|
|
265
|
+
console.log(`Agent ID: ${registration.agentId}`); // e.g. "8453:42"
|
|
266
|
+
console.log(`Agent URI: ${registration.agentURI}`); // the HTTP URL
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Step 6: Save Agent ID
|
|
270
|
+
|
|
271
|
+
Append the agent ID to your `.env` file:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
AGENT0_AGENT_ID=8453:42
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Step 7: Deliver Confirmation
|
|
278
|
+
|
|
279
|
+
Send a confirmation to your owner:
|
|
280
|
+
|
|
281
|
+
> Your agent has been registered on-chain on Base mainnet!
|
|
282
|
+
>
|
|
283
|
+
> - **Agent ID:** 8453:42
|
|
284
|
+
> - **Name:** My AI Agent
|
|
285
|
+
> - **Registration URI:** https://myserver.com/agents/my-agent.json
|
|
286
|
+
>
|
|
287
|
+
> Your agent is now discoverable by any ERC-8004 compatible app or agent.
|
|
288
|
+
|
|
289
|
+
### Step 8: Offer to Save IDENTITY.md
|
|
290
|
+
|
|
291
|
+
After registration, ask the owner:
|
|
292
|
+
|
|
293
|
+
> Would you like me to save your agent profile to an `IDENTITY.md` file? This creates a local reference card with your agent's on-chain identity — useful for other tools, agents, or documentation.
|
|
294
|
+
|
|
295
|
+
If the owner agrees, create `IDENTITY.md` in the project root with the following format:
|
|
296
|
+
|
|
297
|
+
```markdown
|
|
298
|
+
# Agent Identity
|
|
299
|
+
|
|
300
|
+
| Field | Value |
|
|
301
|
+
|---|---|
|
|
302
|
+
| **Agent ID** | 8453:42 |
|
|
303
|
+
| **Name** | My AI Agent |
|
|
304
|
+
| **Description** | An intelligent assistant for tasks. |
|
|
305
|
+
| **Chain** | Base (8453) |
|
|
306
|
+
| **Registration URI** | https://myserver.com/agents/my-agent.json |
|
|
307
|
+
| **Image** | https://example.com/agent-image.png |
|
|
308
|
+
| **MCP Endpoint** | https://mcp.example.com/ |
|
|
309
|
+
| **A2A Endpoint** | https://a2a.example.com/agent-card.json |
|
|
310
|
+
| **ENS** | myagent.eth |
|
|
311
|
+
| **OASF Skills** | data_engineering/data_transformation_pipeline |
|
|
312
|
+
| **OASF Domains** | finance_and_business/investment_services |
|
|
313
|
+
| **Trust Models** | reputation |
|
|
314
|
+
| **Active** | true |
|
|
315
|
+
| **Registered** | 2025-01-15 |
|
|
316
|
+
|
|
317
|
+
> On-chain identity minted as ERC-721 on Base mainnet.
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Rules:**
|
|
321
|
+
- Only include fields that have values — omit empty rows
|
|
322
|
+
- Use the actual registration date (from the transaction timestamp or current date)
|
|
323
|
+
- If `IDENTITY.md` already exists, ask before overwriting
|
|
324
|
+
- Never include the private key, wallet address, or any secrets
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Update Agent
|
|
329
|
+
|
|
330
|
+
Load your existing agent, modify properties, and re-register.
|
|
331
|
+
|
|
332
|
+
### Step 1: Load Agent
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
const agent = await sdk.loadAgent(process.env.AGENT0_AGENT_ID!); // e.g. '8453:42'
|
|
336
|
+
console.log(`Loaded: ${agent.name}`);
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Step 2: Modify Configuration
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
// Update basic info
|
|
343
|
+
agent.updateInfo(
|
|
344
|
+
'Updated Agent Name',
|
|
345
|
+
'New description with enhanced capabilities.'
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
// Update or add endpoints
|
|
349
|
+
await agent.setMCP('https://mcp-v2.example.com/');
|
|
350
|
+
await agent.setA2A('https://a2a-v2.example.com/agent-card.json');
|
|
351
|
+
|
|
352
|
+
// Remove an endpoint
|
|
353
|
+
agent.removeEndpoint({ type: 'A2A' });
|
|
354
|
+
|
|
355
|
+
// Add/remove OASF skills
|
|
356
|
+
agent.addSkill('advanced_reasoning_planning/strategic_planning', true);
|
|
357
|
+
agent.removeSkill('data_engineering/data_transformation_pipeline');
|
|
358
|
+
|
|
359
|
+
// Update metadata
|
|
360
|
+
agent.setMetadata({ version: '2.0.0', pricing: '0.02' });
|
|
361
|
+
agent.delMetadata('category'); // remove a key
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Step 3: Preview Draft
|
|
365
|
+
|
|
366
|
+
Before signing, present the updated configuration to the owner:
|
|
367
|
+
|
|
368
|
+
> Here's what will be updated on-chain:
|
|
369
|
+
>
|
|
370
|
+
> - **Name:** Updated Agent Name
|
|
371
|
+
> - **Description:** New description with enhanced capabilities.
|
|
372
|
+
> - **MCP Endpoint:** https://mcp-v2.example.com/
|
|
373
|
+
> - **Skills Added:** advanced_reasoning_planning/strategic_planning
|
|
374
|
+
> - **Skills Removed:** data_engineering/data_transformation_pipeline
|
|
375
|
+
> - **Metadata:** version=2.0.0, pricing=0.02
|
|
376
|
+
> - **Registration URI:** https://myserver.com/agents/my-agent.json
|
|
377
|
+
>
|
|
378
|
+
> This will update the on-chain URI and cost gas. Shall I proceed?
|
|
379
|
+
|
|
380
|
+
**Do NOT submit the transaction until the owner confirms.**
|
|
381
|
+
|
|
382
|
+
### Step 4: Re-Register
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
const txHandle = await agent.registerHTTP('https://myserver.com/agents/my-agent.json');
|
|
386
|
+
const { result: updated } = await txHandle.waitConfirmed();
|
|
387
|
+
console.log(`Updated URI: ${updated.agentURI}`);
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Step 5: Confirm Update
|
|
391
|
+
|
|
392
|
+
> Your agent profile has been updated on-chain.
|
|
393
|
+
>
|
|
394
|
+
> - **Agent ID:** 8453:42
|
|
395
|
+
> - **New Name:** Updated Agent Name
|
|
396
|
+
> - **Updated URI:** https://myserver.com/agents/my-agent.json
|
|
397
|
+
|
|
398
|
+
### Step 6: Offer to Update IDENTITY.md
|
|
399
|
+
|
|
400
|
+
If `IDENTITY.md` exists, ask the owner:
|
|
401
|
+
|
|
402
|
+
> Your on-chain profile has changed. Would you like me to update `IDENTITY.md` to match?
|
|
403
|
+
|
|
404
|
+
If yes, regenerate the file using the same format as in "Register Agent → Step 7". If `IDENTITY.md` does not exist, offer to create it.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Give Feedback
|
|
409
|
+
|
|
410
|
+
Submit on-chain feedback for another agent. This is the simple on-chain-only approach (no IPFS feedback file).
|
|
411
|
+
|
|
412
|
+
### Parameters
|
|
413
|
+
|
|
414
|
+
| Parameter | Required | Description |
|
|
415
|
+
|-----------|----------|-------------|
|
|
416
|
+
| `agentId` | Yes | The target agent's ID (e.g. `8453:99`) |
|
|
417
|
+
| `value` | Yes | Reputation score (signed decimal — positive = good, negative = bad) |
|
|
418
|
+
| `tag1` | No | First tag for categorization (e.g. `data_analyst`) |
|
|
419
|
+
| `tag2` | No | Second tag (e.g. `enterprise`) |
|
|
420
|
+
| `endpoint` | No | Specific endpoint being rated (e.g. `tools`) |
|
|
421
|
+
|
|
422
|
+
### Preview Draft
|
|
423
|
+
|
|
424
|
+
Before signing, present the feedback to the owner:
|
|
425
|
+
|
|
426
|
+
> Here's the feedback I'm about to submit on-chain:
|
|
427
|
+
>
|
|
428
|
+
> - **Target Agent:** 8453:99
|
|
429
|
+
> - **Score:** 85
|
|
430
|
+
> - **Tag 1:** data_analyst
|
|
431
|
+
> - **Tag 2:** enterprise
|
|
432
|
+
> - **Endpoint:** tools
|
|
433
|
+
>
|
|
434
|
+
> This will cost gas. Shall I proceed?
|
|
435
|
+
|
|
436
|
+
**Do NOT submit the transaction until the owner confirms.**
|
|
437
|
+
|
|
438
|
+
### Submit
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
const tx = await sdk.giveFeedback(
|
|
442
|
+
'8453:99', // agentId
|
|
443
|
+
85, // value (positive = good feedback)
|
|
444
|
+
'data_analyst', // tag1 (optional)
|
|
445
|
+
'enterprise', // tag2 (optional)
|
|
446
|
+
'tools' // endpoint (optional)
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
const { receipt, result: feedback } = await tx.waitConfirmed();
|
|
450
|
+
console.log(`Feedback submitted! Tx: ${receipt.transactionHash}`);
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Deliver Confirmation
|
|
454
|
+
|
|
455
|
+
> Feedback submitted on-chain for agent 8453:99.
|
|
456
|
+
>
|
|
457
|
+
> - **Score:** 85
|
|
458
|
+
> - **Tags:** data_analyst, enterprise
|
|
459
|
+
> - **Endpoint:** tools
|
|
460
|
+
> - **Transaction:** 0xabc123...
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Search Feedback
|
|
465
|
+
|
|
466
|
+
Query feedback history and reputation for any agent.
|
|
467
|
+
|
|
468
|
+
### Get Reputation Summary
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
// Overall reputation
|
|
472
|
+
const summary = await sdk.getReputationSummary('8453:99');
|
|
473
|
+
console.log(`Total reviews: ${summary.count}`);
|
|
474
|
+
console.log(`Average rating: ${summary.averageValue}`);
|
|
475
|
+
|
|
476
|
+
// Filtered by tag
|
|
477
|
+
const taggedSummary = await sdk.getReputationSummary(
|
|
478
|
+
'8453:99',
|
|
479
|
+
'data_analyst' // tag1
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
// Filtered by two tags
|
|
483
|
+
const dualTagSummary = await sdk.getReputationSummary(
|
|
484
|
+
'8453:99',
|
|
485
|
+
'data_analyst', // tag1
|
|
486
|
+
'enterprise' // tag2
|
|
487
|
+
);
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Search Feedback Entries
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
// All feedback for an agent
|
|
494
|
+
const feedback = await sdk.searchFeedback(
|
|
495
|
+
{ agentId: '8453:99' }
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
// Filtered by value range
|
|
499
|
+
const highRated = await sdk.searchFeedback(
|
|
500
|
+
{ agentId: '8453:99' },
|
|
501
|
+
{ minValue: 70, maxValue: 100 }
|
|
502
|
+
);
|
|
503
|
+
|
|
504
|
+
// Filtered by tags
|
|
505
|
+
const tagged = await sdk.searchFeedback({
|
|
506
|
+
agentId: '8453:99',
|
|
507
|
+
tags: ['data_analyst', 'enterprise'],
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// Filtered by capabilities and skills
|
|
511
|
+
const skilled = await sdk.searchFeedback({
|
|
512
|
+
agentId: '8453:99',
|
|
513
|
+
capabilities: ['tools', 'prompts'],
|
|
514
|
+
skills: ['financial_analysis'],
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
// Display results
|
|
518
|
+
for (const fb of feedback) {
|
|
519
|
+
console.log(`Reviewer: ${fb.reviewer}`);
|
|
520
|
+
console.log(`Value: ${fb.value}`);
|
|
521
|
+
console.log(`Tags: ${fb.tags.join(', ')}`);
|
|
522
|
+
console.log(`Endpoint: ${fb.endpoint ?? 'N/A'}`);
|
|
523
|
+
console.log(`Revoked: ${fb.isRevoked}`);
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Deliver Results
|
|
528
|
+
|
|
529
|
+
Translate reputation data into plain language:
|
|
530
|
+
|
|
531
|
+
> Here's the reputation summary for agent 8453:99:
|
|
532
|
+
>
|
|
533
|
+
> - **Total reviews:** 42
|
|
534
|
+
> - **Average rating:** 87.3
|
|
535
|
+
>
|
|
536
|
+
> This agent has strong positive feedback, especially for data analysis capabilities.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## Transfer Ownership
|
|
541
|
+
|
|
542
|
+
Transfer your agent's ERC-721 identity to a new wallet address.
|
|
543
|
+
|
|
544
|
+
**WARNING:** This transfers the NFT representing your agent identity. The new owner will have full control. This also resets the on-chain wallet.
|
|
545
|
+
|
|
546
|
+
### Step 1: Verify Current Ownership
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
const currentOwner = await sdk.getAgentOwner(process.env.AGENT0_AGENT_ID!);
|
|
550
|
+
console.log(`Current owner: ${currentOwner}`);
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Step 2: Preview Draft & Confirm
|
|
554
|
+
|
|
555
|
+
Before proceeding, present the transfer details and **always** confirm with your owner:
|
|
556
|
+
|
|
557
|
+
> Here's what I'm about to submit on-chain:
|
|
558
|
+
>
|
|
559
|
+
> - **Action:** Transfer ownership
|
|
560
|
+
> - **Agent ID:** {agent_id}
|
|
561
|
+
> - **Current Owner:** {currentOwner}
|
|
562
|
+
> - **New Owner:** {newOwner}
|
|
563
|
+
>
|
|
564
|
+
> **This action:**
|
|
565
|
+
> - Transfers the ERC-721 NFT to the new address
|
|
566
|
+
> - Resets the agent's on-chain wallet
|
|
567
|
+
> - Is irreversible without the new owner's cooperation
|
|
568
|
+
>
|
|
569
|
+
> Do you want to proceed? (yes/no)
|
|
570
|
+
|
|
571
|
+
**Do NOT submit the transaction until the owner confirms.**
|
|
572
|
+
|
|
573
|
+
### Step 3: Execute Transfer
|
|
574
|
+
|
|
575
|
+
```typescript
|
|
576
|
+
const newOwner = '0x742d35cc6634c0532925a3b844bc9e7595f0beb7';
|
|
577
|
+
|
|
578
|
+
const txHandle = await sdk.transferAgent(process.env.AGENT0_AGENT_ID!, newOwner);
|
|
579
|
+
console.log(`Transfer submitted: ${txHandle.hash}`);
|
|
580
|
+
|
|
581
|
+
const { result } = await txHandle.waitConfirmed();
|
|
582
|
+
console.log(`Transfer confirmed!`);
|
|
583
|
+
console.log(`From: ${result.from}`);
|
|
584
|
+
console.log(`To: ${result.to}`);
|
|
585
|
+
console.log(`Agent: ${result.agentId}`);
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### Step 4: Verify New Ownership
|
|
589
|
+
|
|
590
|
+
```typescript
|
|
591
|
+
const verifiedOwner = await sdk.getAgentOwner(process.env.AGENT0_AGENT_ID!);
|
|
592
|
+
console.log(`New owner: ${verifiedOwner}`);
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Step 5: Deliver Confirmation
|
|
596
|
+
|
|
597
|
+
> Agent ownership transferred successfully.
|
|
598
|
+
>
|
|
599
|
+
> - **Agent ID:** 8453:42
|
|
600
|
+
> - **Previous owner:** 0xOLD...
|
|
601
|
+
> - **New owner:** 0xNEW...
|
|
602
|
+
>
|
|
603
|
+
> The agent's on-chain wallet has been reset. The new owner now has full control.
|
|
604
|
+
|
|
605
|
+
---
|
|
606
|
+
|
|
607
|
+
## Error Handling
|
|
608
|
+
|
|
609
|
+
| Error | Cause | Recovery |
|
|
610
|
+
|---|---|---|
|
|
611
|
+
| `insufficient funds` | Wallet doesn't have enough ETH for gas | Ask owner to fund the wallet with ETH on Base |
|
|
612
|
+
| `execution reverted: not owner` | Wallet is not the owner of this agent | Verify `AGENT0_AGENT_ID` in `.env` matches the wallet's agent |
|
|
613
|
+
| `execution reverted: agent not found` | The agent ID doesn't exist on-chain | Check the agent ID format (`8453:XX`) and verify it was registered |
|
|
614
|
+
| `nonce too low` | Transaction conflict — another tx was sent | Retry the operation |
|
|
615
|
+
| `transaction underpriced` | Gas price too low | Retry — the SDK uses network-estimated gas |
|
|
616
|
+
| `network error` / `timeout` | RPC endpoint is down or unreachable | Check `BASE_RPC_URL` in `.env`, try an alternative Base RPC |
|
|
617
|
+
| `IPFS` or `Pinata` errors | Should not occur — this skill uses HTTP only | Verify you are using `agent.registerHTTP()`, not `agent.registerIPFS()` |
|
|
618
|
+
| `setMCP` / `setA2A` soft failure | Endpoint unreachable during capability extraction | Non-blocking — the endpoint is still set, but tools/skills won't be auto-extracted. Verify the endpoint URL is correct and accessible. |
|
|
619
|
+
|
|
620
|
+
**General rules:**
|
|
621
|
+
- Never silently swallow errors. Log them and inform the owner.
|
|
622
|
+
- If a transaction fails, do NOT retry more than 3 times.
|
|
623
|
+
- If the RPC is down, tell the owner and stop. Do not keep retrying.
|
|
624
|
+
|
|
625
|
+
---
|
|
626
|
+
|
|
627
|
+
## Security
|
|
628
|
+
|
|
629
|
+
**CRITICAL — follow these rules at all times:**
|
|
630
|
+
|
|
631
|
+
- **NEVER** expose the private key in chat messages, logs, or any output
|
|
632
|
+
- **NEVER** share the contents of your `.env` file
|
|
633
|
+
- **NEVER** send the private key to any external service or API
|
|
634
|
+
- **NEVER** commit `.env` files to version control
|
|
635
|
+
- **ALWAYS** ensure `.env` is listed in `.gitignore`
|
|
636
|
+
- **ALWAYS** verify wallet addresses with the owner before executing transfers
|
|
637
|
+
- **ALWAYS** confirm destructive operations (transfer, unset wallet) with the owner
|
|
638
|
+
- The private key is stored **locally in `.env`** — it never leaves the machine
|
|
639
|
+
- `process.env` overrides take priority over `.env` values (standard for production)
|
|
640
|
+
- If the owner asks you to display the private key, **refuse** and explain why
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
## Example Interaction
|
|
645
|
+
|
|
646
|
+
Below is a complete conversation showing first boot through registration, feedback, and transfer.
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
650
|
+
**Agent (first startup, no `.env` file found):**
|
|
651
|
+
|
|
652
|
+
> I'd like to register as an on-chain agent on Base via ERC-8004. I need:
|
|
653
|
+
> 1. A **private key** for signing transactions (this wallet needs ETH on Base for gas)
|
|
654
|
+
> 2. A **Base RPC URL** (or I'll use the default: `https://mainnet.base.org`)
|
|
655
|
+
>
|
|
656
|
+
> Your private key will be stored in a local `.env` file and never shared.
|
|
657
|
+
|
|
658
|
+
**Owner:**
|
|
659
|
+
|
|
660
|
+
> Here's my private key: 0xABC123...DEF456
|
|
661
|
+
> Use the default RPC.
|
|
662
|
+
|
|
663
|
+
**Agent saves credentials to `.env`:**
|
|
664
|
+
|
|
665
|
+
```
|
|
666
|
+
WALLET_PRIVATE_KEY=0xABC123...DEF456
|
|
667
|
+
BASE_RPC_URL=https://mainnet.base.org
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
**Agent:**
|
|
671
|
+
|
|
672
|
+
> Credentials saved. Now let's register your agent. I need:
|
|
673
|
+
> 1. A name for your agent
|
|
674
|
+
> 2. A description of what it does
|
|
675
|
+
> 3. (Optional) An image URL, MCP endpoint, A2A endpoint, or ENS name
|
|
676
|
+
> 4. An HTTP URL where the registration file will be hosted
|
|
677
|
+
|
|
678
|
+
**Owner:**
|
|
679
|
+
|
|
680
|
+
> Name: Alice Research Agent
|
|
681
|
+
> Description: Analyzes on-chain data and generates portfolio reports
|
|
682
|
+
> MCP endpoint: https://mcp.alice.dev/
|
|
683
|
+
> HTTP URL: https://alice.dev/agents/research.json
|
|
684
|
+
|
|
685
|
+
**Agent previews draft:**
|
|
686
|
+
|
|
687
|
+
> Here's what I'm about to register on-chain:
|
|
688
|
+
>
|
|
689
|
+
> - **Name:** Alice Research Agent
|
|
690
|
+
> - **Description:** Analyzes on-chain data and generates portfolio reports
|
|
691
|
+
> - **MCP Endpoint:** https://mcp.alice.dev/
|
|
692
|
+
> - **Registration URI:** https://alice.dev/agents/research.json
|
|
693
|
+
>
|
|
694
|
+
> This will mint an ERC-721 NFT on Base and cost gas. Shall I proceed?
|
|
695
|
+
|
|
696
|
+
**Owner:**
|
|
697
|
+
|
|
698
|
+
> Yes, go ahead.
|
|
699
|
+
|
|
700
|
+
**Agent registers:**
|
|
701
|
+
|
|
702
|
+
```typescript
|
|
703
|
+
const sdk = new SDK({
|
|
704
|
+
chainId: 8453,
|
|
705
|
+
rpcUrl: process.env.BASE_RPC_URL || 'https://mainnet.base.org',
|
|
706
|
+
privateKey: process.env.WALLET_PRIVATE_KEY!,
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
const agent = sdk.createAgent(
|
|
710
|
+
'Alice Research Agent',
|
|
711
|
+
'Analyzes on-chain data and generates portfolio reports'
|
|
712
|
+
);
|
|
713
|
+
|
|
714
|
+
await agent.setMCP('https://mcp.alice.dev/');
|
|
715
|
+
agent.setActive(true);
|
|
716
|
+
|
|
717
|
+
const txHandle = await agent.registerHTTP('https://alice.dev/agents/research.json');
|
|
718
|
+
const { result: registration } = await txHandle.waitConfirmed();
|
|
719
|
+
// registration.agentId = "8453:42"
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
**Agent saves agent ID and confirms:**
|
|
723
|
+
|
|
724
|
+
> Your agent has been registered on-chain on Base mainnet!
|
|
725
|
+
>
|
|
726
|
+
> - **Agent ID:** 8453:42
|
|
727
|
+
> - **Name:** Alice Research Agent
|
|
728
|
+
> - **MCP Endpoint:** https://mcp.alice.dev/
|
|
729
|
+
> - **Registration URI:** https://alice.dev/agents/research.json
|
|
730
|
+
>
|
|
731
|
+
> Your agent is now discoverable by any ERC-8004 compatible app.
|
|
732
|
+
>
|
|
733
|
+
> Would you like me to save your agent profile to an `IDENTITY.md` file?
|
|
734
|
+
|
|
735
|
+
**Owner:**
|
|
736
|
+
|
|
737
|
+
> Yes.
|
|
738
|
+
|
|
739
|
+
**Agent creates `IDENTITY.md`:**
|
|
740
|
+
|
|
741
|
+
```markdown
|
|
742
|
+
# Agent Identity
|
|
743
|
+
|
|
744
|
+
| Field | Value |
|
|
745
|
+
|---|---|
|
|
746
|
+
| **Agent ID** | 8453:42 |
|
|
747
|
+
| **Name** | Alice Research Agent |
|
|
748
|
+
| **Description** | Analyzes on-chain data and generates portfolio reports |
|
|
749
|
+
| **Chain** | Base (8453) |
|
|
750
|
+
| **Registration URI** | https://alice.dev/agents/research.json |
|
|
751
|
+
| **MCP Endpoint** | https://mcp.alice.dev/ |
|
|
752
|
+
| **Active** | true |
|
|
753
|
+
| **Registered** | 2025-01-15 |
|
|
754
|
+
|
|
755
|
+
> On-chain identity minted as ERC-721 on Base mainnet.
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
**Agent:**
|
|
759
|
+
|
|
760
|
+
> Saved to `IDENTITY.md`.
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
**Later, owner invokes the skill again (agent already registered):**
|
|
765
|
+
|
|
766
|
+
**Agent:**
|
|
767
|
+
|
|
768
|
+
> Your agent **Alice Research Agent** (ID: 8453:42) is registered on Base.
|
|
769
|
+
>
|
|
770
|
+
> What would you like to do?
|
|
771
|
+
>
|
|
772
|
+
> 1. **Update Agent** — modify name, description, endpoints, skills, or metadata
|
|
773
|
+
> 2. **Give Feedback** — rate another agent on-chain
|
|
774
|
+
> 3. **Search Feedback** — check reputation for any agent
|
|
775
|
+
> 4. **Transfer Ownership** — move your agent identity to a new wallet
|
|
776
|
+
> 5. **View Profile** — show your current IDENTITY.md
|
|
777
|
+
>
|
|
778
|
+
> Pick a number, or describe what you need.
|
|
779
|
+
|
|
780
|
+
**Owner:**
|
|
781
|
+
|
|
782
|
+
> 2 — Give feedback to agent 8453:99 — they did great data analysis work. Score 90.
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
**Agent previews draft:**
|
|
787
|
+
|
|
788
|
+
> Here's the feedback I'm about to submit on-chain:
|
|
789
|
+
>
|
|
790
|
+
> - **Target Agent:** 8453:99
|
|
791
|
+
> - **Score:** 90
|
|
792
|
+
> - **Tag:** data_analyst
|
|
793
|
+
>
|
|
794
|
+
> This will cost gas. Shall I proceed?
|
|
795
|
+
|
|
796
|
+
**Owner:**
|
|
797
|
+
|
|
798
|
+
> Yes.
|
|
799
|
+
|
|
800
|
+
**Agent submits feedback:**
|
|
801
|
+
|
|
802
|
+
```typescript
|
|
803
|
+
const tx = await sdk.giveFeedback('8453:99', 90, 'data_analyst');
|
|
804
|
+
const { receipt } = await tx.waitConfirmed();
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
**Agent confirms:**
|
|
808
|
+
|
|
809
|
+
> Feedback submitted on-chain for agent 8453:99.
|
|
810
|
+
>
|
|
811
|
+
> - **Score:** 90
|
|
812
|
+
> - **Tag:** data_analyst
|
|
813
|
+
> - **Transaction:** 0xdef789...
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
|
|
817
|
+
**Later, owner wants to check their agent's reputation:**
|
|
818
|
+
|
|
819
|
+
**Owner:**
|
|
820
|
+
|
|
821
|
+
> What's my agent's reputation?
|
|
822
|
+
|
|
823
|
+
**Agent checks:**
|
|
824
|
+
|
|
825
|
+
```typescript
|
|
826
|
+
const summary = await sdk.getReputationSummary('8453:42');
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
**Agent responds:**
|
|
830
|
+
|
|
831
|
+
> Here's your reputation summary:
|
|
832
|
+
>
|
|
833
|
+
> - **Total reviews:** 15
|
|
834
|
+
> - **Average rating:** 82.4
|
|
835
|
+
>
|
|
836
|
+
> You have solid positive feedback from the community.
|
|
837
|
+
|
|
838
|
+
---
|
|
839
|
+
|
|
840
|
+
**Later, owner wants to transfer the agent:**
|
|
841
|
+
|
|
842
|
+
**Owner:**
|
|
843
|
+
|
|
844
|
+
> Transfer my agent to 0x9876...FEDC
|
|
845
|
+
|
|
846
|
+
**Agent previews draft:**
|
|
847
|
+
|
|
848
|
+
> Here's what I'm about to submit on-chain:
|
|
849
|
+
>
|
|
850
|
+
> - **Action:** Transfer ownership
|
|
851
|
+
> - **Agent ID:** 8453:42
|
|
852
|
+
> - **New Owner:** 0x9876...FEDC
|
|
853
|
+
>
|
|
854
|
+
> **This action:**
|
|
855
|
+
> - Transfers the ERC-721 NFT to the new address
|
|
856
|
+
> - Resets the agent's on-chain wallet
|
|
857
|
+
> - Is irreversible without the new owner's cooperation
|
|
858
|
+
>
|
|
859
|
+
> Do you want to proceed? (yes/no)
|
|
860
|
+
|
|
861
|
+
**Owner:**
|
|
862
|
+
|
|
863
|
+
> Yes, proceed.
|
|
864
|
+
|
|
865
|
+
**Agent executes transfer:**
|
|
866
|
+
|
|
867
|
+
```typescript
|
|
868
|
+
const txHandle = await sdk.transferAgent('8453:42', '0x9876...FEDC');
|
|
869
|
+
const { result } = await txHandle.waitConfirmed();
|
|
870
|
+
|
|
871
|
+
const verifiedOwner = await sdk.getAgentOwner('8453:42');
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
**Agent confirms:**
|
|
875
|
+
|
|
876
|
+
> Agent ownership transferred successfully.
|
|
877
|
+
>
|
|
878
|
+
> - **Agent ID:** 8453:42
|
|
879
|
+
> - **New owner:** 0x9876...FEDC (verified on-chain)
|
|
880
|
+
>
|
|
881
|
+
> The agent's on-chain wallet has been reset. The new owner now has full control.
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@basecred/openclaw-8004",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenClaw skill for registering and managing AI agent identities on-chain via ERC-8004",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"erc-8004",
|
|
8
|
+
"openclaw",
|
|
9
|
+
"agent",
|
|
10
|
+
"identity",
|
|
11
|
+
"base",
|
|
12
|
+
"on-chain",
|
|
13
|
+
"erc-721",
|
|
14
|
+
"reputation",
|
|
15
|
+
"basecred"
|
|
16
|
+
],
|
|
17
|
+
"author": "BaseCred",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/Callmedas69/basecred.git",
|
|
21
|
+
"directory": "packages/erc8004"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"SKILL.md",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"agent0-sdk": "^1.5.3",
|
|
29
|
+
"dotenv": "^16.4.7"
|
|
30
|
+
}
|
|
31
|
+
}
|