openclaw-simplesv-plugin 0.1.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 +25 -0
- package/SKILL.md +57 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/index.ts +84 -0
- package/openclaw.plugin.json +33 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# OpenClaw SimpleSV Plugin
|
|
2
|
+
|
|
3
|
+
A programmatic OpenClaw plugin that provides a high-level blockchain "Utility Belt" using the **@bsv/simple** library.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
- **DIDs**: Manage and resolve Decentralized Identifiers (`did:bsv`).
|
|
7
|
+
- **PushDrop Tokens**: Issue and transfer tokens with encrypted state.
|
|
8
|
+
- **Inscriptions**: Permanently write data to the BSV blockchain.
|
|
9
|
+
- **Verifiable Credentials**: Issue W3C-compatible credentials for agents.
|
|
10
|
+
|
|
11
|
+
## AI Tool: `simplesv`
|
|
12
|
+
Agents can use the `simplesv` tool to:
|
|
13
|
+
- `inscribe`: Store permanent JSON/Text records.
|
|
14
|
+
- `token_issue`: Create new digital assets or state.
|
|
15
|
+
- `resolve_did`: Look up agent profiles.
|
|
16
|
+
- `vc_issue`: Certify facts about other agents.
|
|
17
|
+
|
|
18
|
+
## Architecture
|
|
19
|
+
Built with the **OpenClaw Plugin SDK**, this extension uses:
|
|
20
|
+
- `@bsv/simple` for high-level blockchain APIs.
|
|
21
|
+
- `@bsv/sdk` for identity and crypto.
|
|
22
|
+
- Shared wallet identity with other overlay plugins.
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplesv
|
|
3
|
+
description: >
|
|
4
|
+
High-level BSV blockchain operations. Use for managing on-chain identity (DIDs),
|
|
5
|
+
issuing and transferring tokens (PushDrop), permanently inscribing data,
|
|
6
|
+
and handling verifiable credentials.
|
|
7
|
+
metadata: '{"openclaw": {"requires": {"bins": ["node"]}}}'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Tool Actions
|
|
11
|
+
|
|
12
|
+
| Action | Description |
|
|
13
|
+
|--------|-------------|
|
|
14
|
+
| `inscribe` | Permanently write JSON or text to the blockchain |
|
|
15
|
+
| `token_issue` | Create a new PushDrop token with optional data |
|
|
16
|
+
| `token_transfer` | Send a token you own to another identity key |
|
|
17
|
+
| `resolve_did` | Resolve a `did:bsv:...` identifier to its public profile |
|
|
18
|
+
| `pay_p2p` | Send a standard peer-to-peer payment |
|
|
19
|
+
| `vc_issue` | Issue a W3C-compatible Verifiable Credential |
|
|
20
|
+
| `status` | Show current DID, identity key, and wallet balance |
|
|
21
|
+
|
|
22
|
+
## Usage Guidance
|
|
23
|
+
|
|
24
|
+
### On-Chain Identity (DIDs)
|
|
25
|
+
Every agent has a `did:bsv` derived from their identity key. Use `status` to see yours, and `resolve_did` to look up others.
|
|
26
|
+
|
|
27
|
+
### Inscriptions (Permanent Storage)
|
|
28
|
+
Use `inscribe` when you need to store data that must never be deleted or modified.
|
|
29
|
+
```javascript
|
|
30
|
+
simplesv({
|
|
31
|
+
action: "inscribe",
|
|
32
|
+
data: { report: "Final analysis...", hash: "abc..." }
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Digital Assets (Tokens)
|
|
37
|
+
Use tokens to represent state or access rights.
|
|
38
|
+
```javascript
|
|
39
|
+
simplesv({
|
|
40
|
+
action: "token_issue",
|
|
41
|
+
data: { type: "access_pass", expires: "2026-12-31" },
|
|
42
|
+
basket: "passes"
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Verifiable Credentials (Web of Trust)
|
|
47
|
+
Issue a VC to certify a fact about another agent.
|
|
48
|
+
```javascript
|
|
49
|
+
simplesv({
|
|
50
|
+
action: "vc_issue",
|
|
51
|
+
subjectDid: "did:bsv:03...",
|
|
52
|
+
claims: { audited: true, rating: "A+" }
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Etiquette
|
|
57
|
+
Blockchain operations cost small amounts of BSV (satoshis). Always check the agent's balance before performing multiple inscriptions or token issuances.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,GAAG,EAAE,GAAG,QA4ExC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
/**
|
|
4
|
+
* OpenClaw SimpleSV Plugin
|
|
5
|
+
* High-level blockchain utility belt (DIDs, Tokens, Inscriptions).
|
|
6
|
+
*/
|
|
7
|
+
export default function register(api) {
|
|
8
|
+
const pluginConfig = api.getConfig?.()?.plugins?.entries?.['openclaw-simplesv-plugin']?.config || api.config || {};
|
|
9
|
+
const network = pluginConfig.network || 'mainnet';
|
|
10
|
+
const walletDir = pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
11
|
+
api.logger.info(`[simplesv] Initializing SimpleSV Plugin (network: ${network})`);
|
|
12
|
+
// Register the simplesv tool
|
|
13
|
+
api.registerTool({
|
|
14
|
+
name: "simplesv",
|
|
15
|
+
description: "High-level BSV utility belt: DIDs, Tokens, and Inscriptions",
|
|
16
|
+
parameters: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
action: {
|
|
20
|
+
type: "string",
|
|
21
|
+
enum: [
|
|
22
|
+
"inscribe", "token_issue", "token_transfer",
|
|
23
|
+
"resolve_did", "pay_p2p", "vc_issue", "status"
|
|
24
|
+
],
|
|
25
|
+
description: "Action to perform"
|
|
26
|
+
},
|
|
27
|
+
data: {
|
|
28
|
+
type: "object",
|
|
29
|
+
description: "JSON data for inscriptions or tokens"
|
|
30
|
+
},
|
|
31
|
+
text: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Plain text for inscriptions"
|
|
34
|
+
},
|
|
35
|
+
recipientKey: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Target identity public key"
|
|
38
|
+
},
|
|
39
|
+
amount: {
|
|
40
|
+
type: "number",
|
|
41
|
+
description: "Amount in satoshis for payments"
|
|
42
|
+
},
|
|
43
|
+
did: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Decentralized Identifier to resolve"
|
|
46
|
+
},
|
|
47
|
+
subjectDid: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Subject DID for Verifiable Credentials"
|
|
50
|
+
},
|
|
51
|
+
claims: {
|
|
52
|
+
type: "object",
|
|
53
|
+
description: "Claims for the Verifiable Credential"
|
|
54
|
+
},
|
|
55
|
+
basket: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Basket name for tokens"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
required: ["action"]
|
|
61
|
+
},
|
|
62
|
+
async execute(_id, params) {
|
|
63
|
+
try {
|
|
64
|
+
// Implementation logic using @bsv/simple will go here
|
|
65
|
+
return {
|
|
66
|
+
content: [{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: `SimpleSV action '${params.action}' received. (Logic implementation pending)`
|
|
69
|
+
}]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return {
|
|
74
|
+
content: [{
|
|
75
|
+
type: "text",
|
|
76
|
+
text: `Error: ${error.message || String(error)}`
|
|
77
|
+
}]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @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AAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iCAAiC;iBAC/C;gBACD,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qCAAqC;iBACnD;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wCAAwC;iBACtD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wBAAwB;iBACtC;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;QACD,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,MAAW;YACpC,IAAI,CAAC;gBACH,sDAAsD;gBACtD,OAAO;oBACL,OAAO,EAAE,CAAC;4BACR,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,oBAAoB,MAAM,CAAC,MAAM,4CAA4C;yBACpF,CAAC;iBACH,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO;oBACL,OAAO,EAAE,CAAC;4BACR,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,UAAU,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;yBACjD,CAAC;iBACH,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/index.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* OpenClaw SimpleSV Plugin
|
|
6
|
+
* High-level blockchain utility belt (DIDs, Tokens, Inscriptions).
|
|
7
|
+
*/
|
|
8
|
+
export default function register(api: any) {
|
|
9
|
+
const pluginConfig = api.getConfig?.()?.plugins?.entries?.['openclaw-simplesv-plugin']?.config || api.config || {};
|
|
10
|
+
const network = pluginConfig.network || 'mainnet';
|
|
11
|
+
const walletDir = pluginConfig.walletDir || path.join(os.homedir(), '.openclaw', 'bsv-wallet');
|
|
12
|
+
|
|
13
|
+
api.logger.info(`[simplesv] Initializing SimpleSV Plugin (network: ${network})`);
|
|
14
|
+
|
|
15
|
+
// Register the simplesv tool
|
|
16
|
+
api.registerTool({
|
|
17
|
+
name: "simplesv",
|
|
18
|
+
description: "High-level BSV utility belt: DIDs, Tokens, and Inscriptions",
|
|
19
|
+
parameters: {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
action: {
|
|
23
|
+
type: "string",
|
|
24
|
+
enum: [
|
|
25
|
+
"inscribe", "token_issue", "token_transfer",
|
|
26
|
+
"resolve_did", "pay_p2p", "vc_issue", "status"
|
|
27
|
+
],
|
|
28
|
+
description: "Action to perform"
|
|
29
|
+
},
|
|
30
|
+
data: {
|
|
31
|
+
type: "object",
|
|
32
|
+
description: "JSON data for inscriptions or tokens"
|
|
33
|
+
},
|
|
34
|
+
text: {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Plain text for inscriptions"
|
|
37
|
+
},
|
|
38
|
+
recipientKey: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Target identity public key"
|
|
41
|
+
},
|
|
42
|
+
amount: {
|
|
43
|
+
type: "number",
|
|
44
|
+
description: "Amount in satoshis for payments"
|
|
45
|
+
},
|
|
46
|
+
did: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Decentralized Identifier to resolve"
|
|
49
|
+
},
|
|
50
|
+
subjectDid: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "Subject DID for Verifiable Credentials"
|
|
53
|
+
},
|
|
54
|
+
claims: {
|
|
55
|
+
type: "object",
|
|
56
|
+
description: "Claims for the Verifiable Credential"
|
|
57
|
+
},
|
|
58
|
+
basket: {
|
|
59
|
+
type: "string",
|
|
60
|
+
description: "Basket name for tokens"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
required: ["action"]
|
|
64
|
+
},
|
|
65
|
+
async execute(_id: string, params: any) {
|
|
66
|
+
try {
|
|
67
|
+
// Implementation logic using @bsv/simple will go here
|
|
68
|
+
return {
|
|
69
|
+
content: [{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: `SimpleSV action '${params.action}' received. (Logic implementation pending)`
|
|
72
|
+
}]
|
|
73
|
+
};
|
|
74
|
+
} catch (error: any) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: `Error: ${error.message || String(error)}`
|
|
79
|
+
}]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "openclaw-simplesv-plugin",
|
|
3
|
+
"name": "BSV Simple Utility Belt",
|
|
4
|
+
"description": "High-level blockchain operations: DIDs, PushDrop tokens, and Inscriptions",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"skills": [
|
|
7
|
+
"./SKILL.md"
|
|
8
|
+
],
|
|
9
|
+
"configSchema": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {
|
|
13
|
+
"network": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": ["mainnet", "testnet"],
|
|
16
|
+
"default": "mainnet"
|
|
17
|
+
},
|
|
18
|
+
"walletDir": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Path to BSV wallet storage (defaults to ~/.openclaw/bsv-wallet)"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"uiHints": {
|
|
25
|
+
"network": {
|
|
26
|
+
"label": "Blockchain Network"
|
|
27
|
+
},
|
|
28
|
+
"walletDir": {
|
|
29
|
+
"label": "Wallet Directory",
|
|
30
|
+
"advanced": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openclaw-simplesv-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenClaw plugin for advanced BSV operations (DIDs, Tokens, Inscriptions) via @bsv/simple",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.ts",
|
|
9
|
+
"openclaw.plugin.json",
|
|
10
|
+
"src/",
|
|
11
|
+
"dist/",
|
|
12
|
+
"SKILL.md",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"lint": "eslint src/**/*.ts",
|
|
19
|
+
"test": "npx tsx src/**/*.test.ts"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@bsv/sdk": "latest",
|
|
23
|
+
"@bsv/simple": "latest",
|
|
24
|
+
"@bsv/wallet-toolbox": "latest",
|
|
25
|
+
"better-sqlite3": "^12.8.0",
|
|
26
|
+
"knex": "^3.2.8",
|
|
27
|
+
"dotenv": "^17.3.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.10.0",
|
|
31
|
+
"typescript": "^6.0.2",
|
|
32
|
+
"eslint": "^10.1.0"
|
|
33
|
+
},
|
|
34
|
+
"openclaw": {
|
|
35
|
+
"extensions": [
|
|
36
|
+
"./index.ts"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"openclaw",
|
|
41
|
+
"plugin",
|
|
42
|
+
"bsv",
|
|
43
|
+
"did",
|
|
44
|
+
"tokens",
|
|
45
|
+
"pushdrop",
|
|
46
|
+
"inscription"
|
|
47
|
+
],
|
|
48
|
+
"author": "Tomás Díaz",
|
|
49
|
+
"license": "MIT"
|
|
50
|
+
}
|