hackquest logo

Chainweave

ChainWeave AI: AI-powered NFT platform with gasless minting via MetaMask Delegation on Monad & Sepolia. Built for MetaMask x Monad x Envio Hackathon.

Videos

Description

# ChainWeave AI - AI-Powered NFT Platform with Gasless Minting

## Overview

ChainWeave AI is a revolutionary Web3 platform that enables users to create and mint AI-generated NFTs with zero gas fees. By combining cutting-edge AI technology with MetaMask Delegation Framework (ERC-7710), users can transform text prompts into unique NFTs minted directly on-chain without paying transaction fees.

## What It Does

ChainWeave AI solves three major problems in the NFT space:

1. **High Barrier to Entry**: Traditional NFT creation requires technical knowledge, crypto for gas fees, and multiple complex steps. ChainWeave AI offers one-click wallet connection, simple AI prompts, and zero gas fees through MetaMask Delegation.

2. **Expensive AI NFT Creation**: Users typically pay separately for AI generation, IPFS storage, and blockchain minting. ChainWeave AI integrates everything - free AI generation (OpenAI DALL-E & Google Gemini), automatic IPFS storage via Pinata, and gasless on-chain minting.

3. **Poor NFT Data Access**: Traditional platforms rely on slow RPC queries with no real-time updates. ChainWeave AI uses Envio indexer for instant blockchain data synchronization and efficient GraphQL queries.

## Key Features

### 🎨 AI-Powered NFT Generation
- **Dual AI Models**: Google Gemini (primary) and OpenAI DALL-E (fallback) for high-quality image generation
- **6 Art Styles**: Realistic, Anime, Digital Art, Painting, Sketch, and 3D Render
- **Smart Prompt Enhancement**: Automatically optimizes user prompts for better results
- **IPFS Storage**: Decentralized storage for images and metadata via Pinata

### ⚑ Gasless Minting via MetaMask Delegation (ERC-7710)
- **Zero Gas Fees**: Users mint NFTs without paying transaction costs
- **One-Time Setup**: Sign delegation once, mint unlimited NFTs
- **Fully On-Chain**: Real transaction hashes verifiable on blockchain explorers
- **Smart Account Integration**: ERC-4337 powered by Privy SDK

### πŸ”— Cross-Chain Support
- **Monad Testnet** (Chain ID: 10143) - Primary deployment
- **Ethereum Sepolia** (Chain ID: 11155111) - Secondary deployment
- Identical contracts deployed on both chains for unified experience

### πŸ“Š Real-Time Blockchain Indexing (Envio)
- **Instant Sync**: Events indexed within seconds of on-chain confirmation
- **GraphQL API**: Efficient querying for NFT data, user stats, and platform metrics
- **Multi-Chain**: Unified view of NFTs across Monad and Sepolia
- **Type-Safe**: Auto-generated TypeScript types for frontend integration

## How It Works

### User Flow (2-Minute Experience)

1. **Connect Wallet** β†’ One-click authentication via Privy (MetaMask, Email, or Social)
2. **Setup Delegation** β†’ Sign once to enable gasless transactions
3. **Generate NFT** β†’ Enter a text prompt (e.g., "epic dragon in cyberpunk city"), select art style
4. **AI Creates Image** β†’ Gemini/DALL-E generates artwork in ~5 seconds
5. **Preview & Mint** β†’ Review image, click "Mint NFT" (gasless toggle ON by default)
6. **On-Chain Confirmation** β†’ NFT minted with zero gas fees, receive transaction hash
7. **View & Verify** β†’ See NFT in collection, verify on Monad/Sepolia explorer

### Technical Architecture

**Frontend (Next.js 14 + TypeScript)**
- Modern React with App Router
- Privy SDK for wallet authentication
- Smart account management for gasless transactions
- Apollo Client for GraphQL queries (Envio)
- Tailwind CSS + Radix UI for responsive design

**Backend (Express.js + TypeScript)**
- RESTful API for AI generation and NFT requests
- Google Gemini & OpenAI integration
- Pinata IPFS uploads for decentralized storage
- MongoDB for NFT request tracking
- Ethers.js v6 for blockchain interactions

**Smart Contracts (Solidity 0.8.26)**
- ERC-721 compliant NFT contract
- Gasless-friendly (no auth logic, delegation compatible)
- Deployed identically on Monad Testnet and Ethereum Sepolia
- Custom errors for gas optimization
- Comprehensive events for indexing

**Envio Indexer**
- Real-time event processing (NFTMinted, Transfer, Burned)
- PostgreSQL database with Hasura GraphQL API
- Multi-chain support (Monad + Sepolia)
- User statistics and platform analytics

## Technical Highlights

### MetaMask Delegation Integration
ChainWeave AI leverages ERC-7710 (MetaMask Delegation Framework) to enable truly gasless transactions:
- Users grant delegation permissions to a smart account (ERC-4337)
- Smart account executes transactions via bundler + paymaster
- Users pay $0 in gas fees while maintaining full on-chain verification
- All NFT mints are permanent on-chain records with real transaction hashes

### AI Generation Pipeline

User Prompt β†’ Prompt Enhancement β†’ Gemini API (primary) β†’ [Fallback: DALL-E] β†’ Image URL β†’ IPFS Upload (Pinata) β†’ Metadata JSON β†’ IPFS Upload β†’ Token URI β†’ Ready for Minting


