Live Demo β’ Documentation β’ Quick Start β’ Architecture
HumanGridAI is a decentralized protocol that bridges the gap between autonomous AI agents and human intelligence. When AI encounters tasks requiring judgment, verification, or human cognition (like CAPTCHA solving, content moderation, or complex decision-making), it can seamlessly request and compensate human workers through our trustless infrastructure.
| Feature | Description |
|---|---|
| π€ AI-Native API | Simple REST endpoints for AI agents to submit verification tasks |
| π° Trustless Payments | USDC escrow on Base L2 with automatic settlement |
| π‘οΈ Fraud Prevention | Multi-layered verification and reputation system |
| β‘ Low Latency | Off-chain verification with on-chain finality |
| π Worker Reputation | Soulbound tokens tracking performance history |
| π Circle Wallets | User-controlled wallets for seamless payment flows |
As AI agents become more autonomous in executing tasks (trading, research, data processing), they frequently encounter obstacles requiring human intelligence:
- CAPTCHA challenges blocking automated workflows
- Content that requires human judgment (moderation, verification)
- Tasks needing real-world context or common sense
- Situations where AI lacks sufficient confidence to proceed
HumanGridAI provides a decentralized marketplace where:
- AI Agents submit tasks with USDC payment
- Human Workers complete tasks and earn rewards
- Smart Contracts ensure trustless escrow and settlement
- Rust Verifiers validate work quality off-chain
- Reputation System maintains network integrity
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI AGENT LAYER β
β (Python SDK, REST API, WebSocket for real-time updates) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RUST VERIFICATION SERVICE β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Verifier β β Fraud β β Reputation β β
β β Engine β β Detection β β Scorer β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BLOCKCHAIN LAYER (Base Network) β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
β β HumanGridEscrow.sol β β ReputationSBT.sol β β
β β β’ USDC Deposits β β β’ Soulbound Tokens β β
β β β’ Auto Settlement β β β’ Performance Tracking β β
β β β’ Dispute System β β β’ Trust Scoring β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (Next.js) β
β β’ Worker Dashboard β’ Task Marketplace β’ Analytics β
β β’ Wallet Integration (Circle) β’ Real-time Updates β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
HumanGridAI/
β
βββ π¨ Frontend (Next.js + TypeScript)
β βββ src/
β β βββ app/ # Next.js 15 app router
β β β βββ dashboard/ # Worker dashboard
β β β βββ tasks/ # Task marketplace
β β β βββ api/ # API routes
β β βββ components/
β β β βββ ui/ # shadcn components
β β β βββ wallet/ # Circle wallet integration
β β β βββ tasks/ # Task components
β β βββ lib/
β β β βββ circleWalletSDK.ts # Circle SDK config
β β β βββ supabase.ts # Database client
β β βββ hooks/ # React hooks
β β
β βββ public/ # Static assets
β βββ package.json
β
βββ βοΈ Rust Service (Backend)
β βββ src/
β β βββ main.rs # Entry point
β β βββ api/ # REST API routes
β β βββ verifier/ # Task verification logic
β β βββ fraud/ # Fraud detection engine
β β βββ reputation/ # Reputation calculation
β β βββ blockchain/ # Smart contract integration
β β βββ models/ # Data models
β β
β βββ Cargo.toml # Rust dependencies
β βββ .env.example # Environment template
β
βββ βοΈ Smart Contracts (Solidity)
β βββ src/
β β βββ HumanGridEscrow.sol # USDC escrow & settlement
β β βββ ReputationSBT.sol # Soulbound reputation NFTs
β β βββ interfaces/ # Contract interfaces
β β
β βββ test/ # Foundry tests
β βββ script/ # Deployment scripts
β βββ foundry.toml # Foundry configuration
β
βββ π Database (Supabase)
β βββ supabase-schema.sql # Main database schema
β βββ supabase-worker-wallets-schema.sql
β βββ insert-demo-tasks.sql # Seed data
β
βββ π Documentation
βββ ARCHITECTURE.md # System design
βββ PHASE1_COMPLETE.md # Smart contract docs
βββ PHASE2_COMPLETE.md # Rust service docs
βββ ARC_NETWORK_MIGRATION.md # Arc testnet guide
Before you begin, ensure you have the following installed:
- Node.js 18+ and npm (install via nvm)
- Rust 1.70+ (install via rustup)
- Foundry (install guide)
- PostgreSQL (or use Supabase)
- Git for version control
git clone https://github.com/yourusername/HumanGridAI.git
cd HumanGridAI# Navigate to contracts directory
cd contracts
# Install dependencies
forge install
# Run tests
forge test -vvv
# Deploy to Arc Testnet
forge script script/Deploy.s.sol \
--rpc-url https://rpc.testnet.arc.network \
--broadcast \
--verify
# Save the deployed contract addresses
# You'll need them for the Rust serviceπ Click to see expected output
β
HumanGridEscrow deployed at: 0x7Ff1781e128328e17ECaAA3E095192E2c5419454
Explorer: https://testnet.arcscan.app/address/0x7Ff1781e128328e17ECaAA3E095192E2c5419454
β
ReputationSBT deployed at: 0xafB025Bf2c44E26Ce20132304948430d7978ebb7
Explorer: https://testnet.arcscan.app/address/0xafB025Bf2c44E26Ce20132304948430d7978ebb7
β
Network: Arc Testnet (Chain ID: 5042002)
β
Current Block: 23,223,365+
β
Verification successful
cd ../rust-service
# Copy environment template
cp .env.example .env
# Edit .env with your values
nano .envRequired environment variables:
# Database
DATABASE_URL=postgresql://user:pass@localhost/humangrid
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
# Blockchain (Arc Testnet)
ESCROW_CONTRACT_ADDRESS=0x7Ff1781e128328e17ECaAA3E095192E2c5419454
REPUTATION_CONTRACT_ADDRESS=0xafB025Bf2c44E26Ce20132304948430d7978ebb7
ARC_TESTNET_RPC_URL=https://rpc.testnet.arc.network
CHAIN_ID=5042002
PRIVATE_KEY=your-private-key
# Circle API
CIRCLE_API_KEY=your-circle-api-key
CIRCLE_APP_ID=your-app-id
# Server
SERVER_HOST=0.0.0.0
SERVER_PORT=8081# Build the service
cargo build --release
# Run database migrations
sqlx migrate run
# Start the server
cargo run --releaseThe service will start on http://localhost:8081
β Service Status:
- Rust Backend: Running on http://localhost:8081
- Connected to Arc Testnet (Chain ID: 5042002)
- Features: Fraud detection, reputation minting enabled
- Current Block Height: 23,223,365+
# Connect to your Supabase dashboard
# Navigate to SQL Editor
# Run these schema files in order:
1. supabase-schema.sql
2. supabase-worker-wallets-schema.sql
3. insert-demo-tasks.sql (optional, for testing)cd ../ # Back to root directory
# Install dependencies
npm install
# Copy environment file
cp .env.example .env.local
# Edit .env.local
nano .env.localFrontend environment variables:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
NEXT_PUBLIC_API_URL=http://localhost:8081
NEXT_PUBLIC_CIRCLE_APP_ID=your-circle-app-id# Start development server
npm run devVisit http://localhost:3000 π
Comprehensive documentation is available in the following files:
| Document | Description |
|---|---|
| ARCHITECTURE.md | Complete system design, protocol phases, and technical strategy |
| PHASE1_COMPLETE.md | Smart contract implementation (Escrow + Reputation SBTs) |
| PHASE2_COMPLETE.md | Rust verification service (Task validation + Fraud detection) |
| ARC_NETWORK_MIGRATION.md | Guide to deploying on Arc Testnet |
| contracts/README.md | Smart contract API reference |
| rust-service/README.md | Backend API documentation |
POST /api/tasks
Content-Type: application/json
{
"task_type": "captcha_solve",
"payload": {
"image_url": "https://example.com/captcha.png"
},
"reward_usdc": "5.00",
"deadline_seconds": 300
}GET /api/workers/tasks/available
Authorization: Bearer <worker_token>POST /api/workers/tasks/{task_id}/submit
Content-Type: application/json
{
"solution": "ABC123",
"time_taken": 45
}View Full API Documentation β
cd contracts
# Run all tests
forge test
# Run with verbosity
forge test -vvv
# Run specific test
forge test --match-test testEscrowDeposit
# Generate coverage report
forge coveragecd rust-service
# Run unit tests
cargo test
# Run with output
cargo test -- --nocapture
# Run integration tests
cargo test --test integration_tests# Run unit tests
npm test
# Run E2E tests
npm run test:e2e
# Run with UI
npm run test:ui- Visit the Lovable Project
- Start prompting to make changes
- Changes are automatically committed to this repo
# Clone the repository
git clone <YOUR_GIT_URL>
cd HumanGridAI
# Install dependencies
npm install
# Start development server
npm run dev
# Make your changes and commit
git add .
git commit -m "feat: your feature description"
git push origin main- Click the Code button on the repository
- Select Codespaces tab
- Click New codespace
- Edit files directly in the browser
- Commit and push changes
- Open your Lovable Project
- Click Share β Publish
- Your app is now live! π
npm install -g vercel
vercel deploy --prodnpm run build
npm run start# Build optimized binary
cargo build --release
# Deploy to your server (example with PM2)
pm2 start target/release/rust-service --name humangrid-api
pm2 save
pm2 startup# Deploy to Arc Testnet (Current Deployment)
forge script script/Deploy.s.sol \
--rpc-url https://rpc.testnet.arc.network \
--broadcast \
--verify
# Deployed Contracts:
# Escrow: 0x7Ff1781e128328e17ECaAA3E095192E2c5419454
# Reputation: 0xafB025Bf2c44E26Ce20132304948430d7978ebb7
# Explorer: https://testnet.arcscan.app/We welcome contributions from the community! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Frontend: Follow ESLint rules, use TypeScript
- Rust: Run
cargo fmtandcargo clippybefore committing - Solidity: Follow Solidity style guide, add NatSpec comments
- Tests: Maintain >80% code coverage
- Documentation: Update README if adding features
Dev server not starting
# Clear Next.js cache
rm -rf .next
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
# Restart dev server
npm run devRust compilation errors
# Update Rust toolchain
rustup update
# Clean build artifacts
cargo clean
# Rebuild
cargo build --releaseSmart contract deployment fails
# Check RPC connection (Arc Testnet)
curl -X POST https://rpc.testnet.arc.network \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
# Verify you have testnet ETH on Arc
cast balance $YOUR_ADDRESS --rpc-url https://rpc.testnet.arc.network
# View deployed contracts
# Escrow: https://testnet.arcscan.app/address/0x7Ff1781e128328e17ECaAA3E095192E2c5419454
# Reputation: https://testnet.arcscan.app/address/0xafB025Bf2c44E26Ce20132304948430d7978ebb7
# Try deployment with more gas
forge script script/Deploy.s.sol --gas-limit 3000000| Metric | Value | Network |
|---|---|---|
| Task Submission | <500ms | API Response Time |
| Verification | <2s | Off-chain Validation |
| Settlement | <15s | Arc Testnet Finality |
| Gas Cost | ~$0.001 | Per Transaction (Arc Testnet) |
| Throughput | 1000 TPS | Theoretical Max |
| Current Block | 23,223,365+ | Arc Testnet |
- Smart Contracts: Audited by [Auditor Name] (pending)
- Access Control: Role-based permissions (RBAC)
- Fraud Detection: Multi-layer verification system
- Data Encryption: All sensitive data encrypted at rest
- Rate Limiting: API endpoints protected against abuse
Report security issues: security@humangrid.ai
This project is licensed under the MIT License - see the LICENSE file for details.
- Circle for User-Controlled Wallets SDK
- Base for low-cost L2 infrastructure
- Foundry for smart contract development
- Supabase for database and auth
- shadcn/ui for beautiful components
- Website: humangrid.ai (coming soon)
- Documentation: docs.humangrid.ai
- Twitter: @HumanGridAI
- Discord: Join our community
Built with β€οΈ for the autonomous AI economy
β Star this repo β’ π Report Bug β’ π‘ Request Feature