@ch4r10teer41/clawpass 1.0.1
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/LICENSE +201 -0
- package/README.md +478 -0
- package/dist/index.d.mts +1611 -0
- package/dist/index.d.ts +1611 -0
- package/dist/index.js +1169 -0
- package/dist/index.mjs +1115 -0
- package/openclaw-plugin.ts +270 -0
- package/openclaw.plugin.json +64 -0
- package/package.json +71 -0
- package/setup.sh +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the Work
|
|
90
|
+
or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as
|
|
159
|
+
a result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Clawpass Contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# Clawpass
|
|
2
|
+
|
|
3
|
+
**ERC-8004 Interface Module for AI Agents on Blockchain**
|
|
4
|
+
|
|
5
|
+
Clawpass is a modular TypeScript/JavaScript library that provides a complete interface to the ERC-8004 Trustless Agents protocol. It enables AI agents to establish decentralized identity, accumulate verifiable reputation, and validate their work through blockchain-based registries.
|
|
6
|
+
|
|
7
|
+
**Built as an add-on module for easy consumption by moltbook, moltx.io, OpenClaw, and other applications.**
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Identity Registry**: Register and manage AI agent identities on-chain
|
|
12
|
+
- **Reputation Registry**: Collect and query verifiable peer feedback
|
|
13
|
+
- **Validation Registry**: Request and track independent validation of agent work
|
|
14
|
+
- **Modular Design**: Use as a complete solution or integrate individual components
|
|
15
|
+
- **TypeScript Support**: Full type definitions and runtime validation with Zod
|
|
16
|
+
- **Framework Agnostic**: Works with any JavaScript/TypeScript project
|
|
17
|
+
- **OpenClaw Plugin**: Install as an [OpenClaw](https://docs.openclaw.ai/) plugin for agent tools and CLI
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @ch4r10teer41/clawpass ethers
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
For a short walkthrough, see [QUICKSTART.md](QUICKSTART.md). For a fuller introduction, see [GETTING_STARTED.md](GETTING_STARTED.md).
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { ethers } from 'ethers';
|
|
31
|
+
import { ClawpassClient } from '@ch4r10teer41/clawpass';
|
|
32
|
+
|
|
33
|
+
// Setup provider and signer
|
|
34
|
+
const provider = new ethers.JsonRpcProvider('YOUR_RPC_URL');
|
|
35
|
+
const signer = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
|
|
36
|
+
|
|
37
|
+
// Initialize Clawpass
|
|
38
|
+
const clawpass = new ClawpassClient({
|
|
39
|
+
identityRegistryAddress: '0x...',
|
|
40
|
+
reputationRegistryAddress: '0x...',
|
|
41
|
+
validationRegistryAddress: '0x...',
|
|
42
|
+
providerOrSigner: signer,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Register an agent
|
|
46
|
+
const agentId = await clawpass.identity.register('ipfs://...');
|
|
47
|
+
|
|
48
|
+
// Give feedback
|
|
49
|
+
await clawpass.reputation.giveFeedback({
|
|
50
|
+
agentId: 1n,
|
|
51
|
+
value: 45n, // 4.5 stars
|
|
52
|
+
valueDecimals: 1,
|
|
53
|
+
tag1: 'quality',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Request validation
|
|
57
|
+
await clawpass.validation.validationRequest({
|
|
58
|
+
validatorAddress: '0x...',
|
|
59
|
+
agentId: 1,
|
|
60
|
+
requestURI: 'ipfs://...',
|
|
61
|
+
requestHash: '0x...',
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Core Concepts
|
|
66
|
+
|
|
67
|
+
### Identity Registry
|
|
68
|
+
|
|
69
|
+
The Identity Registry uses ERC-721 to provide each agent with a portable, censorship-resistant on-chain identifier. Each agent has:
|
|
70
|
+
|
|
71
|
+
- **Agent ID**: Unique token ID
|
|
72
|
+
- **Agent URI**: Points to registration file (IPFS, HTTPS, or on-chain data URI)
|
|
73
|
+
- **Metadata**: Optional key-value storage
|
|
74
|
+
- **Agent Wallet**: Verified payment address
|
|
75
|
+
|
|
76
|
+
### Reputation Registry
|
|
77
|
+
|
|
78
|
+
The Reputation Registry enables collecting and querying feedback signals from task completion:
|
|
79
|
+
|
|
80
|
+
- **Feedback Values**: Fixed-point numbers with configurable decimals (0-18)
|
|
81
|
+
- **Tags**: Two optional tags for categorization and filtering
|
|
82
|
+
- **Composable**: On-chain aggregation and off-chain sophisticated scoring
|
|
83
|
+
- **Sybil-Resistant**: Requires filtering by trusted client addresses
|
|
84
|
+
|
|
85
|
+
### Validation Registry
|
|
86
|
+
|
|
87
|
+
The Validation Registry provides hooks for independent validators to verify task execution:
|
|
88
|
+
|
|
89
|
+
- **Validation Requests**: Agents request verification from validators
|
|
90
|
+
- **Validation Responses**: Validators provide scores (0-100)
|
|
91
|
+
- **Progressive Validation**: Multiple responses per request (e.g., soft/hard finality)
|
|
92
|
+
- **Flexible**: Supports stake-secured re-execution, zkML proofs, TEE oracles
|
|
93
|
+
|
|
94
|
+
## Usage Examples
|
|
95
|
+
|
|
96
|
+
### Register an Agent
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { createDataURI } from '@ch4r10teer41/clawpass';
|
|
100
|
+
|
|
101
|
+
const registrationFile = {
|
|
102
|
+
type: 'https://eips.ethereum.org/EIPS/eip-8004#registration-v1',
|
|
103
|
+
name: 'MyAIAgent',
|
|
104
|
+
description: 'An AI agent that provides data analysis',
|
|
105
|
+
services: [
|
|
106
|
+
{
|
|
107
|
+
name: 'A2A',
|
|
108
|
+
endpoint: 'https://agent.example.com/.well-known/agent-card.json',
|
|
109
|
+
version: '0.3.0',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
x402Support: true,
|
|
113
|
+
active: true,
|
|
114
|
+
registrations: [],
|
|
115
|
+
supportedTrust: ['reputation', 'crypto-economic'],
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Store on-chain as data URI
|
|
119
|
+
const agentURI = createDataURI(registrationFile);
|
|
120
|
+
const agentId = await clawpass.identity.register(agentURI);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Give Feedback
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { toFixedPoint } from '@ch4r10teer41/clawpass';
|
|
127
|
+
|
|
128
|
+
await clawpass.reputation.giveFeedback({
|
|
129
|
+
agentId: 1n,
|
|
130
|
+
value: toFixedPoint(4.5, 1), // 4.5 with 1 decimal
|
|
131
|
+
valueDecimals: 1,
|
|
132
|
+
tag1: 'starred',
|
|
133
|
+
tag2: 'quality',
|
|
134
|
+
endpoint: 'https://agent.example.com/api',
|
|
135
|
+
feedbackURI: 'ipfs://...',
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Get Agent Reputation
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// Get reputation from trusted reviewers only
|
|
143
|
+
const trustedClients = ['0x...', '0x...'];
|
|
144
|
+
const reputation = await clawpass.getAgentReputation(
|
|
145
|
+
1n,
|
|
146
|
+
trustedClients,
|
|
147
|
+
'starred' // optional tag filter
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
console.log(`Average: ${reputation.summary.summaryValue}`);
|
|
151
|
+
console.log(`Count: ${reputation.summary.count}`);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Request Validation
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { calculateHash } from '@ch4r10teer41/clawpass';
|
|
158
|
+
|
|
159
|
+
const requestData = JSON.stringify({
|
|
160
|
+
task: 'Verify analysis',
|
|
161
|
+
input: {...},
|
|
162
|
+
output: {...},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
await clawpass.validation.validationRequest({
|
|
166
|
+
validatorAddress: '0x...', // Validator contract
|
|
167
|
+
agentId: 1,
|
|
168
|
+
requestURI: 'ipfs://...',
|
|
169
|
+
requestHash: calculateHash(requestData),
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Get Validation Status
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
const status = await clawpass.validation.getValidationStatus(requestHash);
|
|
177
|
+
|
|
178
|
+
console.log(`Score: ${status.response}/100`);
|
|
179
|
+
console.log(`Validator: ${status.validatorAddress}`);
|
|
180
|
+
console.log(`Last Update: ${status.lastUpdate}`);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## OpenClaw Plugin
|
|
184
|
+
|
|
185
|
+
Clawpass works as an [OpenClaw](https://docs.openclaw.ai/) plugin so agents can use ERC-8004 identity, reputation, and validation from within OpenClaw. See [OpenClaw plugins](https://docs.openclaw.ai/cli/plugins) and [Plugin manifest](https://docs.openclaw.ai/plugins/manifest). For plugin details and config, see [docs/OPENCLAW_PLUGIN.md](docs/OPENCLAW_PLUGIN.md).
|
|
186
|
+
|
|
187
|
+
### Install
|
|
188
|
+
|
|
189
|
+
From npm:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
openclaw plugins install @ch4r10teer41/clawpass
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
From a local path (development; run `npm run build` in the clawpass directory first):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
cd path/to/clawpass && npm run build
|
|
199
|
+
openclaw plugins install -l ./path/to/clawpass
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Then enable and configure in your OpenClaw config:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"plugins": {
|
|
207
|
+
"enabled": true,
|
|
208
|
+
"entries": {
|
|
209
|
+
"clawpass": {
|
|
210
|
+
"enabled": true,
|
|
211
|
+
"config": {
|
|
212
|
+
"rpcUrl": "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY",
|
|
213
|
+
"identityRegistryAddress": "0x...",
|
|
214
|
+
"reputationRegistryAddress": "0x...",
|
|
215
|
+
"validationRegistryAddress": "0x...",
|
|
216
|
+
"privateKey": "0x..."
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Optional: allow Clawpass tools for an agent (tools are **optional** and opt-in):
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"agents": {
|
|
229
|
+
"list": [{
|
|
230
|
+
"id": "main",
|
|
231
|
+
"tools": {
|
|
232
|
+
"allow": ["clawpass", "clawpass_get_agent_info", "clawpass_get_reputation", "clawpass_give_feedback", "clawpass_request_validation", "clawpass_validation_status"]
|
|
233
|
+
}
|
|
234
|
+
}]
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Plugin tools (optional)
|
|
240
|
+
|
|
241
|
+
| Tool | Description |
|
|
242
|
+
|------|-------------|
|
|
243
|
+
| `clawpass_get_agent_info` | Get agent registration, owner, wallet (params: `agentId`) |
|
|
244
|
+
| `clawpass_get_reputation` | Get reputation from trusted clients (params: `agentId`, `trustedClients`, optional `tag1`, `tag2`) |
|
|
245
|
+
| `clawpass_give_feedback` | Submit feedback (params: `agentId`, `value`, `valueDecimals`, optional `tag1`, `tag2`, `endpoint`). Requires `privateKey` in config. |
|
|
246
|
+
| `clawpass_request_validation` | Request validation (params: `validatorAddress`, `agentId`, `requestURI`, `requestData` or `requestHash`). Requires `privateKey`. |
|
|
247
|
+
| `clawpass_validation_status` | Get validation status (params: `requestHash`) |
|
|
248
|
+
|
|
249
|
+
### CLI
|
|
250
|
+
|
|
251
|
+
After installing the plugin:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
openclaw clawpass
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Prints whether Clawpass is configured and ready.
|
|
258
|
+
|
|
259
|
+
### Gateway RPC
|
|
260
|
+
|
|
261
|
+
If the gateway exposes plugin RPC:
|
|
262
|
+
|
|
263
|
+
- `clawpass.status` — returns `{ configured: boolean }`.
|
|
264
|
+
|
|
265
|
+
## Integration Examples
|
|
266
|
+
|
|
267
|
+
### Moltbook Integration
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import { MoltbookClawpassIntegration } from 'clawpass/examples/moltbook-integration';
|
|
271
|
+
|
|
272
|
+
const integration = new MoltbookClawpassIntegration(clawpass);
|
|
273
|
+
|
|
274
|
+
// Register agent
|
|
275
|
+
const agentId = await integration.registerAgent(moltbookAgent, '1', '0x...');
|
|
276
|
+
|
|
277
|
+
// Submit peer feedback
|
|
278
|
+
await integration.submitPeerFeedback(
|
|
279
|
+
moltbookAgentId,
|
|
280
|
+
4.5, // rating
|
|
281
|
+
reviewerAddress
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
// Get trust score
|
|
285
|
+
const trustScore = await integration.getAgentTrustScore(
|
|
286
|
+
moltbookAgentId,
|
|
287
|
+
trustedPeers
|
|
288
|
+
);
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Moltx.io Integration
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
import { MoltxClawpassIntegration } from 'clawpass/examples/moltx-integration';
|
|
295
|
+
|
|
296
|
+
const integration = new MoltxClawpassIntegration(clawpass);
|
|
297
|
+
|
|
298
|
+
// Get agent profile
|
|
299
|
+
const profile = await integration.getAgentProfile(agentId, trustedReviewers);
|
|
300
|
+
|
|
301
|
+
// Find agents by service
|
|
302
|
+
const a2aAgents = await integration.findAgentsByService(agentIds, 'A2A');
|
|
303
|
+
|
|
304
|
+
// Compare agents
|
|
305
|
+
const comparison = await integration.compareAgents(agentIds, trustedReviewers);
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## API Reference
|
|
309
|
+
|
|
310
|
+
### ClawpassClient
|
|
311
|
+
|
|
312
|
+
Main client providing unified access to all registries.
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
class ClawpassClient {
|
|
316
|
+
identity: IdentityRegistryClient;
|
|
317
|
+
reputation: ReputationRegistryClient;
|
|
318
|
+
validation: ValidationRegistryClient;
|
|
319
|
+
|
|
320
|
+
constructor(config: ClawpassConfig);
|
|
321
|
+
verifyRegistryLinks(): Promise<boolean>;
|
|
322
|
+
getAgentInfo(agentId: bigint): Promise<AgentInfo>;
|
|
323
|
+
getAgentReputation(agentId: bigint, trustedClients: string[]): Promise<ReputationData>;
|
|
324
|
+
getAgentValidationSummary(agentId: bigint): Promise<ValidationData>;
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### IdentityRegistryClient
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
class IdentityRegistryClient {
|
|
332
|
+
register(agentURI?: string, metadata?: MetadataEntry[]): Promise<bigint>;
|
|
333
|
+
setAgentURI(agentId: bigint, newURI: string): Promise<void>;
|
|
334
|
+
getAgentURI(agentId: bigint): Promise<string>;
|
|
335
|
+
getAgentRegistrationFile(agentId: bigint): Promise<AgentRegistrationFile>;
|
|
336
|
+
setMetadata(agentId: bigint, key: string, value: string): Promise<void>;
|
|
337
|
+
getMetadata(agentId: bigint, key: string): Promise<string>;
|
|
338
|
+
getAgentWallet(agentId: bigint): Promise<string>;
|
|
339
|
+
setAgentWallet(agentId: bigint, newWallet: string, deadline: bigint, signature: string): Promise<void>;
|
|
340
|
+
getOwner(agentId: bigint): Promise<string>;
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### ReputationRegistryClient
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
class ReputationRegistryClient {
|
|
348
|
+
giveFeedback(feedback: FeedbackData): Promise<void>;
|
|
349
|
+
revokeFeedback(agentId: bigint, feedbackIndex: bigint): Promise<void>;
|
|
350
|
+
appendResponse(agentId: bigint, clientAddress: string, feedbackIndex: bigint, responseURI: string): Promise<void>;
|
|
351
|
+
getSummary(agentId: bigint, clientAddresses: string[], tag1?: string, tag2?: string): Promise<FeedbackSummary>;
|
|
352
|
+
readFeedback(agentId: bigint, clientAddress: string, feedbackIndex: bigint): Promise<FeedbackRecord>;
|
|
353
|
+
readAllFeedback(agentId: bigint, clientAddresses?: string[], tag1?: string, tag2?: string): Promise<FeedbackRecord[]>;
|
|
354
|
+
getClients(agentId: bigint): Promise<string[]>;
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### ValidationRegistryClient
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
class ValidationRegistryClient {
|
|
362
|
+
validationRequest(request: ValidationRequest): Promise<void>;
|
|
363
|
+
validationResponse(response: ValidationResponse): Promise<void>;
|
|
364
|
+
getValidationStatus(requestHash: string): Promise<ValidationStatus>;
|
|
365
|
+
getSummary(agentId: bigint, validatorAddresses?: string[], tag?: string): Promise<ValidationSummary>;
|
|
366
|
+
getAgentValidations(agentId: bigint): Promise<string[]>;
|
|
367
|
+
getValidatorRequests(validatorAddress: string): Promise<string[]>;
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Utility Functions
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
// Data URI handling
|
|
375
|
+
createDataURI(registrationFile: AgentRegistrationFile): string;
|
|
376
|
+
parseDataURI(dataURI: string): AgentRegistrationFile;
|
|
377
|
+
|
|
378
|
+
// Fixed-point conversion
|
|
379
|
+
toFixedPoint(value: number, decimals: number): bigint;
|
|
380
|
+
fromFixedPoint(value: bigint, decimals: number): number;
|
|
381
|
+
|
|
382
|
+
// Hash calculation
|
|
383
|
+
calculateHash(content: string): string;
|
|
384
|
+
verifyHash(content: string, hash: string): boolean;
|
|
385
|
+
|
|
386
|
+
// IPFS utilities
|
|
387
|
+
createIPFSUri(cid: string): string;
|
|
388
|
+
extractCIDFromIPFS(ipfsUri: string): string;
|
|
389
|
+
ipfsToHTTP(ipfsUri: string, gateway?: string): string;
|
|
390
|
+
|
|
391
|
+
// Metadata encoding
|
|
392
|
+
encodeMetadata(value: string): string;
|
|
393
|
+
decodeMetadata(hexValue: string): string;
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Architecture
|
|
397
|
+
|
|
398
|
+
Clawpass is designed as a modular add-on that can be easily consumed by different applications. For design and module structure, see [ARCHITECTURE.md](ARCHITECTURE.md). For data flow and system overview, see [SYSTEM_OVERVIEW.md](SYSTEM_OVERVIEW.md).
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
clawpass/
|
|
402
|
+
├── src/
|
|
403
|
+
│ ├── ClawpassClient.ts # Unified client
|
|
404
|
+
│ ├── clients/
|
|
405
|
+
│ │ ├── IdentityRegistryClient.ts
|
|
406
|
+
│ │ ├── ReputationRegistryClient.ts
|
|
407
|
+
│ │ └── ValidationRegistryClient.ts
|
|
408
|
+
│ ├── types/ # TypeScript types
|
|
409
|
+
│ ├── schemas/ # Zod validation schemas
|
|
410
|
+
│ ├── abis/ # Contract ABIs
|
|
411
|
+
│ └── utils/ # Utility functions
|
|
412
|
+
├── examples/
|
|
413
|
+
│ ├── basic-usage.ts
|
|
414
|
+
│ ├── moltbook-integration.ts
|
|
415
|
+
│ └── moltx-integration.ts
|
|
416
|
+
└── dist/ # Compiled output
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
## ERC-8004 Specification
|
|
420
|
+
|
|
421
|
+
Clawpass implements the [ERC-8004 Trustless Agents](https://eips.ethereum.org/EIPS/eip-8004) specification, which defines:
|
|
422
|
+
|
|
423
|
+
- **Identity Registry**: ERC-721 based agent registration
|
|
424
|
+
- **Reputation Registry**: Feedback collection and aggregation
|
|
425
|
+
- **Validation Registry**: Independent verification hooks
|
|
426
|
+
|
|
427
|
+
For full specification details, see [EIP-8004](https://eips.ethereum.org/EIPS/eip-8004).
|
|
428
|
+
|
|
429
|
+
## Security Considerations
|
|
430
|
+
|
|
431
|
+
- **Sybil Attacks**: Always filter reputation queries by trusted client addresses
|
|
432
|
+
- **Validation Trust**: Validator incentives and slashing are protocol-specific
|
|
433
|
+
- **Private Keys**: Never expose private keys or commit them to version control
|
|
434
|
+
- **Gas Costs**: Be mindful of gas costs for on-chain operations
|
|
435
|
+
|
|
436
|
+
For production setup, monitoring, and troubleshooting, see [DEPLOYMENT.md](DEPLOYMENT.md).
|
|
437
|
+
|
|
438
|
+
## Contributing
|
|
439
|
+
|
|
440
|
+
Contributions are welcome! Please follow the guidelines in [CONTRIBUTING.md](CONTRIBUTING.md):
|
|
441
|
+
|
|
442
|
+
1. Fork the repository
|
|
443
|
+
2. Create a feature branch
|
|
444
|
+
3. Make your changes with tests
|
|
445
|
+
4. Submit a pull request
|
|
446
|
+
|
|
447
|
+
## License
|
|
448
|
+
|
|
449
|
+
Apache License 2.0 - see [LICENSE](LICENSE) file for details
|
|
450
|
+
|
|
451
|
+
## Links
|
|
452
|
+
|
|
453
|
+
**Documentation**
|
|
454
|
+
|
|
455
|
+
- [QUICKSTART.md](QUICKSTART.md) — Short walkthrough
|
|
456
|
+
- [GETTING_STARTED.md](GETTING_STARTED.md) — Full introduction
|
|
457
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) — Design and module structure
|
|
458
|
+
- [SYSTEM_OVERVIEW.md](SYSTEM_OVERVIEW.md) — Data flow and system overview
|
|
459
|
+
- [DEPLOYMENT.md](DEPLOYMENT.md) — Production and deployment
|
|
460
|
+
- [docs/OPENCLAW_PLUGIN.md](docs/OPENCLAW_PLUGIN.md) — OpenClaw plugin setup and config
|
|
461
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — How to contribute
|
|
462
|
+
- [CHANGELOG.md](CHANGELOG.md) — Version history
|
|
463
|
+
- [PROJECT_SUMMARY.md](PROJECT_SUMMARY.md) — Project overview
|
|
464
|
+
- [PUBLISHING.md](PUBLISHING.md) — How to publish to npm
|
|
465
|
+
|
|
466
|
+
**External**
|
|
467
|
+
|
|
468
|
+
- [ERC-8004 Specification](https://eips.ethereum.org/EIPS/eip-8004)
|
|
469
|
+
- [GitHub Repository](https://github.com/ch4r10t33r/clawpass)
|
|
470
|
+
- [Documentation](https://clawpass.dev)
|
|
471
|
+
|
|
472
|
+
## Support
|
|
473
|
+
|
|
474
|
+
For questions and support:
|
|
475
|
+
|
|
476
|
+
- Open an issue on GitHub
|
|
477
|
+
- Join our Discord community
|
|
478
|
+
- Email: support@clawpass.dev
|