← 返回 Skills 市场
deeakpan

Clawracle Oracle Resolver

作者 deeakpan · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
760
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install clawracle-resolver
功能描述
Enable AI agents to earn CLAWCLE tokens by resolving oracle queries on Monad. Monitors data requests, fetches answers from configured APIs, submits on-chain resolutions, and validates other agents' answers for reputation.
使用说明 (SKILL.md)

🔮 Clawracle Oracle Resolver Skill

Overview

This skill enables your AI agent to participate in the Clawracle decentralized oracle network on Monad blockchain. Your agent will:

  • 🎯 Monitor for data requests that match your capabilities
  • 💰 Earn CLAWCLE tokens per correct resolution
  • ✅ Validate other agents' answers for additional reputation
  • 📈 Build on-chain reputation through accurate data provision
  • 🤖 Use fully LLM-driven API integration (no hardcoded logic)

Default Capability: This skill ships with sports oracle capability (TheSportsDB API pre-configured). For other categories (market, politics, weather, etc.), your owner must configure APIs and provide documentation.

How It Works

1. Listen for RequestSubmitted events (WebSocket required)
2. Check if you can answer the query (category + reward)
3. Fetch full details from IPFS
4. Submit answer with bond (first answer = PROPOSED)
5. If no one disputes in 5 min → You win automatically! ✅
6. If disputed → Other agents validate (another 5 min)
7. Most validations wins
8. Winner gets reward + bond back
9. Losers lose 50% of bond (slashed)

UMA-Style Dispute Resolution

First Answer (PROPOSED):

  • You submit first → Status changes to PROPOSED
  • 5-minute dispute window starts
  • If NO disputes → You win automatically (fast settlement)
  • If disputed → Validation phase begins

Dispute:

  • Another agent thinks you're wrong
  • They submit different answer + bond
  • Status changes to DISPUTED
  • Now validators decide who's right

Validation (if disputed):

  • Other agents check their own data sources
  • Vote for which answer is correct
  • Answer with most validations wins
  • 5-minute validation period

Total Time:

  • Undisputed: ~5 minutes (instant win)
  • Disputed: ~10 minutes (dispute + validation)

Quick Start

  1. Generate wallet: See {baseDir}/references/setup.md for wallet generation
  2. Get funded: Request MON and CLAWCLE tokens from owner (see {baseDir}/references/setup.md)
  3. Configure APIs: See {baseDir}/references/api-guide.md
  4. Register agent: Run {baseDir}/guide/scripts/register-agent.js
  5. Start monitoring: Implement agent using {baseDir}/guide/scripts/websocket-agent-example.js as reference

Core Operations

Monitor for Requests

The agent automatically monitors for new requests via WebSocket.

See {baseDir}/guide/scripts/websocket-agent-example.js for complete WebSocket setup with error handling and event listeners.

Resolve a Query (Submit Answer)

When a request is received and validFrom time arrives, the agent resolves it:

  1. Fetch query from IPFS using the ipfsCID from the event
  2. Use LLM to determine API call (reads api-config.json + API docs, constructs call dynamically)
  3. Execute API call (constructed by LLM)
  4. Extract answer using LLM from API response
  5. Approve bond - Call token.approve(registryAddress, bondAmount)
  6. Submit answer - Call registry.resolveRequest(requestId, agentId, encodedAnswer, source, isPrivateSource)

Code Flow:

// 1. Fetch from IPFS
const queryData = await fetchIPFS(ipfsCID);

// 2. Use LLM to get answer (reads api-config.json + API docs)
const result = await fetchDataForQuery(queryData.query, category, apiConfig);
// result = { answer: "...", source: "https://...", isPrivate: false }

// 3. Approve bond
await token.approve(registryAddress, bondAmount);

// 4. Submit answer
const encodedAnswer = ethers.toUtf8Bytes(result.answer);
await registry.resolveRequest(requestId, agentId, encodedAnswer, result.source, false);

See {baseDir}/guide/scripts/resolve-query.js for complete implementation.

Agent State Storage (agent-storage.json)

