AI News Hub Logo

AI News Hub

LitterLoot: Healing the Earth, One Micro-Bounty at a Time (AI + Web3)

DEV Community
Ronald Alejandro Azuero Maldonado

This is a submission for Weekend Challenge: Earth Day Edition Walk down almost any street, in almost any city, in almost any country, and you will see the same quiet collapse: Everyone sees it. That is our environmental paradox. The system is not designed for action. For years we have asked people to care harder. The reward loop is broken: Polluting is cheap and immediate. Cleaning is costly and invisible. If you litter, the negative impact is delayed and distributed. So behavior defaults to convenience. That is the uncomfortable hypothesis behind LitterLoot: What if we stopped asking for permanent altruism, That is why I built LitterLoot. Not as another eco dashboard. LitterLoot is an AI-powered clean-to-earn app where users submit before/after cleanup proof, LitterLoot is based on one core belief: We already built systems that reward consumption in real time. So the real question is not whether people can be convinced to care. LitterLoot turns cleanup from invisible volunteer effort into measurable local action. Capture proof. That sequence is the product. User logs in. User links a wallet securely. User uploads before and after photos. Gemini audits visual evidence. If verified, backend sends micro-reward on Solana. Result and tx signature are stored in history. This turns cleanup from a moral burden into a repeatable incentive loop. Live App: https://litter-loot.vercel.app/ Repository: https://github.com/Sherman95/LitterLoot Video Demo: Suggested 45-second demo sequence: Sign in with Auth0. Link wallet from profile. Upload before/after proof. Trigger verification. Show verdict, reward tx, and history update. Main implementation areas: Frontend pages and routes: app/ Wallet UX and profile flow: components/profile/ Verification API: app/api/verify/route.ts Wallet APIs: app/api/wallet/ Secure mobile wallet-link APIs: app/api/wallet/mobile/ Persistence layer: utils/userWalletStore.ts Solana reward sender: utils/solanaReward.ts Supabase schema: supabase/001_init_litterloot.sql End-to-end architecture: authenticated evidence submission, AI decisioning, persistence, and onchain micro-bounty payout. flowchart LR U[Citizen User] FE[Next.js Frontend\nUpload + Profile + History] AU[Auth0\nIdentity + Session] API[Next.js API Routes\nverify wallet reward history] AI[Gemini Verification\nImage Analysis] DB[(Supabase Postgres\nUsers Verifications Claims)] RW[Solana Reward Engine\nDevnet Transfer] HX[History Timeline\nVerdict + TX Signature] U -->|Upload evidence| FE FE -->|Login session| AU FE -->|Authenticated request| API API -->|AI verify| AI AI -->|Verification verdict| API API -->|Persist result| DB API -->|Send reward| RW RW -->|TX signature| API API -->|Store payout proof| DB DB -->|Show history| HX HX -->|User timeline view| FE classDef env fill:#B7F3D0,stroke:#21804A,stroke-width:2px,color:#0F3D25; classDef infra fill:#CDE7FF,stroke:#2D5D8C,stroke-width:2px,color:#14324D; classDef chain fill:#FFD9B8,stroke:#A85B1E,stroke-width:2px,color:#5A2D0D; class U,AI,HX env; class FE,AU,API,DB infra; class RW chain; Color legend: Green: environmental impact journey Blue: platform infrastructure and trust boundaries Orange: blockchain payout domain Layer Technology Framework Next.js 14 (App Router) Language TypeScript Auth Auth0 (@auth0/nextjs-auth0) AI Google Gemini (@google/generative-ai) Blockchain Solana Devnet (@solana/web3.js) Storage Supabase Postgres (with local SQLite fallback) UI Tailwind CSS + React components Deployment Vercel I split the app into four trust boundaries: Identity (Auth0) Wallet ownership proof (challenge + signature) Verification intelligence (Gemini) Reward execution and persistence (Solana + Postgres) This mattered because every incentive app has one core risk: fraud. Reward systems attract bots and abuse. Implemented: Session-based protected routes via middleware Authenticated API access checks Strict separation of public vs protected actions This ensures the reward path is always tied to an authenticated principal. Users cannot claim rewards by typing any wallet string. Standard flow: Backend generates challenge with expiration. User signs challenge from wallet. Backend verifies ed25519 signature. Wallet is linked to user account. This prevents reward hijacking and accidental misbinding. The hardest bug was iOS context switching. I implemented a secure mobile wallet-link flow: Create one-time wallet link attempt ticket (wallet_link_attempts) Ticket has TTL and single-use consumption Open dedicated /wallet-link?attempt=... flow in Phantom context Sign there and complete server-side link Mark attempt as used to prevent replay This removed the fragile legacy loop and made iOS linking practical. The verifier must be strict, deterministic, and parseable. verified: boolean reasoning: string Guardrails implemented: MIME whitelist (jpg/png/webp) Max image size check Timeout wrapper for model calls Quota and retry response handling Schema parse checks for model output If verification fails, no payout. Micro-rewards only work with low latency and near-zero fees. Reward pipeline: Validate linked wallet exists. Normalize wallet input defensively. Build transfer transaction. Submit and confirm tx. Persist tx signature in verification history. I also hardened wallet parsing to avoid cryptic invalid-address failures. Production persistence runs on Postgres with Supabase schema. Tables used: wallet_links wallet_challenges wallet_link_attempts verification_history achievement_claims This supports reward auditability, claim safety, and durable session-independent wallet-link attempts. Hardening done during iteration: Verification rate limit window by user Claim race-condition protections Better reward wallet normalization and validation Build/runtime config guards for cloud DB connectivity Clearer user-facing failure reasons Goal: not just demo success, but safer failure behavior under real usage. Submitting to: Best use of Google Gemini Best use of Auth0 for Agents Best use of Solana Best use of GitHub Copilot Gemini is the decision engine for visual cleanup verification, Auth0 secures identity before any reward-bearing action, Solana enables fast and low-cost micro-transfers, Copilot accelerated hardening cycles: Anti-spoof image checks (metadata + similarity heuristics) Geofenced community cleanup missions Sponsored bounty pools for campuses and neighborhoods Brand-level litter attribution for EPR-style accountability Public impact dashboard with verified cleanup heatmaps The Earth does not need more slogans. LitterLoot is my attempt to build one such system. Not with guilt. If we can engineer systems that reward extraction, That is the thesis. This is the first implementation.