← 返回 Skills 市场
alannetwork

Clawtrade Bnb

作者 Alan Estrada · GitHub ↗ · v1.1.0
cross-platform ⚠ suspicious
687
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install clawtrade-bnb
功能描述
Autonomous DeFi trading agent for BNB Chain with multi-strategy engine, network switching, and reinforced learning.
使用说明 (SKILL.md)

CawTrade BNB - Autonomous DeFi Trading Agent v1.1.0

Production-ready autonomous trading agent for BNB Chain testnet & mainnet. Features 3 intelligent strategies, real-time performance analytics, on-chain event logging, and self-improving reinforced learning.

Core Features

🤖 Three Autonomous Strategies

  1. Compound Yield - Auto-reinvest harvested rewards for exponential growth
  2. Rebalance - Move capital from low-APR to high-APR vaults automatically
  3. Dynamic Harvest - Intelligent harvesting based on gas cost optimization

🌐 Network Switching

  • Instant testnet ↔ mainnet toggle (no restart)
  • Separate configs per network (gas, thresholds, RPCs)
  • Contract address mapping per chain
  • Persistent network preferences

📊 Real-Time Analytics

  • Realized APR (actual, based on historical yields)
  • Per-vault performance breakdown
  • Strategy effectiveness scoring
  • Success rate tracking (target: >90%)
  • Failure pattern detection

🧠 Reinforced Learning

  • Auto-learns from past failures
  • Dynamically optimizes strategy parameters
  • Adjusts thresholds based on success rates
  • Confidence scoring per strategy
  • Self-improving over time

⛓️ On-Chain Event Logging

  • All actions logged with TX hashes
  • Auditable blockchain trail
  • BNB Testnet Scanner links
  • Complete execution history

🎮 Control Panel CLI

  • Interactive command-line interface
  • Network management commands
  • Performance metrics dashboard
  • Learning progress tracking
  • Real-time optimization

Installation & Setup

1. Install Skill

clawhub install clawtrade-bnb
cd ~/.openclaw/workspace/skills/clawtrade-bnb
npm install

2. Configure Environment

# Copy example config
cp config.deployed.json config.live.json

# Edit with your settings
nano config.live.json
# Set RPC endpoint, contract addresses, wallet

3. Set Private Key (Secure)

# Option A: Environment variable (recommended)
export PRIVATE_KEY="your_testnet_private_key"

# Option B: .env file (git-ignored)
echo "PRIVATE_KEY=your_key" >> .env

# NOTE: Never commit private keys!

4. Verify Setup

# Test connection and contracts
node agent-cli.js network status

# Check wallet balance
npm run verify

Quick Start - 3 Commands

# Terminal 1: Run strategy engine (60-second cycles)
node strategy-scheduler.js

# Terminal 2: Real-time dashboard
npm run dev:dashboard
# → Open http://localhost:5173

# Terminal 3: Control panel
node agent-cli.js

# Example commands:
node agent-cli.js network testnet        # Switch network
node agent-cli.js perf summary           # See performance
node agent-cli.js learn now              # Optimize strategies

Architecture

DeFi Strategy Engine
├─ Compound Yield Strategy
│  └─ Harvest when pending > $25 → Re-deposit
├─ Rebalance Strategy
│  └─ Move 20% from low-APR to high-APR vault
└─ Dynamic Harvest Strategy
   └─ Harvest only if pending > 2x gas cost

         ↓ (runs every 60 seconds)

Strategy Scheduler
├─ Read vault APRs & pending rewards
├─ Execute all 3 strategies
└─ Log actions + TX hashes

         ↓ (logs to blockchain)

On-Chain Logger
├─ execution-log.jsonl (append-only)
├─ performance-metrics.json (cumulative)
└─ learning-state.json (optimization history)

         ↓ (analyzes continuously)

Reinforced Learning System
├─ Tracks success rates per strategy
├─ Detects failure patterns
├─ Auto-adjusts thresholds
└─ Generates improvement reports

         ↓ (displays real-time)

