AleaArt
A platform that generates unique art parameters using a verifiable on-chain randomeness from a commit-reveal mechanism on Mantle Sepolia Testnet, creates AI-generated images using Clipdrop API
视频
描述
AleaArt - Blockchain-Powered Generative Art Platform
AleaArt is a decentralized platform that generates unique art parameters using a verifiable on-chain randomness from a commit-reveal mechanism on Mantle Sepolia Testnet, creates AI-generated images using Clipdrop API, and enables NFT minting and trading. Each art piece is truly unique, verifiable on the blockchain, and tradeable as NFTs.
Live Link - Link
🎨 Key Features
Commit-Reveal RNG: Verifiable on-chain randomness using a secure two-step commit-reveal protocol
Generative Art Parameters: Converts randomness into detailed art generation parameters
AI Image Generation: Creates stunning images using Clipdrop API
NFT Minting: Convert generated art into tradeable NFTs on Mantle Testnet
Decentralized Marketplace: Buy and sell NFTs directly peer-to-peer
IPFS Storage: Images stored on decentralized IPFS network via Pinata
User Authentication: Secure login/signup with NextAuth.js
Wallet Integration: MetaMask connection for blockchain interactions
Image Gallery: Personal gallery to view and manage generated artwork
Real-time Generation: Asynchronous image generation with status tracking
🔗 Smart Contracts
CommitRevealArtParams Contract
Address: 0x01f077E8a758D12B14e07eE72764df963378e001
Network: Mantle Testnet
Location: contracts/MantleCommitRevealArtParams.sol
The core contract that implements a Commit-Reveal scheme to generate deterministic art parameters:
Commit Phase: Users commit a hash of a secret to prevent front-running and ensure fairness
Reveal Phase: Users reveal their secret to generate verifiable randomness
Parameter Generation: Converts the resulting seed into art parameters:
Prompt templates (12 different styles)
Style modifiers (10 artistic styles)
Technical parameters (steps, CFG scale, aspect ratio)
Unique seeds for reproducibility
On-Chain Storage: Stores parameters permanently for verification
AleaArtNFT Contract
Address: 0x686d373E8feBA2B2De4576771B2045EFEAE574cE
Network: Mantle Testnet
Location: contracts/AleaArtNFT.sol
The NFT marketplace contract enabling art trading:
NFT Minting: Convert generated art into ERC721 NFTs
IPFS Integration: Links NFTs to images stored on IPFS
Marketplace Functions: Buy, sell, and trade NFTs
Price Management: Set and update NFT prices
Ownership Tracking: Tracks both creator and current owner
Direct Payments: 100% of sale proceeds go to seller (no platform fees)
Sale Status: Enable/disable NFTs for sale
Contract Functions Overview
CommitRevealArtParams:
commit(bytes32 hash)- Submit a hash of your secretreveal(uint256 secret)- Reveal secret to generate parameters and mint token IDviewRenderParams(tokenId)- View generated parameterstokenSeed(tokenId)- Get the random seed usednextTokenId()- Get next available token ID
AleaArtNFT:
mintNFT(to, ipfsHash, prompt, price)- Mint new NFTbuyNFT(tokenId)- Purchase NFT (sends ETH to seller)setPrice(tokenId, newPrice)- Update NFT pricesetSaleStatus(tokenId, isForSale)- Enable/disable for salegetAllNFTs()- Get all minted NFTsgetNFTsForSale()- Get NFTs currently for sale
📁 Project Structure
AleaArt/
├── contracts/ # Smart Contracts (Solidity)
│ ├── AleaArtNFT.sol # NFT marketplace and trading
│ └── CommitRevealArtParams.sol # Commit-reveal mechanism for art parameters
│
├── frontend-aleart/ # Frontend Application (Next.js)
│ ├── src/
│ │ ├── app/ # Next.js app router pages
│ │ │ ├── page.tsx # Landing page
│ │ │ ├── marketplace/ # NFT marketplace page
│ │ │ ├── dashboard/ # User dashboard for generation
│ │ │ └── api/ # API routes
│ │ │ ├── buy-nft/ # NFT purchase endpoint
│ │ │ ├── marketplace/ # Market data endpoint
│ │ │ └── ...
│ │ ├── components/ # React components
│ │ ├── lib/ # Utilities (auth, db)
│ │ ├── models/ # MongoDB models
│ │ └── types/ # TypeScript types
│ ├── public/ # Static assets
│ └── package.json # Node.js dependencies
│
├── python_backend.py # Flask backend for Stable Diffusion
├── python_backend_macos.py # macOS-specific backend
├── python_backend_simple.py # Simplified backend version (deprecated)
├── python_backend_clipdrop.py # Flask backend using Clipdrop API
├── test_async_api.py # Async API testing
│
├── scripts/ # Deployment scripts
│ ├── deploy-artParams.ts # Deploy art params contract
│ └── deploy-nft-arbitrum.ts # Deploy NFT contract
│
├── generated_images/ # Generated artwork storage (local)
├── artifacts/ # Compiled contract artifacts
├── cache/ # Build cache
├── hardhat.config.ts # Hardhat configuration
│
├── requirements.txt # Python dependencies
├── requirements_macos.txt # macOS Python dependencies
├── package.json # Root node.js dependencies
└── README.md # This file
Directory Overview
contracts/- Solidity smart contracts that handle on-chain logic, NFT minting, trading, and randomnessfrontend-aleart/- Next.js frontend application with TypeScript, Tailwind CSS, and React componentspython_backend*.py- Python Flask servers for AI image generation (Stable Diffusion or Clipdrop API)scripts/- Hardhat deployment scripts for deploying contractsgenerated_images/- Local storage for generated artwork before IPFS uploadartifacts/- Compiled contract artifacts and build information
🏗️ Architecture
Frontend: Next.js with TypeScript and Tailwind CSS
Backend: Python Flask with Stable Diffusion integration
Database: MongoDB for user data and generated images metadata
Blockchain: Mantle Testnet
Authentication: NextAuth.js with JWT tokens
Image Storage: IPFS via Pinata (decentralized)
NFT Standard: ERC721 compliant
Payment: Direct ETH transfers (no platform fees)
🚀 Technology Stack
Blockchain: Solidity, Hardhat, Ethers.js, OpenZeppelin
Frontend: Next.js, React, TypeScript, Tailwind CSS
Backend: Python, Flask, Stable Diffusion / Clipdrop API
Database: MongoDB, Mongoose
Authentication: NextAuth.js
Storage: IPFS, Pinata API
NFT: ERC721 standard
🔧 Backend Options
Clipdrop API Backend (Recommended)
The project now supports Clipdrop API for faster, cloud-based image generation:
Features:
⚡ Faster Generation: Cloud-based API, no local GPU required
🎨 High Quality: Professional-grade AI image generation
💰 Cost Effective: Pay-per-use pricing
🚀 Easy Setup: No complex model downloads or GPU setup
Stable Diffusion Backend (Legacy)
The original Stable Diffusion backends are still available but require significant computational resources:
python_backend_simple.py- Basic CPU/GPU supportpython_backend_macos.py- macOS optimizedpython_backend.py- Full-featured with optimizations
🎯 User Journey
Connect Wallet: Link MetaMask to Mantle Testnet
Commit Secret: Submit a hashed secret to the contract
Reveal Art Parameters: Reveal your secret to generate verifiable art parameters
Create Art: AI generates unique image using Clipdrop API
Mint NFT: Convert art to tradeable NFT with custom price
Trade: Buy/sell NFTs in the decentralized marketplace
Own: Full ownership and control of your digital art
Images