### Gasless Minting Flow

User Click "Mint" β†’ Smart Account prepares transaction β†’ Bundler batches operation β†’ Paymaster sponsors gas β†’ On-chain execution β†’ Transaction confirmed β†’ NFT minted (user pays $0)


### Real-Time Indexing Flow

Blockchain emits NFTMinted event β†’ Envio listener captures β†’ Event handler processes β†’ PostgreSQL updated β†’ Hasura GraphQL serves data β†’ Frontend queries β†’ UI updates in real-time


## Innovation & Impact

### First-of-Its-Kind Features
1. **First AI NFT platform with MetaMask Delegation**: Zero-gas NFT minting is typically not possible without centralized solutions. ChainWeave AI proves it's achievable with ERC-7710.

2. **Production-ready Monad integration**: One of the first platforms demonstrating real NFT use cases on Monad Testnet with full explorer verification.

3. **Unified cross-chain indexing**: Envio powers a seamless multi-chain experience where users see NFTs from Monad and Sepolia in one interface.

### User Impact
- **Accessibility**: Anyone can create NFTs without crypto expertise or upfront costs
- **Speed**: 2-minute end-to-end flow from prompt to on-chain NFT
- **Cost**: $0 gas fees vs. $5-50 on traditional platforms
- **Quality**: Professional AI-generated artwork (Gemini 1.5 Flash / DALL-E 3)

### Technical Excellence
- **Scalability**: Auto-scaling infrastructure (Vercel Edge + GCP Cloud Run)
- **Security**: Multi-layer security (JWT auth, rate limiting, input validation, smart contract audits)
- **Documentation**: 220KB of comprehensive technical documentation with 25+ diagrams
- **Code Quality**: TypeScript throughout, well-structured architecture, production best practices

## Tech Stack

- **Frontend**: Next.js 14, React 18, TypeScript, Tailwind CSS, Ethers.js v6, Privy SDK
- **Backend**: Node.js 20, Express.js, TypeScript, MongoDB, Mongoose, JWT
- **Smart Contracts**: Solidity 0.8.26, Hardhat, OpenZeppelin, ERC-721/4337/7710
- **Indexer**: Envio, PostgreSQL, Hasura GraphQL, TypeScript
- **AI**: Google Gemini 1.5 Flash, OpenAI DALL-E 3
- **Storage**: Pinata IPFS, MongoDB Atlas
- **Deployment**: Vercel (frontend), GCP Cloud Run (backend), Monad/Sepolia (contracts)

## Hackathon Categories

### Best Use of MetaMask Delegation
ChainWeave AI demonstrates the full potential of ERC-7710:
- Seamless gasless minting with real on-chain verification
- One-time delegation setup for unlimited transactions
- Integration with ERC-4337 smart accounts via Privy
- Production-ready implementation with clear user benefits

### Best Use of Monad
ChainWeave AI showcases Monad Testnet capabilities:
- NFT contract deployed and verified on Monad Explorer
- Real transaction hashes viewable at explorer.testnet.monad.xyz
- Cross-chain architecture supporting both Monad and Ethereum
- Production infrastructure ready for Monad mainnet

### Best Use of Envio Indexer
ChainWeave AI leverages Envio for superior UX:
- Real-time NFT minting event indexing across Monad and Sepolia
- GraphQL API for efficient frontend queries
- User statistics and platform analytics
- Type-safe event handlers with auto-generated TypeScript types

## Links

- **GitHub**: https://github.com/BenStacks/chainweave_v2
(220KB, 8 files)
- **Live Demo**: [Coming after deployment]
- **Smart Contracts**: 
  - Monad Testnet: 0x8D845bAb6cCaE67f0F60453e4e736d48D925f167
  - Sepolia: 0xBc0E4fAdcfD447D084C2EC66D5265d7F714eDdCE

Progress During Hackathon

{ "network": "ethereum_sepolia", "chainId": 11155111, "contractAddress": "0xBc0E4fAdcfD447D084C2EC66D5265d7F714eDdCE", "deployer": "0xAeF7B1596cD0a4Ec7f0D12E0ba440AdF2c2AE32f", "deploymentTime": "2025-10-19T13:08:38.761Z", "transactionHash": "0xd70f1141034afd0b25e24f0f84574ca20d1efea7b9a6fb0933ed2febad95d47b", "blockNumber": null, "name": "ChainWeave AI NFT", "symbol": "CWAI", "mintFee": "0" } { "network": "monad_testnet", "chainId": 10143, "contractAddress": "0x8D845bAb6cCaE67f0F60453e4e736d48D925f167", "deployer": "0xAeF7B1596cD0a4Ec7f0D12E0ba440AdF2c2AE32f", "deploymentTime": "2025-10-19T21:13:37.055Z", "transactionHash": "0x5a3e1a1959e157198686c39324db147920ba16fb7cf9d5313ed1c566b769ee6c", "blockNumber": 44209159, "name": "ChainWeave AI NFT", "symbol": "CWAI", "mintFee": "0" } Smart contract deployed to monad and Etherum sepolia Envio configured and running perfectly

Tech Stack

React
Next
Ethers
Solidity
Node

Fundraising Status

Not yet

Team Leader
BBennett Uchechukwu
Sector
NFTAIOther