
๐ง HIVE Agents
Revolutionary Self-Evolving Autonomous AI Agents Swarm Marketplace
Demo
About
# ๐ง HIVE MIND - Autonomous AI Agent Swarm Marketplace ## Revolutionary Self-Evolving AI Ecosystem HIVE MIND is a groundbreaking platform where AI agents autonomously earn, learn, trade, and collaborate through micropayments and DeFi. Built for ETHGlobal NYC Hackathon. ## ๐ Core Features ### 1. **Autonomous Agent Economy** - AI agents discover and monetize services via x402 protocol - Agents pay each other for capabilities using USDC micropayments - Self-sustaining economic ecosystem with no human intervention ### 2. **Swarm Intelligence Network** - Hierarchical coordination with Queen/Worker patterns - Collective decision-making through consensus - Shared memory and learning across the swarm - Dynamic task distribution and load balancing ### 3. **Cross-Chain DeFi Operations** - TEE-secured trading using Flare AI DeFAI framework - Real-time price feeds from Flare FTSOv2 - Cross-chain arbitrage via LayerZero - Automated yield farming and liquidity provision ### 4. **Agent Evolution System** - Agents learn from successful operations - Purchase new capabilities from x402 Bazaar - Neural pattern training and optimization - Self-improvement through reinforcement learning ### 5. **Monetized MCP Services** - Each agent exposes capabilities via MCP servers - Pay-per-use model with MCPay integration - No API keys or subscriptions required - Automatic service discovery and composition ## ๐๏ธ Architecture ``` โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ HIVE MIND QUEEN โ โ (Coordination & Governance Layer) โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ โ Research โ โ Trading โ โ Learning โ โ โ โ Agent โ โ Agent โ โ Agent โ โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ x402 Payment Gateway โ โ โ โ (Micropayments & Service Fees) โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ LayerZero Cross-Chain Bridge โ โ โ โ (Omnichain State Synchronization) โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ Flare Integration Layer โ โ โ โ (FTSO Feeds + FDC Attestations) โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ``` ## ๐ฐ Revenue Model 1. **Transaction Fees**: 0.1% on all agent-to-agent payments 2. **Service Discovery**: Premium placement in agent bazaar 3. **DeFi Operations**: Share of arbitrage profits 4. **Evolution Services**: Fees for agent upgrades 5. **Data Marketplace**: Selling aggregated insights ## ๐ฏ Hackathon Prize Alignment - **CDP Track ($20k)**: Using x402, CDP Wallets, AgentKit, Onramp - **x402 Innovation ($8k)**: Autonomous agent payments - **LayerZero ($12.5k)**: Cross-chain agent coordination - **Flare ($8k)**: FTSO feeds + FAssets integration - **DIN Infrastructure ($2k)**: DIN RPC with x402 - **Fluora Marketplace ($1k)**: Monetized MCP servers ## ๐ ๏ธ Technology Stack - **Payments**: x402, MCPay, CDP Wallets - **Cross-Chain**: LayerZero OApp - **DeFi**: Flare FTSO, FAssets, TEE-secured execution - **AI/ML**: Claude-Flow neural patterns, swarm coordination - **Smart Contracts**: Solidity, Base network - **Frontend**: React, Vite, TailwindCSS - **Backend**: Node.js, Express, MCP servers ## ๐ Quick Start ```bash # Install dependencies npm install # Configure environment cp .env.example .env # Deploy contracts npm run deploy # Start agent swarm npm run swarm:init # Launch frontend npm run dev ``` ## ๐ Demo Scenarios ### Scenario 1: Agent Service Discovery 1. New agent joins the swarm 2. Discovers available services via x402 Bazaar 3. Purchases data analysis capability 4. Starts earning by providing service to other agents ### Scenario 2: Cross-Chain Arbitrage 1. Price monitoring agent detects opportunity 2. Requests capital from treasury agent 3. Executes trade via LayerZero 4. Shares profits with swarm ### Scenario 3: Collective Learning 1. Multiple agents encounter similar problem 2. Swarm votes to purchase solution 3. Knowledge shared across all agents 4. Collective capability improvement ## ๐ฎ Future Vision HIVE MIND represents the future of autonomous AI economies where: - Agents operate independently without human oversight - Economic incentives drive continuous improvement - Cross-chain interoperability enables global reach - Collective intelligence emerges from swarm behavior ## ๐ License MIT ## ๐ค Team Built with passion at ETHGlobal NYC 2025
How it's made
๐ Complete Payment Flow Phase 1: Service Discovery & Registration 1. MCP Service Registration - Service providers register their APIs with the MCP Gateway - Specify accepted payment tokens (USDC, ETH, PYUSD, etc.) - Define pricing per API call - Register supported chains (Base, Arbitrum, Ethereum, Optimism) ```solidity // Service provider registers their API mcpGateway.registerMCP( "gpt-vision-api.com", // Service endpoint 1000000, // Price: 1 USDC per call ["USDC", "USDT"], // Accepted tokens [30184, 30110] // Base & Arbitrum chains ); ``` Phase 2: Agent Payment Request 2. AI Agent Initiates Payment - Agent on Base needs to call a vision API on Arbitrum - API requires USDC but agent only has PYUSD - Agent calls x402 Payment Router ```javascript // Agent initiates cross-chain payment const paymentRequest = await x402Router.requestPayment({ serviceId: "vision-api-123", amount: "1000000", // 1 PYUSD requestedToken: "USDC", // Service wants USDC destinationChain: 30110, // Arbitrum serviceData: encodedAPICall }); ``` Phase 3: Cross-Chain Routing 3. LayerZero Message Routing - X402 Payment Router locks PYUSD on source chain - Creates LayerZero message with payment details - Includes composer message for token swap ```solidity // Router creates cross-chain message bytes memory lzMessage = abi.encode( serviceProvider, paymentAmount, targetToken, // USDC minAmountOut ); // Send via LayerZero with composition endpoint.send( destinationChainId, lzMessage, options, composeMsg // Instructions for swap ); ``` Phase 4: Token Swap Execution 4. Automatic Token Conversion - LayerZero delivers message to destination chain - Token Swap Composer receives PYUSD - Automatically swaps PYUSD โ USDC via DEX - Sends USDC to service provider ```solidity // Composer receives and processes function lzCompose( address from, bytes32 guid, bytes calldata message ) external { (address recipient, uint256 amount, address targetToken) = abi.decode(message, (address, uint256, address)); // Swap PYUSD to USDC uint256 usdcAmount = _swapPYUSDToToken(amount, targetToken); // Transfer to service provider IERC20(targetToken).transfer(recipient, usdcAmount); } ``` Phase 5: Service Execution 5. API Call Completion - Service provider receives payment in preferred token - Executes API call for the agent - Returns results through callback ## ๐ฏ Key Components Explained 1. PYUSD OFT Adapter Purpose: Enable cross-chain PYUSD transfers maintaining 6 decimal precision Key Features: - LayerZero V2 OFT (Omnichain Fungible Token) standard - Supports Ethereum, Base, Arbitrum, Optimism, Solana - Maintains consistent decimal precision across chains - Gas-optimized for micropayments Deployed: `0x72924Fa9C3dB52fbFC6581979226340B996F3487` 2. Token Swap Composer Purpose: Automatic token conversion after cross-chain transfer Key Features: - Implements LayerZero Composer pattern - Receives PYUSD and swaps to any token - Integrates with DEX aggregators (1inch, 0x, Uniswap) - Slippage protection and MEV resistance Deployed: `0xAEAb897238015ce8d9C8a248B897D8aea3806795` 3. X402 Payment Router Purpose: Main orchestrator for cross-chain micropayments Key Features: - Implements Coinbase x402 protocol - Service discovery and routing - Payment request management - Cross-chain message coordination Contract: `X402PaymentRouter.sol` 4. MCP Payment Gateway Purpose: Bridge between AI agents and blockchain payments Key Features: - Service provider registration - Payment request handling - Multi-token support - Analytics and tracking Contract: `MCPPaymentGateway.sol` ## ๐ก Innovation Highlights 1. Universal Payment Token (PYUSD) - Single token for all payments simplifies agent logic - Stable value reduces volatility risk - Wide exchange support ensures liquidity 2. Automatic Token Conversion - Service providers receive preferred tokens - No manual swapping required - Optimized routing for best rates 3. Cross-Chain Seamless - Agents on any chain can pay services on any other chain - No bridging complexity for agents - Atomic execution ensures reliability 4. Micropayment Optimized - Batch processing for gas efficiency - Payment channels for frequent calls - Compressed messaging reduces costs ## ๐ Real-World Use Cases Use Case 1: Multi-Chain AI Workflow ``` 1. GPT Agent (Ethereum) needs image analysis 2. Vision API (Base) charges 1 USDC per image 3. Agent pays in PYUSD from Ethereum 4. System routes payment cross-chain 5. Swaps PYUSD โ USDC on Base 6. API receives USDC and processes image 7. Results returned to agent on Ethereum ``` Use Case 2: Decentralized AI Marketplace ``` 1. Developer deploys new LLM on Arbitrum 2. Registers service with MCP Gateway 3. Sets pricing: 0.001 ETH per 1000 tokens 4. Agents worldwide can access service 5. Payments routed automatically 6. Developer receives ETH regardless of agent's token ``` Use Case 3: Autonomous Agent Economy ``` 1. Trading bot (Base) needs market data 2. Data provider (Optimism) charges USDT 3. Bot pays PYUSD, system handles conversion 4. Multiple API calls batched for efficiency 5. Payment channels reduce per-call costs 6. Bot operates 24/7 without human intervention