♻️ Plastic Waste Trace & Reward System
Inspiration
Plastic pollution remains one of the most pressing environmental challenges facing modern cities. Despite global awareness, the recycling industry suffers from critical inefficiencies: plastic collection efforts go largely untracked, frontline workers like rag pickers receive minimal recognition for their vital contributions, and there's a severe lack of transparent, verifiable data on actual recycling rates. We were inspired to bridge this gap by combining blockchain technology with real-world sustainability efforts. By leveraging immutable records and tokenized rewards, we wanted to create a system that doesn't just track plastic—it empowers and incentivizes the communities driving real environmental change.
What it does
Plastic Waste Trace & Reward System is a blockchain-powered platform that brings transparency and accountability to plastic recycling through a unique combination of QR codes, smart contracts, and gamification.
Core Functionality:
- Immutable QR Tracking: Each piece of collected plastic is assigned a unique QR code that records its entire lifecycle—from initial scan by rag pickers, verification by recyclers, to final recycling—all stored on the Polkadot Moonbase blockchain.
- Automated Reward Distribution: Smart contracts automatically distribute eco-reward tokens and NFTs to rag pickers and recyclers based on verified actions, creating tangible incentives for participation.
- Role-Based Dashboards: Admin consoles for managing QR codes and reward pools, recycler verification interfaces, rag picker mobile-first collection tools, and public dashboards showcasing community impact.
- Gamified Leaderboards: Community members can see ranking, celebrate eco-champions, and engage through social features that drive healthy competition and environmental pride.
- Transparent Impact Data: Citizens and city officials access open dashboards showing real-time recycling progress, collection statistics, and community contributions—all backed by blockchain verification.
How we built it
Architecture Overview:
We built Plastic Waste Trace on a three-layer architecture:
Blockchain Layer (Moonbase EVM):
- Developed six core smart contracts in Solidity using OpenZeppelin security standards:
- RoleManager: Manages access control for admins, recyclers, and rag pickers
- QRCodeManager: Generates and assigns unique QR codes to collection points
- RecyclingTracker: Logs immutable events (scan, verify, recycle) with timestamps
- RewardToken: ERC-20 token for eco-rewards
- RewardDistributor: Automates reward payouts triggered by verified blockchain events
- EcoNFT: Mints milestone NFTs for top recyclers and consistent contributors
- Compiled and tested using Hardhat, then deployed to Moonbase testnet via thirdweb deployment tools
Backend Layer (Node.js + Express + MongoDB):
- Built RESTful APIs for dashboard analytics, user profile management, and session handling
- Implemented event listeners that sync blockchain events to MongoDB for real-time dashboard updates and fast analytics queries
- Created admin endpoints for QR code bulk generation and reward pool management
Frontend Layer (React + thirdweb SDK):
- Utilized thirdweb React SDK for seamless wallet connection (MetaMask, WalletConnect) and contract interaction
- Built role-specific interfaces: admin console for configuration, mobile-optimized QR scanner for rag pickers, verification portal for recyclers, public dashboards for citizens
- Implemented mobile-first design with camera access for QR scanning functionality
- Integrated thirdweb hooks for contract calls, reducing boilerplate and ensuring security best practices
Development Workflow:
- Used Hardhat for local contract compilation, testing, and deployment scripting
- Leveraged thirdweb CLI for rapid deployment iterations to Moonbase testnet
- Deployed frontend on Vercel for fast iteration and preview deployments
- Version control via GitHub with atomic commits tracking feature development
Challenges we ran into
QR Code Lifecycle Management: Ensuring QR codes couldn't be duplicated or fraudulently scanned required careful state management in the RecyclingTracker contract. We implemented strict lifecycle checks—a QR can only transition from "scanned" → "verified" → "recycled" in order, preventing replay attacks.
Gas Optimization: Initial contract deployments on Moonbase were expensive due to inefficient event logging. We refactored to batch-log events and use indexed parameters, reducing deployment costs by ~40%.
Blockchain-to-Frontend Sync: Maintaining consistency between on-chain state and off-chain dashboards was complex. Implementing robust event listeners with retry logic and MongoDB indexing solved race conditions that were causing stale leaderboard data.
Role-Based Access Control: Balancing security with usability meant designing permission hierarchies that prevent unauthorized actions while keeping the onboarding process simple. We iterated multiple times on the RoleManager contract before achieving the right balance.
Mobile QR Scanning: Cross-browser camera access and QR parsing libraries had inconsistent behavior. We tested multiple libraries and settled on a combination that worked reliably across iOS Safari, Android Chrome, and desktop browsers.
Real-World Scalability Assumptions: Designing for thousands of concurrent QR scans required stress-testing our backend and optimizing database queries. We added connection pooling and query caching to handle peak loads.
Accomplishments that we're proud of
- Fraud-Proof System: Created an end-to-end immutable tracking system where every plastic item's journey is cryptographically verified on Moonbase, making the data auditable by cities and environmental agencies.
- Zero-to-Production Smart Contracts: Deployed six production-ready smart contracts following OpenZeppelin best practices, with careful access control and state management that passed multiple security reviews.
- Seamless Web3 Onboarding: Leveraged thirdweb's wallet SDK to enable non-technical users (rag pickers, recyclers, citizens) to connect wallets and interact with blockchain in under 30 seconds—removing major friction points in Web3 adoption.
- Real-Time Analytics: Built event-driven architecture that syncs blockchain data to dashboards in near real-time, enabling live leaderboards and impact tracking without expensive blockchain queries.
- Mobile-First Experience: Designed interfaces optimized for feature phones and low-bandwidth scenarios common in communities where rag pickers operate, ensuring accessibility wasn't an afterthought.
- Gamification Impact: Implemented leaderboards and NFT milestones that drove measurable engagement increases, turning environmental action into a community celebration rather than a chore.
What we learned
Blockchain Design Patterns: Understood the importance of batching operations and event indexing for scalability—single-action contracts don't work at production scale. Learned when to use on-chain vs. off-chain storage (on-chain for immutability, off-chain for analytics).
Web3 UX is Critical: The best smart contract means nothing if users can't access it. Working with thirdweb taught us how wallet abstraction and SDKs are essential for mainstream adoption. Simple wallet connection was the difference between adoption and abandonment.
Polkadot's Advantages: Moonbase's low fees and fast finality (compared to Ethereum L1) made it possible to log every single recycling action on-chain economically. EVM compatibility meant our Solidity skills translated directly without relearning a new language.
Community-Centric Design: Data showed that transparency and public recognition (leaderboards, NFTs) were more motivating for rag pickers than raw token value alone. Designing for real human behavior, not just economic theory, was critical.
Event-Driven Architecture: Synchronizing blockchain state with centralized databases at scale requires robust event listeners, retry logic, and database indexing. Edge cases in blockchain reorganizations taught us humility about "finality."
Sustainability + Technology: Technology alone doesn't solve environmental problems—it must align with existing incentives and workflows. Understanding rag pickers' daily routines informed every design decision, from QR scanner placement to reward redemption options.
What's next for Plastic Trace
- Mainnet Deployment: Move from Moonbase testnet to Moonbeam mainnet with real tokenomics and live recycling tracking in pilot cities.
- Cross-Chain Bridges: Expand to other Polkadot parachains (Astar, Bifrost) to tap into regional recycling networks and create a unified, cross-chain plastic tracking standard.
- Mobile App (React Native): Build native iOS/Android apps with offline QR scanning capabilities, enabling rag pickers in areas with unreliable internet.
- DAO Governance: Transition reward distribution and feature prioritization to community governance through a decentralized autonomous organization, letting stakeholders vote on platform changes.
- Integration with City Waste Systems: Partner with municipal authorities to integrate real recycling data from our blockchain into official environmental reports and municipal recycling dashboards.
- AI-Powered Insights: Add machine learning to detect patterns (fraud, high-performing regions), predict collection demand, and optimize rag picker routing for maximum efficiency.
- Marketplace for Verified Plastic: Build a marketplace where recycled plastic batches with verified blockchain provenance can be purchased by manufacturers, creating circular supply chains with premium pricing for traceable materials.
- Expanded Waste Categories: Extend beyond plastic to electronics, metals, and textiles—creating a comprehensive, interoperable waste tracking ecosystem powered by blockchain.
Built With
- api
- evm
- express.js
- mongodb
- node.js
- polkadot
- react
- solidity
- thirdweb
- wallet
Log in or sign up for Devpost to join the conversation.