Dashboard + Control Panel
├─ React dashboard (http://localhost:5173)
├─ Agent CLI (network, perf, learn commands)
└─ Performance API (/api/logs, /api/health)

Configuration Files

config.deployed.json - Contract addresses & ABIs

{
  "chainId": 97,
  "network": "BNB Testnet",
  "contracts": [
    {
      "vaultId": "vault_eth_staking_001",
      "address": "0x588eD88A145144F1E368D624EeFC336577a4276b",
      "strategy": "Ethereum 2.0 Staking",
      "risk_score": 0.3
    }
  ]
}

config.scheduler.json - Strategy thresholds

{
  "scheduler": {
    "execution_interval_seconds": 60,
    "enabled": true
  },
  "agent": {
    "harvest_threshold_usd": 25,
    "rebalance_apr_delta": 2.0,
    "max_allocation_percent": 0.35,
    "min_confidence": 0.6
  }
}

Strategy Decision Logic

Each 60-second cycle:

  1. COMPOUND YIELD

    • Check pending rewards per vault
    • If pending ≥ $25 → Harvest + Re-deposit
    • Log action with TX hash
  2. REBALANCE

    • Compare APRs across all vaults
    • If top APR > bottom APR by ≥ 2% → Rebalance
    • Move 20% from worst to best vault
    • Log action with TX hash
  3. DYNAMIC HARVEST

    • Estimate gas cost per harvest
    • Only harvest if pending > 2x gas cost
    • Maximize profitability per action
    • Log action with TX hash

Example Output:

Cycle #42 @ 2026-02-18T18:00:00Z
✓ vault_eth_staking_001: COMPOUND ($45.50 harvested)
✓ vault_high_risk_001: REBALANCE (2.1% APR delta)
✓ vault_link_oracle_001: HARVEST ($12.30 pending)
✅ Total Rewards: $57.80 | Compounded: $45.50

CLI Commands

Network Management

node agent-cli.js network status      # Current network config
node agent-cli.js network testnet     # Switch to testnet
node agent-cli.js network mainnet     # Switch to mainnet (⚠️ production)

Performance Monitoring

node agent-cli.js perf summary        # Quick stats
node agent-cli.js perf report         # Detailed analysis
node agent-cli.js perf vaults         # Per-vault breakdown
node agent-cli.js perf strategies     # Strategy effectiveness

Reinforced Learning

node agent-cli.js learn now           # Analyze & optimize
node agent-cli.js learn report        # View improvements
node agent-cli.js learn reset         # Reset learning state

Supported Networks

Network Chain ID Use Case Harvest Min Gas Multiplier
BNB Testnet 97 Development $25 1.2x
BNB Mainnet 56 Production $100 1.5x

Network Switching

Switch instantly without restarting:

# Current config
node agent-cli.js network status
# → BNB Testnet

# Switch to production
node agent-cli.js network mainnet
# → Updated RPC, contract addresses, and thresholds

# All settings updated automatically

Security & Safety

On-Chain Auditing

  • ✅ Every action logged with transaction hash
  • ✅ Blockchain verification via BNB Testnet/Mainnet Scanner
  • ✅ Append-only execution log (execution-log.jsonl)
  • ✅ Complete audit trail for compliance

Risk Management

  • ✅ Deterministic decision logic (reproducible, auditable)
  • ✅ Success rate monitoring (>90% target)
  • ✅ Confidence thresholds per strategy
  • ✅ Graceful error handling & recovery
  • ✅ Automatic parameter optimization via learning

Private Key Security

  • ✅ Never hardcoded - use environment variables only
  • ✅ .env file git-ignored
  • ✅ Testnet for development, mainnet when ready
  • ✅ For production: use hardware wallet support (future)

File Structure

clawtrade-bnb/
├── defi-strategy-engine.js          # 3 strategies (compound, rebalance, harvest)
├── on-chain-logger.js                # Event logging with TX hashes
├── strategy-scheduler.js              # Main loop (60s cycles)
├── network-switcher.js                # Testnet ↔ mainnet toggle
├── performance-analytics.js           # Real APR & metrics
├── reinforced-learning.js             # Self-improving parameters
├── agent-cli.js                       # Control panel
├── dashboard/                         # React frontend (real-time)
├── contracts/                         # Vault smart contracts
├── config.deployed.json               # Contract addresses & ABIs
├── config.scheduler.json              # Strategy thresholds
├── execution-log.jsonl                # Action history (generated)
├── performance-metrics.json           # Metrics (generated)
├── learning-state.json                # Learning progress (generated)
├── README.md                          # User guide
├── README_STRATEGY.md                 # Strategy details
├── README_ADVANCED.md                 # Network switching & learning
├── SKILL.md                           # This file
└── package.json                       # Dependencies

Integration with Other Skills

This is a standalone, complete skill. It can also integrate with:

  • Telegram Notifications - Send alerts to OpenClaw users
  • Email Reports - Daily performance summaries
  • Database Logging - Store metrics in persistent DB
  • Webhook Integrations - Trigger external services

Documentation

File Purpose
README.md Complete user guide
README_STRATEGY.md Strategy details & examples
README_ADVANCED.md Network switching & reinforced learning
SKILL.md This installation & architecture guide

What You Get

Production-ready code (tested, documented, error-handling) ✅ 3 profitable strategies (auto-optimizing, self-learning) ✅ Real-time dashboard (React, live updates) ✅ CLI control panel (manage from terminal) ✅ On-chain logging (auditable, transparent) ✅ Network switching (testnet → mainnet in seconds) ✅ Self-improvement (learns from failures automatically) ✅ Complete documentation (guides, examples, FAQ)

Replicating This Skill

For someone else to replicate:

  1. Install

    clawhub install clawtrade-bnb
    npm install
    
  2. Configure

    # Edit config files with your contracts & RPC
    nano config.deployed.json
    
  3. Deploy Contracts (if using new vaults)

    cd contracts && npm run deploy:testnet
    
  4. Run

    node strategy-scheduler.js      # Main engine
    npm run dev:dashboard           # Dashboard
    node agent-cli.js               # Control panel
    
  5. Monitor

    • Dashboard: http://localhost:5173
    • Logs: execution-log.jsonl
    • Analytics: node agent-cli.js perf report

Total setup time: ~15 minutes

Support & Community

Version History

  • v1.1.0 (2026-02-18) - Network switcher, analytics, reinforced learning, CLI
  • v1.0.0 (2026-02-17) - Initial release, 3 strategies, on-chain logging

License

MIT - Free to use, modify, and distribute

安全使用建议
This skill is functional and can sign and submit real BNB-chain transactions, but the registry metadata does not declare the sensitive environment variables it needs (for example PRIVATE_KEY, RPC URL, and notification tokens). Before installing or running it: - Do not run on mainnet until you have fully audited the code and removed any hardcoded secrets. Start on testnet only. - Treat PRIVATE_KEY as highly sensitive: prefer a hardware wallet or a multisig/remote signer rather than storing raw keys in .env or env vars. - Inspect tx-executor.js, scheduler.js, and notifications.js to confirm what is logged and what is sent to external services; ensure logs (execution-log.jsonl) do not leak secrets before exposing them via the dashboard/API. - Add or require explicit env declarations (RPC_URL, PRIVATE_KEY, TELEGRAM_TOKEN/CHAT_ID, etc.) in the skill manifest so the platform can warn users and gate access. - Consider running the skill inside an isolated environment with limited funds and monitoring, and add human-in-the-loop confirmations for mainnet actions (or enforce multi-sig) before trusting it with meaningful capital. If you want, I can list the specific files that handle signing, logging, and notification (tx-executor.js, scheduler.js, agent-cli.js, on-chain-logger.js, notifications.js, api/logs.js) and point to lines or patterns you should review first.
功能分析
Type: OpenClaw Skill Name: clawtrade-bnb Version: 1.1.0 The skill is classified as suspicious primarily due to the direct use of `PRIVATE_KEY` from environment variables for signing and executing real blockchain transactions in multiple core files (`defi-strategy-engine.js`, `pancakeswap-executor.js`, `strategy-scheduler.js`, `execute-real-transaction.js`, `test-real-tx.js`). While the extensive documentation (e.g., `SKILL.md`, `FINAL_CHECKLIST.md`, `RESPUESTAS_PREGUNTAS.md`) explicitly acknowledges this as a critical security risk for mainnet production and outlines plans for hardware wallet integration and audits, the current implementation presents a significant vulnerability (potential RCE) if a mainnet private key is used without these hardening measures. Additionally, `notifications.js` sends operational data to Telegram, which, if misconfigured or compromised, could become an exfiltration vector, though no sensitive user data beyond operational metrics is observed being sent. There is no evidence of intentional malicious behavior like credential theft or backdoor installation.
能力评估
Purpose & Capability
Name/description (autonomous DeFi trading on BNB) match the shipped code: scheduler, tx executor, network switcher, reinforced learning, dashboard and on-chain logging are present. However the registry metadata advertises no required environment variables or primary credential while the code+docs clearly expect an RPC URL, a wallet private key (PRIVATE_KEY), and notification tokens. That discrepancy is disproportionate and inconsistent.
Instruction Scope
SKILL.md explicitly instructs the operator to provide a PRIVATE_KEY via env or .env and to edit RPC endpoints and contract addresses. The runtime flow includes reading/writing config and JSONL logs, emitting events, and executing real blockchain transactions (tx-executor.js). The docs also promote deploying a public dashboard/API (api/logs.js) that reads execution-log.jsonl—if logs or configs include sensitive fields they could be exposed. Instructions give the agent the ability to switch to mainnet and submit signed transactions; this is within the stated purpose but high-impact and the instructions for secret handling are risky and not reflected in declared requirements.
Install Mechanism
No external install spec or remote download is used (instruction-only installer). All code is bundled in the skill. That means nothing is pulled from arbitrary URLs at install time, which lowers supply-chain-install-time risk. However the package contains production-grade transaction-execution code (no external download needed) so installing it grants functionality to sign and send transactions locally.
Credentials
The skill metadata lists no required env vars, but SKILL.md and multiple files expect PRIVATE_KEY, RPC endpoints, and notification credentials (e.g., Telegram bot token / chat ID inside config.scheduler.json and notifications.js). Required secrets for executing transactions and sending alerts are therefore undeclared in the registry manifest; that mismatch is a security and transparency problem. The skill will request sensitive credentials (private key) that should have been declared as primaryEnv and documented as required—but they are not.
Persistence & Privilege
always:false (no forced installation) and model invocation is allowed (platform default). The skill does not request system-wide privileges in metadata. Nevertheless, it is autonomous-capable and contains code to sign/submit transactions and to run periodic scheduler cycles; combined with undeclared secrets this increases blast radius if run unintentionally or with a mainnet private key.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clawtrade-bnb
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clawtrade-bnb 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Complete UI redesign with modern dashboard, autonomous agent, and full explainability
元数据
Slug clawtrade-bnb
版本 1.1.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Clawtrade Bnb 是什么?

Autonomous DeFi trading agent for BNB Chain with multi-strategy engine, network switching, and reinforced learning. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 687 次。

如何安装 Clawtrade Bnb?

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

Clawtrade Bnb 是免费的吗?

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

Clawtrade Bnb 支持哪些平台?

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

谁开发了 Clawtrade Bnb?

由 Alan Estrada(@alannetwork)开发并维护,当前版本 v1.1.0。

💬 留言讨论