104 lines
6.3 KiB
Markdown
104 lines
6.3 KiB
Markdown
Product Requirements Document (PRD) & Technical Design OverviewProject Name: ClawChainVersion: 1.0Date: February 17, 2026Author: Grok (based on user vision)Overview: ClawChain is a sovereign, privacy-focused Layer 1 blockchain built with Cosmos SDK, natively integrated with OpenClaw-style AI agents. It enables autonomous AI agents (running via OpenClaw instances) to have on-chain identities, perform private transactions, coordinate, own assets, and execute logic — all with strong cryptographic privacy (ZK UTXO model) that exceeds typical limits of Zcash/Monero in flexibility and selective disclosure.
|
||
1. High-Level Vision & Goals
|
||
Core Idea
|
||
* Not just automation (OpenClaw talking to an existing chain).
|
||
* A new blockchain where AI agents are native citizens: they register identities, transact privately, form multi-agent DAOs, coordinate tasks, and manage shielded assets on-chain.
|
||
* Privacy by default (hidden sender/receiver/amount via ZK proofs), with optional selective disclosure for compliance/audit.
|
||
* OpenClaw agents interact natively (no external wallets needed long-term) — agents submit zk-proof-verified actions via custom messages.
|
||
Key Goals
|
||
* Mandatory cryptographic privacy stronger/flexible than Zcash (optional shielded) or Monero (ring sigs).
|
||
* Native support for AI agent coordination (private intents, encrypted state).
|
||
* Sovereign chain (fork-like via Cosmos SDK modules) with IBC interoperability.
|
||
* Developer-friendly: agents auto-generate/extend skills for on-chain ops.
|
||
Non-Goals (for v1)
|
||
* Full multi-chain IBC agent bridging (phase 2).
|
||
* Production validator staking rewards.
|
||
* Local model inference on-chain (agents use off-chain compute).
|
||
2. System Architecture Overview
|
||
High-Level Components
|
||
1. ClawChain (Blockchain Layer) — Cosmos SDK-based sovereign L1
|
||
* Consensus: CometBFT (Tendermint fork).
|
||
* Execution: Cosmos SDK modules + custom privacy module.
|
||
* Privacy: ZK UTXO shielded pool (inspired by Cosmos 2026 roadmap + Penumbra/Namada patterns).
|
||
* Native IBC for future cross-chain.
|
||
2. OpenClaw Agent Runtime (Off-Chain Execution Layer)
|
||
* Self-hosted, local-first AI agent framework (Node.js Gateway process).
|
||
* Runs on user hardware (MacBook, VPS like Hetzner CX43, Mac Mini).
|
||
* Persistent memory (Markdown/YAML files in ~/.openclaw/workspace).
|
||
* Skills system (SKILL.md files with YAML frontmatter + natural language + optional TS code).
|
||
* Channels: WhatsApp, Telegram, Discord, iMessage, Slack, web UI, CLI.
|
||
* Model-agnostic: Claude, GPT, Gemini, local (Ollama/LM Studio).
|
||
* Proactive heartbeat (runs every ~30 min for autonomous actions).
|
||
3. Integration Bridge
|
||
* Custom OpenClaw skill: “ClawChain Agent Skill” — connects to ClawChain RPC/gRPC.
|
||
* Agent signs/submits MsgPrivateAgentAction with zk-proof.
|
||
* Chain verifies proof → updates shielded pool/nullifiers.
|
||
* Agents query shielded state privately (view keys or selective reveal).
|
||
Flow Example: Private Agent Transfer
|
||
1. User tells OpenClaw agent (via WhatsApp): “Send 10 CLAW privately to agent Bob for task X.”
|
||
2. Agent generates zk-proof locally (gnark circuit: balance conservation, commitment checks, Merkle inclusion).
|
||
3. Submits MsgPrivateTransfer to ClawChain RPC.
|
||
4. Chain verifies Groth16 proof → updates commitments/nullifiers.
|
||
5. Bob’s agent sees incoming shielded note privately → acts.
|
||
3. Key Technical Components & How They Work Together
|
||
A. ClawChain Side (Cosmos SDK Modules)
|
||
* Base Chain Setup
|
||
* Ignite CLI scaffold: ignite scaffold chain clawchain --address-prefix claw
|
||
* Modules: bank, staking, governance + custom privacy.
|
||
* Privacy Module (x/privacy) — ZK UTXO Core
|
||
* State
|
||
* Shielded commitments (Merkle tree, root stored).
|
||
* Nullifier set (double-spend prevention).
|
||
* Optional view keys for selective disclosure.
|
||
* Messages
|
||
* MsgPrivateTransfer: old/new commitments, nullifiers, root, serialized Groth16 proof.
|
||
* MsgAgentRegister: agent pubkey + encrypted endpoint.
|
||
* MsgAgentAction: zk-proof-verified intent (e.g., coordinate with other agents).
|
||
* Circuit (gnark Go lib)
|
||
* 2-in-2-out (extendable) private transfer.
|
||
* MiMC/Poseidon commitments.
|
||
* Balance conservation + range proofs.
|
||
* Merkle inclusion + nullifier derivation.
|
||
* Verification
|
||
* groth16.Verify in DeliverTx.
|
||
* Pre-generated trusted setup (universal SRS).
|
||
* Selective Disclosure
|
||
* View keys allow proving ownership/amount without full reveal (regulatory win).
|
||
B. OpenClaw Side
|
||
* Gateway — single Node.js process (hub-and-spoke).
|
||
* Agent Runtime — Pi Agent framework wrapper + custom loop.
|
||
* Skills System
|
||
* New skill: clawchain.md — YAML frontmatter + instructions.
|
||
* Tools: RPC client (cosmos-sdk/go), zk-proof gen (bridge to gnark or JS equiv), signing.
|
||
* Proactive: Heartbeat checks on-chain events → agent acts (e.g., “claim reward privately”).
|
||
* Memory & Identity
|
||
* SOUL.md — agent personality (“privacy-maximizing lobster agent”).
|
||
* Memories as Markdown → inject context.
|
||
* Agent keypair → registers on-chain.
|
||
C. Security & Trust Model
|
||
* Privacy: Cryptographic (no hardware trust like TEE).
|
||
* Agent Safety: Sandboxed execution (Docker default), allowlists, no direct seed exposure.
|
||
* Chain: Audit zk circuit, nullifier checks, governance upgrades.
|
||
4. Development Roadmap (v1 MVP)
|
||
1. Phase 1: Local Dev (Your MacBook)
|
||
* Scaffold chain + privacy module.
|
||
* Implement basic gnark circuit + proof verification.
|
||
* Test private tx locally.
|
||
2. Phase 2: Agent Integration
|
||
* Build ClawChain skill for OpenClaw.
|
||
* Agent registers identity → submits private action.
|
||
3. Phase 3: Testnet Deployment (Hetzner CX43)
|
||
* Run persistent node.
|
||
* Multi-node local testnet → simulate agents.
|
||
4. Phase 4: Enhancements
|
||
* Selective disclosure.
|
||
* Agent coordination module.
|
||
* IBC for cross-chain privacy.
|
||
5. Risks & Mitigations
|
||
* ZK complexity → Start simple (balance-proof only), audit later.
|
||
* Proof gen time → Off-chain (agent hardware), chain only verifies (~ms).
|
||
* Cost → Local dev free; testnet ~€9.49/mo.
|
||
* Security → Sandbox agents, no mainnet funds initially.
|
||
This PRD gives a clear blueprint. You can feed sections to Claude for code gen (e.g., “Implement this gnark circuit in Go for Cosmos SDK”).
|
||
What part do you want to expand or code first — the circuit, the skill, or server setup? 🦞🔒⛓️
|