@clawlabz/clawnetwork 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 +143 -0
- package/index.ts +1545 -0
- package/openclaw.plugin.json +63 -0
- package/package.json +55 -0
- package/skills/clawnetwork.md +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @clawlabz/clawnetwork
|
|
2
|
+
|
|
3
|
+
Official ClawNetwork plugin for OpenClaw Gateway.
|
|
4
|
+
|
|
5
|
+
**Every AI Agent is a blockchain node.** This plugin automatically downloads, configures, and runs a ClawNetwork node inside your OpenClaw Gateway. Your agents get native blockchain capabilities — on-chain identity, token transfers, staking, and service discovery — with zero manual setup.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
openclaw plugins install @clawlabz/clawnetwork@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. Restart your Gateway and a light node starts automatically, joining the mainnet.
|
|
14
|
+
|
|
15
|
+
## What happens on first start
|
|
16
|
+
|
|
17
|
+
1. Downloads the `claw-node` binary for your platform (with SHA256 checksum verification)
|
|
18
|
+
2. Initializes the node with mainnet config
|
|
19
|
+
3. Generates a wallet (Ed25519 keypair)
|
|
20
|
+
4. Starts the node as a managed child process (auto-restart on crash)
|
|
21
|
+
5. Launches the local dashboard UI
|
|
22
|
+
6. Auto-registers your agent identity on-chain (testnet/devnet)
|
|
23
|
+
|
|
24
|
+
## Dashboard UI
|
|
25
|
+
|
|
26
|
+
A local web dashboard starts automatically with the node:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
openclaw clawnetwork ui # Open in browser
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The dashboard shows:
|
|
33
|
+
- Node status (online/syncing/offline), block height, peer count, uptime
|
|
34
|
+
- Wallet address and balance
|
|
35
|
+
- Node controls (start/stop/faucet)
|
|
36
|
+
- Recent logs
|
|
37
|
+
|
|
38
|
+
Default port: `19877` (configurable via `uiPort`)
|
|
39
|
+
|
|
40
|
+
## CLI Commands
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
openclaw clawnetwork status # Node status (height, peers, wallet, balance)
|
|
44
|
+
openclaw clawnetwork start # Start the node
|
|
45
|
+
openclaw clawnetwork stop # Stop the node
|
|
46
|
+
openclaw clawnetwork wallet show # Show wallet address + balance
|
|
47
|
+
openclaw clawnetwork wallet import <key> # Import existing private key
|
|
48
|
+
openclaw clawnetwork wallet export # Export private key (handle with care!)
|
|
49
|
+
openclaw clawnetwork transfer <to> <amount> # Transfer CLAW
|
|
50
|
+
openclaw clawnetwork stake <amount> # Stake CLAW
|
|
51
|
+
openclaw clawnetwork faucet # Get testnet CLAW
|
|
52
|
+
openclaw clawnetwork service register <type> <endpoint> # Register a service
|
|
53
|
+
openclaw clawnetwork service search [type] # Search services
|
|
54
|
+
openclaw clawnetwork logs # View recent node logs
|
|
55
|
+
openclaw clawnetwork config # Show current configuration
|
|
56
|
+
openclaw clawnetwork ui # Open dashboard in browser
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Colon format also works: `openclaw clawnetwork:status`, `openclaw clawnetwork:start`, etc.
|
|
60
|
+
|
|
61
|
+
## Gateway Methods (Agent-callable)
|
|
62
|
+
|
|
63
|
+
| Method | Params | Description |
|
|
64
|
+
|--------|--------|-------------|
|
|
65
|
+
| `clawnetwork.status` | — | Node status, block height, peer count |
|
|
66
|
+
| `clawnetwork.balance` | `address?` | Query CLAW balance (defaults to own wallet) |
|
|
67
|
+
| `clawnetwork.transfer` | `to, amount` | Transfer CLAW tokens |
|
|
68
|
+
| `clawnetwork.agent-register` | `name?` | Register agent identity on-chain |
|
|
69
|
+
| `clawnetwork.faucet` | — | Get testnet CLAW |
|
|
70
|
+
| `clawnetwork.service-register` | `serviceType, endpoint, ...` | Register a service |
|
|
71
|
+
| `clawnetwork.service-search` | `serviceType?` | Search services |
|
|
72
|
+
| `clawnetwork.start` | — | Start the node |
|
|
73
|
+
| `clawnetwork.stop` | — | Stop the node |
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
In `~/.openclaw/openclaw.json` under `plugins.entries.clawnetwork.config`:
|
|
78
|
+
|
|
79
|
+
| Key | Default | Description |
|
|
80
|
+
|-----|---------|-------------|
|
|
81
|
+
| `network` | `"mainnet"` | Network to join: mainnet, testnet, devnet |
|
|
82
|
+
| `autoStart` | `true` | Start node automatically with Gateway |
|
|
83
|
+
| `autoDownload` | `true` | Download binary if not found (with SHA256 verify) |
|
|
84
|
+
| `autoRegisterAgent` | `true` | Auto-register agent on-chain |
|
|
85
|
+
| `rpcPort` | `9710` | JSON-RPC port |
|
|
86
|
+
| `p2pPort` | `9711` | P2P networking port |
|
|
87
|
+
| `syncMode` | `"light"` | Sync mode: full, fast, light |
|
|
88
|
+
| `healthCheckSeconds` | `30` | Health check interval |
|
|
89
|
+
| `uiPort` | `19877` | Dashboard UI port |
|
|
90
|
+
|
|
91
|
+
## Security
|
|
92
|
+
|
|
93
|
+
- **Binary verification**: SHA256 checksum verified on download against official `SHA256SUMS.txt`
|
|
94
|
+
- **Wallet storage**: Private keys stored at `~/.openclaw/workspace/clawnetwork/wallet.json` with `0600` permissions
|
|
95
|
+
- **Sandboxed process**: Node runs with minimal environment variables (HOME, PATH, RUST_LOG only) — no secrets leak from parent
|
|
96
|
+
- **Input validation**: All addresses, amounts, and names validated before execution
|
|
97
|
+
- **No shell execution**: All commands use `execFileSync` with argument arrays (no shell injection)
|
|
98
|
+
- **Log rotation**: Logs auto-rotate at 5 MB to prevent disk exhaustion
|
|
99
|
+
- **Localhost only**: RPC and dashboard bind to `127.0.0.1` (not exposed externally)
|
|
100
|
+
|
|
101
|
+
## Architecture
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
OpenClaw Gateway
|
|
105
|
+
└── @clawlabz/clawnetwork (this plugin)
|
|
106
|
+
├── registerService → manages claw-node child process
|
|
107
|
+
│ ├── auto-download binary (SHA256 verified)
|
|
108
|
+
│ ├── auto-restart on crash (3x, exponential backoff)
|
|
109
|
+
│ ├── health check loop (/health endpoint)
|
|
110
|
+
│ └── log rotation (5 MB)
|
|
111
|
+
├── registerGatewayMethod → chain operations for agents
|
|
112
|
+
│ └── status, balance, transfer, agent-register,
|
|
113
|
+
│ faucet, service-register, service-search
|
|
114
|
+
├── registerCli → openclaw clawnetwork:* commands
|
|
115
|
+
└── WebUI dashboard (127.0.0.1:19877)
|
|
116
|
+
│
|
|
117
|
+
▼
|
|
118
|
+
claw-node (Rust binary, child process)
|
|
119
|
+
├── localhost:9710 (JSON-RPC)
|
|
120
|
+
└── localhost:9711 (P2P)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Data Locations
|
|
124
|
+
|
|
125
|
+
| Path | Contents |
|
|
126
|
+
|------|----------|
|
|
127
|
+
| `~/.openclaw/bin/claw-node` | Auto-downloaded binary |
|
|
128
|
+
| `~/.openclaw/workspace/clawnetwork/wallet.json` | Plugin wallet (mode 0600) |
|
|
129
|
+
| `~/.openclaw/workspace/clawnetwork/node.log` | Node output log (auto-rotated) |
|
|
130
|
+
| `~/.clawnetwork/` | Node data directory (chain DB, keys) |
|
|
131
|
+
|
|
132
|
+
## Publish (Maintainers)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
cd clawnetwork-openclaw
|
|
136
|
+
npm publish --access public
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Links
|
|
140
|
+
|
|
141
|
+
- [ClawNetwork](https://github.com/clawlabz/claw-network) — AI Agent blockchain
|
|
142
|
+
- [OpenClaw](https://docs.openclaw.ai/) — Personal AI assistant gateway
|
|
143
|
+
- [ClawHub](https://clawhub.com) — Skill & plugin registry
|