Files
B.Tech-Project-III/dmtp/README.md
2026-04-05 00:43:23 +05:30

11 KiB
Raw Blame History

🪙 D.M.T.P — Agentic AI-Verified Micro-Task Platform on Celo Blockchain

An AI-powered decentralized task Platform built on Celo Sepolia Testnet, where requesters post micro-tasks, workers complete them, AI verifies the results, and payments are automatically released in cUSD upon approval.


📋 Table of Contents


Overview

D.M.T.P introduces verifiable trust between micro-task requesters and workers. AI moderation (powered by Google Gemini) ensures submissions are authentic and high-quality, while the TaskEscrow smart contract on Celo guarantees transparent, secure on-chain payments.

Key Features

  • 🤖 AI-Powered Verification — Automated content moderation using Google Gemini
  • ⛓️ Blockchain Escrow — Smart contract-based payment security
  • 💰 Instant Payments — Automatic cUSD release upon task approval
  • 🔐 Wallet Authentication — Secure login via MetaMask or MiniPay
  • 📊 Real-Time Updates — Live task and submission status tracking
  • 🎯 Quality Control — AI prevents spam, fraud, and low-effort submissions

🛠️ Tech Stack

🖥️ Frontend — Next.js (App Router)

Feature Library/Framework
UI Components shadcn/ui
Styling TailwindCSS
State Management Zustand
Data Fetching TanStack Query
Wallet Integration wagmi + viem
Blockchain SDK @celo/contractkit
Wallets Supported MiniPay and MetaMask
AI Moderation Google Gemini 1.5

⚙️ Backend — Express.js + TypeScript

Feature Technology
Framework Express.js
Database PostgreSQL + Prisma ORM
Job Queue Bull + Redis
AI Verification Gemini API
Blockchain Celo Sepolia
Authentication Wallet Signature (EIP-191)
File Verification cUSD Escrow via TaskEscrow.sol
Notifications Background service + WebSocket placeholder

⛓️ Blockchain — Celo Sepolia Testnet


🤖 AI Integration (Google Gemini 2.5 Pro)

Used for:

  • Spam, fraud, and duplicate prevention
  • Toxic or low-effort content rejection
  • Criteria-based submission scoring

Gemini runs asynchronously in a Bull Queue worker, sending results via webhook to approve or reject submissions.


🗄️ Database Schema (Core Entities)

Table Description
users Stores wallet addresses, roles (requester / worker), reputation & earnings
tasks Contains task metadata, blockchain taskID, payment amount, expiry
submissions Tracks worker submissions, AI verification results
payments Logs payment releases (+txHash)
notifications In-app notifications for verification or payment updates

💎 Folder Structure

D.M.T.P/
├── client/                 # Next.js frontend
│   ├── app/               # App Router pages
│   ├── components/        # shadcn + custom UI
│   ├── hooks/             # Zustand + wagmi hooks
│   ├── lib/               # API client + Celo utils
│   └── types/             # Shared TypeScript models
│
└── server/                # Express backend
    ├── src/
    │   ├── routes/        # /api/v1 tasks, submissions, users
    │   ├── controllers/   # Request handlers
    │   ├── services/      # AI, blockchain, queue, moderation
    │   ├── workers/       # Bull verification worker
    │   └── database/      # Prisma schema + migrations
    └── prisma/

⚙️ Setup Guide

Prerequisites

  • Node.js >= 20
  • npm >= 9
  • Redis (running locally or hosted)
  • PostgreSQL database
  • Celo wallet with test cUSD

1 Environment Variables

.env (Backend)

# Server
PORT=3001
NODE_ENV=development

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/D.M.T.P"

# Blockchain
PRIVATE_KEY=YOUR_PRIVATE_KEY_WITH_CUSD
CELO_RPC_URL=https://forno.celo-sepolia.celo-testnet.org
CONTRACT_ADDRESS=0xYourTaskEscrowAddress
CUSD_SEPOLIA_ADDRESS=0x874069fa1eb16d44d622f2e0ca25eea172369bc1

# AI (Gemini)
GEMINI_API_KEY=your_google_gemini_api_key

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379