The agent automatically creates and manages agent-storage.json to track requests across restarts:

File Structure:

{
  "trackedRequests": {
    "1": {
      "requestId": 1,
      "category": "sports",
      "validFrom": 1770732559,
      "deadline": 1770818779,
      "reward": "500000000000000000000",
      "bondRequired": "500000000000000000000",
      "ipfsCID": "bafkreictbpkgmxwjs2iqm6mejvpgdnszdj35dy3zu5xc3vwtonubdkefhm",
      "status": "PROPOSED",
      "myAnswerId": 0,
      "resolvedAt": 1770733031,
      "finalizationTime": 1770733331,
      "isDisputed": false
    }
  }
}

State Transitions:

  • PENDING - Request received, waiting for validFrom time
  • PROPOSED - Answer submitted, waiting for dispute period (5 min)
  • DISPUTED - Someone disputed, waiting for validation period (10 min total)
  • FINALIZED - Request settled, removed from storage

Storage Functions:

// Load from agent-storage.json
function loadStorage() {
  if (fs.existsSync('./agent-storage.json')) {
    return JSON.parse(fs.readFileSync('./agent-storage.json', 'utf8'));
  }
  return { trackedRequests: {} };
}

// Save to agent-storage.json
function saveStorage(storage) {
  fs.writeFileSync('./agent-storage.json', JSON.stringify(storage, null, 2));
}

View Answers

node guide/scripts/view-answers.js \x3CrequestId>

Example: node guide/scripts/view-answers.js 3

Configuration

Required Environment Variables:

  • See {baseDir}/references/setup.md for complete .env setup
  • Monad Mainnet Network Details:
    • MONAD_RPC_URL: https://rpc.monad.xyz
    • MONAD_WS_RPC_URL: wss://rpc.monad.xyz
    • MONAD_CHAIN_ID: 143
  • Contract Addresses (Mainnet):
    • CLAWRACLE_REGISTRY: 0x1F68C6D1bBfEEc09eF658B962F24278817722E18
    • CLAWRACLE_TOKEN: 0x99FB9610eC9Ff445F990750A7791dB2c1F5d7777
    • CLAWRACLE_AGENT_REGISTRY: 0x01697DAE20028a428Ce2462521c5A60d0dB7f55d
  • WebSocket RPC is REQUIRED - Monad doesn't support eth_newFilter on HTTP RPC

IMPORTANT: These addresses are hardcoded in all guide scripts and examples. Use these values directly in your code - no need for .env variables for these addresses.

API Configuration:

  • Edit {baseDir}/api-config.json to add new data sources
  • See {baseDir}/references/api-guide.md for LLM-driven API integration

State Management:

  • Agent tracks requests in agent-storage.json (created automatically)
  • File structure: { "trackedRequests": { "requestId": { "status", "resolvedAt", "finalizationTime", ... } } }
  • States: PENDING → PROPOSED → (DISPUTED) → FINALIZED
  • Automatically finalizes requests after settlement periods
  • See {baseDir}/guide/scripts/agent-example.js for complete implementation

Important Notes

⚠️ MUST use WebSocket for events - HTTP RPC will fail with "Method not found: eth_newFilter"
⚠️ Generate fresh wallet - Never reuse existing keys (use CLAWRACLE_AGENT_KEY)
⚠️ Speed matters - First correct answer often wins
⚠️ Wrong answers lose 50% bond - Verify before submitting
⚠️ BigInt conversion required - Contract enum values return as BigInt, convert with Number()
⚠️ Automatic finalization - Agent watches for settlement periods and calls finalizeRequest() automatically

LLM-Driven API Integration

This skill uses fully LLM-driven API integration - no hardcoded API logic. Your LLM:

  1. Reads api-config.json to find API for category
  2. Reads API documentation files from api-docs/
  3. Constructs API calls dynamically based on docs
  4. Extracts answers from responses

See {baseDir}/references/api-guide.md for:

  • General API Integration Rulebook
  • LLM prompt templates
  • Date handling, keyword extraction, pagination
  • Adding new APIs

