BugDex
Web3 biodiversity monitoring: photograph insects, community voting, mint NFTs, support conservation.
Problem Statement
BugDex is a mobile-first DeSci (Decentralized Science) platform that transforms biodiversity monitoring into an engaging, economically sustainable activity. Over 40% of insect species are declining globally, yet conservation data collection remains expensive, slow, and limited to well-funded regions.BugDex solves this by gamifying biodiversity research: users photograph insects with their phones, stake tokens to submit for community voting, and mint verified observations as NFTs with rarity tiers (Common to Legendary). Every photo becomes both a collectible and valuable scientific data - geo-tagged, timestamped, and permanently stored on IPFS.The platform demonstrates three powerful sponsor integrations:PYUSD Consumer Payments: Users pay $1 in PYUSD (stablecoin) or ETH to unlock the faucet, which dispenses 100 BUG tokens every 24 hours. Stablecoin payments provide predictable pricing regardless of crypto volatility. Users can also donate PYUSD directly to conservation organizations, with quarterly fund distribution determined by community token voting - transparent on-chain impact for real-world conservation.Blockscout Custom Explorer: Deployed a custom-branded explorer at bugdex-explorer.cloud.blockscout.com that keeps users in the BugDex ecosystem. Transaction confirmation dialogs after key actions (unlock, stake, mint) provide blockchain transparency without leaving the app or triggering mobile popup blockers.Pyth Price Oracle: Uses Pyth's ETH/USD price feed to dynamically calculate the exact ETH needed for a $1 faucet unlock. The system fetches real-time prices from Hermes before each transaction, ensuring the unlock cost stays at $1 regardless of ETH price volatility - critical for consumer-facing applications.How it works:Unlock Faucet - Pay $1 (PYUSD or ETH) to unlock 24h token claimsPhotograph - Capture insects with mobile camera (stored on IPFS via Lighthouse)Stake & Submit - Lock 10 BUG tokens to submit for community votingCommunity Votes - Other users vote FOR or AGAINST (free, off-chain signatures)Mint NFT - Approved bugs (2+ net votes) become NFTs with rarity tiersEarn Rewards - Voters earn 5 BUG per upvote, discoverers keep the NFTSupport Conservation - Donate PYUSD to wildlife organizations with transparent trackingBugDex showcases how Web3 can solve real-world problems by making scientific data collection economically viable, accessible to anyone with a smartphone, and directly connected to conservation funding.Live App: https://bugdex.life Custom Explorer: https://bugdex-explorer.cloud.blockscout.com Network: Sepolia Testnet
Solution
BugDex is built on a hybrid architecture that balances blockchain transparency with practical UX:SMART CONTRACTS (Solidity 0.8.27):BugTokenV3: ERC-20 with dual-payment faucet (PYUSD + ETH via Pyth oracle). Integrated Pyth's pull oracle pattern - fetches ETH/USD price from Hermes before each unlock to calculate exact ETH needed for $1 cost. Added PYUSD transfer logic to accept stablecoin payments with allowance checks.BugSubmissionStaking: Manages 10 BUG stakes for submissions and distributes 5 BUG rewards per upvote. Uses off-chain voting signatures to save gas while maintaining verifiable on-chain reward distribution.BugNFT: ERC-721 with dynamic rarity tiers (Common, Rare, Epic, Legendary) based on vote counts. Metadata stored on IPFS with tokenURI pointing to decentralized storage.FRONTEND (Next.js 15 + TypeScript):Mobile-first PWA with App Router for fast navigationPrivy for wallet abstraction (external wallets only - mobile-optimized)TailwindCSS with dark mode themingCamera API integration for in-browser photo captureEthers.js v6 for contract interactions with proper error handlingClipboard API with fallback handling for mobile transaction linksSPONSOR INTEGRATIONS:PYUSD (Consumer Champion prize):Dual-payment faucet accepts PYUSD OR ETHConservation donation system with community-governed fund distributionMobile-first stablecoin payments for predictable pricingContract: 0xCaC524BcA292aaade2DF8A05cC58F0a65B1B3bB9 (Sepolia)Blockscout (Autoscout prize):Custom explorer deployed: bugdex-explorer.cloud.blockscout.comRequested $1000 credits via Discord per requirementsTransaction popups use confirm() dialogs instead of window.open() to bypass mobile popup blockersClipboard copy fallback ensures users can access transaction links on any devicePyth Network (Pull Oracle prize):ETH/USD price feed: 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0aceFetches latest price from Hermes API before each unlock transactionPull-based updates ensure accurate pricing without expensive on-chain storageDynamic calculation: cost = $1 / (ETH price) = exact ETH amountBACKEND (Next.js API Routes + Postgres):Voting system with off-chain signature verification (ethers.recoverAddress)IPFS uploads via Lighthouse API with metadata generationPostgres database for submissions, votes, and faucet unlock trackingREST endpoints: /api/submit-bug, /api/vote, /api/uploads, /api/mint-statusDEPLOYMENT:Hardhat for contract deployment with verification scriptsVercel for frontend hosting with automatic CI/CDEnvironment variables for contract addresses, API keys (Pinata, Privy)Git-based version control with frequent commits throughout hackathonHACKY/NOTABLE SOLUTIONS:Hybrid on-chain/off-chain voting: Votes are signed off-chain and verified in backend, but rewards distributed on-chain. Saves massive gas costs while maintaining cryptographic verifiability.Confirm dialog workaround: Mobile browsers block window.open() after async operations, so we use confirm() with clipboard copy to show transaction links without triggering popup blockers.Pyth pull oracle: Implemented manual price feed updates by fetching from Hermes API right before transactions, avoiding expensive keeper networks while ensuring accurate pricing.Rarity calculation: NFT rarity tier automatically upgrades based on vote count (2+ = Common, 5+ = Rare, 10+ = Epic, 20+ = Legendary) with colored frames for visual feedback.Contract verification override: FaucetButton checks both isUnlocked() and contract events to handle users who unlocked before event emission was added.The trickiest integration was Pyth oracle - had to understand pull vs push models, decode price feed IDs, handle Hermes API responses, and update contract state with fresh prices before each transaction. The result is a consumer-friendly $1 price point that stays accurate regardless of ETH volatility.Tech Stack Summary: Next.js 15, TypeScript, Solidity, Ethers.js, Privy, PYUSD, Pyth Oracle, Blockscout, Lighthouse IPFS, Postgres, TailwindCSS, Vercel.
Hackathon
ETHOnline 2025
2025
Contributors
- FleetFox1
145 contributions
- Neitherhydra41
31 contributions