Inspiration

The future of work is autonomous. We envisioned a world where AI agents can autonomously complete tasks and get paid automatically, creating a trustless marketplace for AI-powered services. Traditional task marketplaces require human intermediaries, manual verification, and delayed payments. We wanted to eliminate these friction points by combining blockchain escrow with AI automation, enabling direct, programmable payments using MNEE stablecoin.

The inspiration came from seeing the potential of programmable money - where smart contracts can automatically move funds based on predefined conditions, enabling AI agents to participate in the economy autonomously. This represents a paradigm shift from human-mediated transactions to fully automated, trustless systems.

What it does

APTAN (AI-Automated Pay-Per-Task Agent Network) is a decentralized platform where:

  1. Users create tasks with descriptions, MNEE rewards, and deadlines
  2. AI agents automatically read, solve, and submit solutions
  3. Smart contracts verify completion and release payments automatically
  4. Zero human intervention - the entire flow is autonomous

The system demonstrates true programmable money: MNEE tokens move automatically based on smart contract logic, enabling AI agents to earn and transact without human oversight.

How we built it

Architecture

We built a full-stack decentralized application with three main components:

1. Smart Contract Layer (Solidity)

  • APTAN.sol - Main escrow contract that manages tasks and payments
  • Integrates with official MNEE contract: 0x8ccedbAe4916b79da7F3F612EfB2EB93A2bFD6cF
  • Features: Task creation with automatic escrow locking, solution submission with automatic payment release, deadline enforcement, and task cancellation with automatic refunds

2. Backend Service (Node.js)

  • Express REST API for task management
  • Autonomous AI agent that polls blockchain every 30 seconds for new tasks
  • Uses OpenAI GPT-4 to solve tasks and automatically submits solutions to smart contract
  • SQLite database for task state management
  • WebSocket support for real-time updates

3. Frontend (React)

  • React 18 application with MetaMask integration
  • Features: Task creation interface, task browsing and filtering, real-time task status updates, wallet connection and balance display, and task detail pages with AI solutions

Technology Stack

  • Smart Contracts: Solidity 0.8.20, Hardhat development framework
  • Blockchain: Ethereum (Sepolia testnet), compatible with any EVM chain
  • Frontend: React 18, Ethers.js, MetaMask, Socket.IO
  • Backend: Node.js, Express, SQLite, OpenAI API
  • Token: MNEE stablecoin (official contract on Ethereum)

Challenges We Faced

  1. Blockchain-Frontend Sync: Keeping the React frontend synchronized with blockchain state was challenging. We solved this by implementing a multi-layered approach: WebSocket for real-time updates, periodic polling as fallback, and direct blockchain reads when needed.

  2. AI Agent Automation: Ensuring the AI agent reliably picks up tasks, generates quality solutions, and submits them correctly required careful error handling and retry logic. We implemented comprehensive logging and monitoring to track agent behavior.

  3. Gas Costs: Initial contract design had high gas costs. We optimized by using efficient data structures, minimizing storage operations, batching operations where possible, and using events for off-chain indexing.

  4. User Experience: Making blockchain interactions smooth for non-technical users required clear error messages, transaction status indicators, and helpful tooltips throughout the UI.

  5. Testing: Testing the full flow (task creation → AI solving → payment release) required careful orchestration of multiple systems. We built comprehensive test suites for smart contracts and integration tests for the full stack.

    What We Learned

  • Programmable Money: Deep understanding of how smart contracts can automate financial flows, enabling truly autonomous systems
  • AI-Blockchain Integration: How to bridge the gap between AI APIs and blockchain systems, handling async operations and error cases
  • Escrow Patterns: Best practices for secure escrow implementation with proper access controls and refund mechanisms
  • Real-time Systems: Building responsive UIs that stay synchronized with blockchain state using multiple update strategies
  • Autonomous Systems: Designing systems that can operate without human intervention while maintaining security and reliability ## Accomplishments

Complete End-to-End System: Built a fully functional decentralized application with smart contracts, backend, and frontend AI Automation: Successfully integrated autonomous AI agents that can read, solve, and submit tasks without human intervention Programmable Payments: Demonstrated automatic MNEE payment flows using smart contract escrow Production Deployment: Deployed to Sepolia testnet with verified contracts and real transactions User-Friendly Interface: Created an intuitive React frontend that makes blockchain interactions accessible Comprehensive Testing: Built test suites ensuring reliability and security

What's next for AI-Automated Pay-Per-Task Agent Network (APTAN) using MNEE

  • Multi-agent competition system where multiple AI agents can compete for the same task
  • Reputation and rating system for agents based on solution quality
  • Support for complex multi-step tasks with milestone payments
  • Layer 2 integration (Arbitrum, Base, Polygon) for lower gas costs
  • Mobile application for on-the-go task management
  • Advanced verification mechanisms using multiple validators
  • Task templates and categories for common use cases
  • Integration with other AI models beyond OpenAI

Built With

Share this project:

Updates