LitterLoot is an AI + Web3 clean-to-earn platform where users document real-world cleanup work, get it verified by an AI auditor, and receive micro-rewards on Solana Devnet.
This MVP turns environmental action into a fast, measurable, and motivating feedback loop.
Look out your window. Walk down your street. Despite decades of Earth Day campaigns and awareness programs, the tragedy of the commons persists. We say we care, yet we still step over litter in our own neighborhoods.
Why? Because human psychology is stubborn. Guilt does not scale. Awareness does not clean streets. Incentives do.
Our current environmental relationship is broken because the feedback loop is missing. Pollute, and the consequence is delayed and invisible. Clean, and the reward is usually zero.
LitterLoot asks a different question: what if every citizen could become a motivated local guardian, and what if picking up trash felt as rewarding as finding loot in a game?
LitterLoot is an AI-powered clean-to-earn protocol that transforms cleanup work into a gamified, economically rewarding experience.
- Spot: Find trash in your community.
- Snap: Take a before photo.
- Clean: Remove the waste and take an after photo.
- Earn: The AI auditor verifies impact. If approved, the app sends a Solana reward.
LitterLoot bridges digital incentives and physical ecological action. It is not just an app, it is a blueprint for actionable smart-city behavior.
Add your GIF or YouTube demo link here.
- Live Demo: <ADD_LINK>
- GitHub: <ADD_LINK>
Fraud prevention is the hardest part of clean-to-earn. How do we stop fake uploads?
LitterLoot uses Gemini as a strict ecological auditor. The backend receives before/after images (Base64), builds a restrictive prompt, and expects strict JSON output:
{"verified": true|false, "reasoning": "..."}
This creates a consistent, fast, and unbiased verification layer.
Micro-bounties only work if payouts are immediate and cheap.
When verification is positive, the backend uses @solana/web3.js to submit a reward transaction on Solana Devnet. Low fees and fast finality make small environmental rewards viable.
Any app that sends tokens must defend against Sybil behavior.
LitterLoot uses @auth0/nextjs-auth0 for authentication and route protection so each cleanup flow is tied to an authenticated identity.
- Framework: Next.js 14 (App Router) + TypeScript.
- Styling: Tailwind CSS with a mission-console visual language.
- State: React hooks for multi-step mobile flow.
- Persistence: SQLite with better-sqlite3.
- Wallets: Phantom and Solflare adapters.
- Brand accountability (EPR): detect recurring branded litter patterns and route sponsorship pressure to local cleanup pools.
- Corporate ESG liquidity: enable sponsored, verifiable, neighborhood-level cleanup campaigns with cryptographic proof trails.
The planet does not need more awareness alone. It needs incentive-aligned action.
- Product Overview
- Tech Stack
- User Flow
- Project Architecture
- Prerequisites
- Local Setup
- Environment Variables
- Available Scripts
- API Endpoints
- Security Features
- Folder Structure
- Deployment
- Troubleshooting
- Recommended Roadmap
- Author
LitterLoot allows users to:
- Sign in with Auth0.
- Connect a Solana wallet (Phantom or Solflare).
- Submit before/after cleanup photos.
- Run AI-based verification.
- Receive SOL rewards on Devnet when verified.
- Review verification history and achievements.
- Claim bonus rewards for milestones.
- Frontend: Next.js 14 (App Router), React 18, TypeScript, TailwindCSS.
- Auth: Auth0 via
@auth0/nextjs-auth0. - AI: Google Gemini via
@google/generative-ai. - Blockchain: Solana Devnet via
@solana/web3.jsand wallet adapters. - Database: Neon Postgres in cloud (
@neondatabase/serverless) with SQLite fallback for local development. - UI Motion: framer-motion.
- User logs in with Auth0.
- User connects wallet and signs a challenge.
- User uploads before/after images from dashboard.
- Backend validates request, rate-limits, and sends data to Gemini.
- If Gemini verifies cleanup:
- SOL reward is sent.
- Verification history is persisted.
- User tracks progress and claims achievement bonuses.
- Conversion landing page:
app/page.tsx. - Authenticated sections: dashboard, history, profile, achievements.
- Key components:
components/CameraUploader.tsxcomponents/LiveZoneMap.tsxcomponents/profile/WalletPreferences.tsxcomponents/achievements/AchievementsBoard.tsx
-
app/api/verify/route.ts- Payload/image validation
- Per-user rate limiting
- Gemini timeout handling
- Verification persistence
- SOL reward dispatch
-
app/api/wallet/challenge/route.ts- Generates wallet-linking challenge (5 min expiration)
-
app/api/wallet/route.ts- Verifies signature and links wallet
-
app/api/history/route.ts- Returns history and stats
-
app/api/achievements/route.ts- Computes unlocks and claims
- Uses concurrency-safe claim reservation to prevent double payouts
Storage strategy:
- Production (Vercel): Neon Postgres via
POSTGRES_URLorDATABASE_URL. - Local fallback: SQLite at
data/litterloot.db.
Tables:
wallet_linkswallet_challengesverification_historyachievement_claims
- Node.js 18.18+ (Node.js 20 LTS recommended)
- npm 9+
- Auth0 tenant/app configuration
- Gemini API key
- Funded Solana Devnet reward wallet
- Clone repository.
- Install dependencies:
npm install- Create
.env.localfrom.env.example. - Start development server:
npm run dev- Open
http://localhost:3000.
Reference file: .env.example.
AUTH0_SECRETAUTH0_BASE_URLAUTH0_ISSUER_BASE_URLAUTH0_CLIENT_IDAUTH0_CLIENT_SECRET
GOOGLE_GEMINI_API_KEYGOOGLE_GEMINI_MODEL
SOLANA_REWARD_SECRET_KEYSOLANA_RPC_URLNEXT_PUBLIC_SOLANA_RPC_URLDEFAULT_REWARD_WALLET(optional)
POSTGRES_URL(recommended in Vercel)DATABASE_URL(fallback supported)SUPABASE_DB_URL(alias supported for Supabase direct connection strings)
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
Note: the current backend storage layer requires POSTGRES_URL, DATABASE_URL, or SUPABASE_DB_URL for server-side queries.
The two NEXT_PUBLIC_* variables are only needed if you later add Supabase client SDK usage in frontend code.
DEMO_MODE- If
trueand Gemini quota fails, API returns fallback response without payout.
- If
npm run dev # local development
npm run lint # static analysis
npm run build # production build
npm run start # run production serverGET /api/auth/[auth0]
-
GET /api/wallet- Returns linked wallet for authenticated user.
-
POST /api/wallet- Links wallet using challenge + signature verification.
-
GET /api/wallet/challenge- Issues time-limited signing challenge.
POST /api/verify- Accepts
beforeImageandafterImage(Base64 data URLs) - Validates MIME and size
- Runs Gemini verification
- Sends reward when approved
- Accepts
GET /api/history?limit=30&includeStats=true- Returns verification history and optional stats.
-
GET /api/achievements- Returns progress and claim states.
-
POST /api/achievements- Claims unlocked achievement bonus.
- Auth0 session checks on protected pages and APIs.
- Middleware protection for:
/dashboard/achievements/profile/history
- Wallet ownership proof through challenge + signature (
tweetnacl). - Wallet input sanitization.
- Image validation (allowed MIME + max 5MB).
- Server-side verification rate limiting.
- Gemini timeout protection.
- Concurrency-safe achievement claims to avoid double payouts.
- Sanitized
.env.exampleplaceholders (no real secrets).
app/
api/
achievements/
auth/[auth0]/
history/
verify/
wallet/
achievements/
dashboard/
history/
profile/
globals.css
layout.tsx
page.tsx
components/
achievements/
dashboard/
history/
layout/
profile/
utils/
solanaReward.ts
userWalletStore.ts
data/
litterloot.db
Recommended: Vercel.
Pre-deploy checklist:
- Set all required environment variables.
- Ensure
DEMO_MODEis disabled in production. - Ensure Postgres is configured (
POSTGRES_URLorDATABASE_URL) so production does not rely on local SQLite. - Run:
npm run lint
npm run build- Confirm reward wallet has enough Devnet SOL for testing.
Set GOOGLE_GEMINI_API_KEY in .env.local and restart the app.
Set SOLANA_REWARD_SECRET_KEY as a JSON array of 64 bytes.
Make sure user provides a Base58 public key, not a private key array.
API returns 429 with retryAfterSeconds; wait and retry.
Confirm Phantom/Solflare is installed and unlocked in browser.
- Migrate persistence to PostgreSQL + Prisma.
- Add complete test suite (unit, integration, e2e).
- Add structured logging + observability.
- Add CSRF/origin checks for sensitive POST routes.
- Add stricter anti-fraud geospatial validation.
Ronald Azuero Maldonado
Hackathon MVP: Web3 + AI for verifiable environmental action.