Web3 · Case Study
Forge8004
Forge8004 is an ERC-8004 trust layer for autonomous DeFi trading agents on Base Sepolia. It gives AI agents verifiable on-chain identity, runs autonomous trading cycles with real market data, and tracks reputation with stablecoin-denominated PnL and risk metrics.
01 Overview
Forge8004 is an ERC-8004 trust layer that gives autonomous DeFi trading agents a verifiable on-chain identity. Built on Base Sepolia, the platform mints ERC-721 identity tokens for AI agents, runs autonomous trading cycles using real Binance market data, validates every decision through scored risk checks and checkpoint artifacts, and tracks reputation with stablecoin-denominated PnL, Sharpe-like scoring, and max drawdown metrics. The system bridges the gap between AI-driven trading and on-chain trust verification.
02 The Challenge
Autonomous AI trading agents operate in a trust vacuum, there's no standardized way to verify an agent's identity, track its decision-making history, or assess its risk profile on-chain. Existing DeFi infrastructure treats all transactions equally regardless of the agent behind them. The challenge was to build a full trust pipeline where every trade intent is traceable from AI decision through risk validation to execution, with each stage producing verifiable checkpoint artifacts anchored on-chain, all while keeping the system performant enough for real-time trading with live market data.
03 The Solution
- 01Deployed an ERC-721 AgentRegistry smart contract on Base Sepolia (Solidity 0.8.28, OpenZeppelin v5) that mints identity tokens and anchors checkpoint hashes on-chain, linking off-chain Firestore records to on-chain tokens.
- 02Built an AI trading engine powered by Groq (openai/gpt-oss-120b) supporting 8 strategy types: range trading, spot grid bot, momentum, mean reversion, arbitrage, yield, market making, and risk-off.
- 03Implemented a full trust and validation pipeline: AI Decision → Normalization → Risk Check (scored 0-100) → EIP-712 Typed Data → Checkpoint Anchoring → Nonce Registry, with each stage producing verifiable artifacts.
- 04Developed a spot grid trading bot with AI-advised range/spacing, trailing stops, configuration history, and Bybit-style enhancements for automated position management.
- 05Integrated live Binance market data (tickers, 24h klines) with in-memory caching (30s TTL) and built coin detail pages with interactive price charts using Recharts.
- 06Built a capital sandbox with deposit/withdrawal tracking, policy snapshots per trade, and position sizing by risk profile, conservative (10%), balanced (25%), aggressive (40%).
- 07Implemented per-agent reputation metrics tracking cumulative PnL, Sharpe-like score, max drawdown, trade count, and total funds with full history in Firestore.
- 08Secured the platform with Firebase Auth (Google + email/password), field-level Firestore security rules, owner-scoped queries, and IP-based rate limiting (20 req/min on AI endpoints).
04 Key Features
- ERC-721 agent identity with on-chain checkpoint anchoring
- 8 autonomous AI trading strategies via Groq
- 5-stage trust pipeline: intent → signed → risk → execution → validation
- Spot grid bot with AI-advised parameters and trailing stops
- Live Binance market data with 30s cached tickers and klines
- Per-agent reputation: PnL, Sharpe score, max drawdown
- Capital sandbox with risk-profile position sizing
- EIP-6963 wallet discovery with automatic chain switching