.env.local (Frontend)

NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_CELO_RPC_URL=https://forno.celo-sepolia.celo-testnet.org
NEXT_PUBLIC_CUSD_ADDRESS=0x874069fa1eb16d44d622f2e0ca25eea172369bc1
NEXT_PUBLIC_CONTRACT_ADDRESS=0xYourTaskEscrowAddress
NEXT_PUBLIC_CHAIN_ID=44787

2 Backend Setup

cd server
npm install

# Prisma setup + migrate
npx prisma generate
npx prisma db push

# Start Redis (using Docker)
docker run -d -p 6379:6379 redis:alpine

# Start backend in dev mode
npm run dev

3 Frontend Setup

cd client
npm install
npm run dev

Visit → http://localhost:3000


💰 Smart Contract Deployment

Our Deployed Smart Contract- 0xa520d207c91C0FE0e9cFe8D63AbE02fd18B2254e

Deploy TaskEscrow.sol on Celo Sepolia using Remix or Hardhat.

Compile & Deploy

npx hardhat run scripts/deploy.ts --network celo-sepolia

Verify Contract

npx hardhat verify --network celo-sepolia 0xYourContractAddress "0x874069fa1eb16d44d622f2e0ca25eea172369bc1"

🧠 Workflow

✳️ Requester Flow

  1. Connect wallet → Create Task
  2. Payment locked in smart contract
  3. Task visible to workers

🛠️ Worker Flow

  1. Accept Task → Submit Response
  2. Gemini AI verifies content
  3. If approved → Payment auto-released (cUSD)
  4. If rejected → Refund to requester

🧾 Example API Calls

Create Task

POST /api/v1/tasks/create
Content-Type: application/json

{
  "title": "Label Images",
  "description": "Tag each image with emotion category",
  "paymentAmount": 3.5,
  "expiresAt": "2025-11-10T12:00:00Z"
}

Submit Task

POST /api/v1/submissions/submit
Content-Type: application/json

{
  "taskId": "uuid",
  "submissionData": {
    "imageUrls": ["https://ipfs.tech/image1.png"],
    "metadata": { "label": "happy" }
  }
}

AI Queue → Gemini Verification → Payment Released


🧱 Architecture Diagram

┌────────────┐
│  Next.js   │────┐
└────────────┘    │
                  ▼
┌───────────┐  ┌──────────────┐
│Express.js │◄─│ PostgreSQL   │
└───────────┘  └──────────────┘
      │
┌─────┼──────┐
▼     ▼      ▼
Gemini   Redis   Celo
AI      /Bull    Network
(Verify) (Queue) (Escrow)

Features Checklist

  • Wallet Signature Login (EIP-191)
  • Gemini-based Content Moderation
  • Blockchain-Backed Escrow Payments
  • Task + Submission CRUD
  • Bull Queue Worker Verification
  • Real-Time Status Updates
  • cUSD Balance Tracking
  • Transaction Confirmation + CeloScan Link
  • Admin + Requester Dashboard
  • Fully Responsive UI

🧪 Testing

# Run backend tests
cd server
npm run test

# Database Studio
npx prisma studio

# Queue dashboard
npm run bull:dashboard

🌍 Deployment

Suggested Setup

Layer Platform Notes
Frontend Vercel Auto-deploy from main
Backend Railway / Render Node + Postgres service
Database Neon / Supabase Free Postgres DB
Redis Upstash / Redis Cloud Connection for Bull jobs

🧠 Future Roadmap

  • 🪄 On-chain Gemini verification proofs
  • 🧩 Decentralized task reputation scoring
  • 💬 Worker messaging + chat
  • 🪶 File uploads to IPFS / Web3.Storage
  • ⚙️ Multi-network support (Base, Polygon)

🪙 Credits

Developed with 💚 on the Celo blockchain.

Built using Next.js, Celo ContractKit, Gemini AI, and Prisma.


📝 License

This project is licensed under the MIT License — feel free to fork and extend 💡


👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📧 Contact

For questions or support, please open an issue on GitHub.


Made with ❤️ for the Celo ecosystem