@xproof/xproof 0.1.1 → 0.1.2
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 +103 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,31 +1,97 @@
|
|
|
1
1
|
# xproof
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
3
|
+
On-chain decision provenance for autonomous agents. **WHY before acting. WHAT after.** Timestamps written by the chain, not your agent.
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
6
|
npm install @xproof/xproof
|
|
9
7
|
```
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 3 steps. 30 seconds.
|
|
12
|
+
|
|
13
|
+
### Step 1 — Register (no wallet, no payment)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -X POST https://xproof.app/api/agent/register \
|
|
17
|
+
-H "Content-Type: application/json" \
|
|
18
|
+
-d '{"agent_name": "my-agent"}'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{ "api_key": "pm_...", "trial": { "remaining": 10 } }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 2 — Anchor WHY before acting
|
|
26
|
+
|
|
27
|
+
Hash your reasoning and certify it *before* your agent executes.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
curl -X POST https://xproof.app/api/proof \
|
|
31
|
+
-H "Authorization: Bearer pm_..." \
|
|
32
|
+
-H "Content-Type: application/json" \
|
|
33
|
+
-d '{
|
|
34
|
+
"file_hash": "<sha256_of_reasoning>",
|
|
35
|
+
"file_name": "reasoning.json",
|
|
36
|
+
"author": "my-agent",
|
|
37
|
+
"metadata": { "action_type": "decision" }
|
|
38
|
+
}'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{ "id": "why-proof-uuid", "transaction_hash": "0x..." }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Step 3 — Anchor WHAT after acting
|
|
46
|
+
|
|
47
|
+
Hash your output and link it to the WHY proof.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
curl -X POST https://xproof.app/api/proof \
|
|
51
|
+
-H "Authorization: Bearer pm_..." \
|
|
52
|
+
-H "Content-Type: application/json" \
|
|
53
|
+
-d '{
|
|
54
|
+
"file_hash": "<sha256_of_output>",
|
|
55
|
+
"file_name": "output.json",
|
|
56
|
+
"author": "my-agent",
|
|
57
|
+
"metadata": { "action_type": "execution", "why_proof_id": "why-proof-uuid" }
|
|
58
|
+
}'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{ "id": "what-proof-uuid", "transaction_hash": "0x..." }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
When something goes wrong, you don't guess. You verify.
|
|
12
66
|
|
|
13
|
-
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## TypeScript SDK
|
|
14
70
|
|
|
15
71
|
```typescript
|
|
16
|
-
import { XProofClient } from "@xproof/xproof";
|
|
72
|
+
import { XProofClient, hashString } from "@xproof/xproof";
|
|
17
73
|
|
|
18
|
-
//
|
|
74
|
+
// Register — zero-friction, no wallet, no payment
|
|
19
75
|
const client = await XProofClient.register("my-agent");
|
|
20
|
-
|
|
76
|
+
// 10 free certs, API key stored automatically
|
|
77
|
+
|
|
78
|
+
// Step 2: Anchor WHY before acting
|
|
79
|
+
const why = await client.certifyHash(
|
|
80
|
+
hashString(JSON.stringify({ action: "summarize", model: "gpt-4" })),
|
|
81
|
+
"reasoning.json",
|
|
82
|
+
"my-agent",
|
|
83
|
+
{ metadata: { action_type: "decision" } }
|
|
84
|
+
);
|
|
21
85
|
|
|
22
|
-
//
|
|
23
|
-
const
|
|
24
|
-
|
|
86
|
+
// Step 3: Anchor WHAT after acting
|
|
87
|
+
const what = await client.certifyHash(
|
|
88
|
+
hashString(executionOutput),
|
|
89
|
+
"output.json",
|
|
90
|
+
"my-agent",
|
|
91
|
+
{ metadata: { action_type: "execution", why_proof_id: why.id } }
|
|
92
|
+
);
|
|
25
93
|
|
|
26
|
-
//
|
|
27
|
-
const proof = await client.verifyHash(cert.fileHash);
|
|
28
|
-
console.log(proof.id);
|
|
94
|
+
console.log(what.transactionHash); // MultiversX explorer link
|
|
29
95
|
```
|
|
30
96
|
|
|
31
97
|
Or use an existing API key:
|
|
@@ -34,9 +100,11 @@ Or use an existing API key:
|
|
|
34
100
|
const client = new XProofClient({ apiKey: "pm_your_key" });
|
|
35
101
|
```
|
|
36
102
|
|
|
103
|
+
---
|
|
104
|
+
|
|
37
105
|
## 4W Framework (WHO / WHAT / WHEN / WHY)
|
|
38
106
|
|
|
39
|
-
|
|
107
|
+
Full accountability metadata on every certification:
|
|
40
108
|
|
|
41
109
|
```typescript
|
|
42
110
|
import { XProofClient, hashString } from "@xproof/xproof";
|
|
@@ -76,16 +144,28 @@ console.log(result.summary.created); // 2
|
|
|
76
144
|
```typescript
|
|
77
145
|
import { hashFile, hashBuffer, hashString } from "@xproof/xproof";
|
|
78
146
|
|
|
79
|
-
const fileHash
|
|
147
|
+
const fileHash = await hashFile("./document.pdf");
|
|
80
148
|
const bufferHash = hashBuffer(Buffer.from("hello"));
|
|
81
149
|
const stringHash = hashString("hello world");
|
|
82
150
|
```
|
|
83
151
|
|
|
152
|
+
## Verify a Proof
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// By proof ID
|
|
156
|
+
const proof = await client.verify("certification-uuid");
|
|
157
|
+
|
|
158
|
+
// By file hash
|
|
159
|
+
const proof = await client.verifyHash(fileHash);
|
|
160
|
+
|
|
161
|
+
console.log(proof.blockchainStatus); // "confirmed" | "pending"
|
|
162
|
+
```
|
|
163
|
+
|
|
84
164
|
## Pricing
|
|
85
165
|
|
|
86
166
|
```typescript
|
|
87
167
|
const pricing = await client.getPricing();
|
|
88
|
-
console.log(pricing.priceUsd);
|
|
168
|
+
console.log(pricing.priceUsd); // e.g. 0.05
|
|
89
169
|
```
|
|
90
170
|
|
|
91
171
|
## Error Handling
|
|
@@ -133,6 +213,12 @@ try {
|
|
|
133
213
|
| `verifyHash(fileHash)` | Look up by file hash |
|
|
134
214
|
| `getPricing()` | Get current pricing |
|
|
135
215
|
|
|
216
|
+
## Links
|
|
217
|
+
|
|
218
|
+
- [xproof.app](https://xproof.app) — dashboard & docs
|
|
219
|
+
- [Python SDK](https://pypi.org/project/xproof/) — `pip install xproof`
|
|
220
|
+
- [Examples](https://github.com/jasonxkensei/xproof-examples) — LangChain, CrewAI, AutoGen, LlamaIndex
|
|
221
|
+
|
|
136
222
|
## License
|
|
137
223
|
|
|
138
224
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xproof/xproof",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Official SDK for the xProof blockchain certification API — proof and accountability layer for autonomous agents",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"license": "MIT",
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|
|
55
|
-
"url": "https://github.com/jasonxkensei/xproof"
|
|
55
|
+
"url": "git+https://github.com/jasonxkensei/xproof.git"
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://xproof.app",
|
|
58
58
|
"engines": {
|