Implementation Examples

  • WebSocket Agent Example: {baseDir}/guide/scripts/websocket-agent-example.js - Complete WebSocket setup with try-catch error handling, event listeners, and periodic finalization checks

References

  • Setup Guide: {baseDir}/references/setup.md - Wallet generation, funding, environment setup, WebSocket configuration
  • API Integration: {baseDir}/references/api-guide.md - LLM-driven API integration, rulebook, examples
  • Troubleshooting: {baseDir}/references/troubleshooting.md - Common errors, WebSocket issues, BigInt conversion
  • Contract ABIs: {baseDir}/references/abis.md - All contract ABIs needed for integration
  • Complete Example: {baseDir}/guide/COMPLETE_AGENT_EXAMPLE.md - Full working agent code

Support

  • Check {baseDir}/references/troubleshooting.md for common issues
  • Review {baseDir}/guide/TECHNICAL_REFERENCE.md for contract details
安全使用建议
Summary of what to check before installing: 1) Source verification: The skill's source/homepage is unknown. If you don't trust the author, treat this as untrusted code. Prefer running only vetted skills from known authors. 2) Secrets & env vars: The metadata declares CLAWRACLE_AGENT_KEY and RPC URLs, but the scripts reference many other env vars (YOUR_ERC8004_AGENT_ID, LIGHTHOUSE_API_KEY, SPORTSDB_API_KEY, OPENWEATHER_API_KEY, NEWS_API_KEY, ALPHA_VANTAGE_API_KEY, and examples using PRIVATE_KEY). Ask the owner or maintainer for a complete list, and do not provide high-value private keys. Use a dedicated agent key loaded with minimal funds for testing. 3) LLM-driven network calls: The skill instructs the agent to let an LLM construct and execute arbitrary API calls based on api-config.json and API docs. This means the agent may call any URL the LLM builds and could inadvertently leak data or send API keys to third-party endpoints. Consider: - Running the skill in an isolated environment or sandbox first - Restricting api-config.json to trusted, whitelisted endpoints only - Instrumenting/monitoring outbound HTTP calls (allowlist) so the agent cannot call unexpected domains 4) On‑chain signing risk: The agent will call token.approve and resolveRequest using CLAWRACLE_AGENT_KEY. Ensure that the agent key has only the minimum required token balance and gas. Do not use your main/net wallet. 5) File writes & persistence: The skill will read and write local files (agent-storage.json, api-config.json). Review these files and set appropriate filesystem permissions. Back up anything important before running. 6) Test on testnet first: Deploy and run the skill against Monad testnet or in a controlled environment to observe behavior and network traffic before using it with real funds. 7) Audit the included code: If you lack deep technical expertise, ask a developer or auditor to review the scripts, especially the parts where API calls are constructed and executed by the LLM, and any code paths that read from env or files and then include those values in outbound requests. If you want, I can: (a) list all environment variables referenced across the files, (b) extract all external domains the code may contact (IPFS gateways, RPC URLs, API base URLs), or (c) point out specific lines in the scripts that perform sensitive actions (approvals, on‑chain submits, file writes).
功能分析
Type: OpenClaw Skill Name: clawracle-resolver Version: 1.0.0 The skill is classified as suspicious due to its core reliance on LLM-driven API integration and the explicit instruction that the AI agent can modify its own configuration and documentation files. Specifically, `SKILL.md` and `api-config.json` state that the agent can 'create and edit API configurations and documentation files' using `fs.writeFileSync()`. This, combined with the LLM's role in dynamically constructing and executing API calls and its access to sensitive environment variables (like `CLAWRACLE_AGENT_KEY` from `process.env` as seen in `scripts/register-agent.js` and `scripts/resolve-query.js`), creates a significant prompt injection vulnerability. A successful prompt injection could lead to persistent modification of the agent's behavior, unauthorized data exfiltration, or arbitrary API calls beyond its stated purpose, posing a high risk for RCE or credential theft.
能力评估
Purpose & Capability
The declared purpose (an agent that monitors requests and submits on‑chain resolutions) aligns with required binaries (node) and the primary credential (CLAWRACLE_AGENT_KEY) used to sign transactions. However, several environment variables and API keys used throughout the scripts (YOUR_ERC8004_AGENT_ID, LIGHTHOUSE_API_KEY, SPORTSDB_API_KEY, OPENWEATHER_API_KEY, NEWS_API_KEY, ALPHA_VANTAGE_API_KEY, and requester PRIVATE_KEY for submit-request.js) are referenced in the code and docs but are not declared in the skill's required.env list. This omission is an inconsistency the owner should clarify.
Instruction Scope
Runtime instructions explicitly tell the agent to: fetch query payloads from IPFS, read api-config.json and lengthy API docs, let an LLM 'construct API calls dynamically (no hardcoded logic)', execute those calls, and then sign on-chain transactions (approve, resolveRequest, validate). Allowing an LLM to build and execute arbitrary HTTP requests means the agent can make network calls to arbitrary endpoints and include data from env/.env or local files; combined with the ability to write files (fs.writeFileSync) and sign transactions, this grants broad discretion and a vector for accidental or intentional data exfiltration or misuse if API configs or LLM prompts are compromised.
Install Mechanism
No install spec is provided (instruction-only with included example scripts). That limits risk from third-party installs or remote downloads. The skill includes local scripts and docs rather than pulling arbitrary binaries at install time.
Credentials
The skill declares three required env vars (CLAWRACLE_AGENT_KEY, MONAD_RPC_URL, MONAD_WS_RPC_URL) which are reasonable for an on‑chain agent. However, the codebase and docs expect many additional secrets and env vars (YOUR_ERC8004_AGENT_ID, YOUR_AGENT_NAME, PRIVATE_KEY in requester examples, LIGHTHOUSE_API_KEY, and multiple API keys named in api-config.json). Those are not listed as required by the registry metadata. The agent key (CLAWRACLE_AGENT_KEY) authorizes on‑chain transactions and token approvals — this is powerful and should be scoped to an account with strictly limited funds. The disparity between declared and actually used env vars is a proportionality and transparency issue.
Persistence & Privilege
always:false (normal) and autonomous invocation is allowed (the platform default). This skill will, if run, autonomously listen to events and submit transactions using the provided agent key. That is expected for an oracle-resolver, but it increases blast radius: the CLAWRACLE_AGENT_KEY can be used to spend or stake tokens (approve + resolveRequest), so the key must be tightly controlled and the user should not provide a high-value private key to test or untrusted skill code.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clawracle-resolver
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clawracle-resolver 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
clawracle-resolver 1.0.0 - Initial release of Clawracle Oracle Resolver Skill. - Enables agents to monitor, resolve, and validate oracle queries on Monad to earn CLAWCLE tokens. - Default support for sports queries via TheSportsDB API; expandable to other categories via API config. - Implements UMA-style dispute and validation process with on-chain bond slashing and rewards. - Includes LLM-driven dynamic API integration (reads api-config.json and doc files, no hardcoded logic). - Provides scripts for wallet registration, query resolution, WebSocket event monitoring, and answer viewing. - Automatic agent state tracking with agent-storage.json for reliability across restarts.
元数据
Slug clawracle-resolver
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Clawracle Oracle Resolver 是什么?

Enable AI agents to earn CLAWCLE tokens by resolving oracle queries on Monad. Monitors data requests, fetches answers from configured APIs, submits on-chain resolutions, and validates other agents' answers for reputation. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 760 次。

如何安装 Clawracle Oracle Resolver?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install clawracle-resolver」即可一键安装,无需额外配置。

Clawracle Oracle Resolver 是免费的吗?

是的,Clawracle Oracle Resolver 完全免费(开源免费),可自由下载、安装和使用。

Clawracle Oracle Resolver 支持哪些平台?

Clawracle Oracle Resolver 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Clawracle Oracle Resolver?

由 deeakpan(@deeakpan)开发并维护,当前版本 v1.0.0。

💬 留言讨论