EcoMind is an innovative waste management and community engagement platform built on blockchain technology. It incentivizes users to report and collect waste while providing a gamified experience with rewards and a lottery system.
- Technologies Used
- Key Features
- How It Works
- Project Structure
- Smart Contract
- Frontend
- Backend
- Integration of Key Technologies
- Setup and Installation
- Next.js
- React
- TypeScript
- Solidity
- Ethers.js
- Tailwind CSS
- Sign Protocol
- Lit Protocol
- Chainlink (Price Feed, VRF, and Functions)
- Web3Auth
- IPFS
- Waste reporting and collection
- Token-based reward system
- Dynamic reward calculation based on ETH price
- Weekly lottery for additional rewards
- User authentication with Web3Auth
- Encrypted waste data storage using Lit Protocol
- On-chain attestations using Sign Protocol
- Real-time ETH price feed using Chainlink
- Interactive map for waste hotspots
- User dashboard with notifications and rewards
- Users authenticate using Web3Auth.
- Users can report waste locations and quantities through the app.
- Reported waste data is encrypted using Lit Protocol and stored on IPFS.
- Users earn RWT (Reward Token) for reporting and collecting waste.
- The reward amount is dynamically calculated based on the current ETH price (Chainlink Price Feed).
- A weekly lottery gives users a chance to win additional rewards.
- User activities and rewards are recorded as on-chain attestations using Sign Protocol.
- The app provides a dashboard for users to track their rewards, level, and notifications.
- Smart Contract (
/contracts
)ecomind.sol
: Core smart contract handling token management, rewards, lottery, and Chainlink integrations.
- Utils (
/src/utils
)ecomind.json
: ABI for the smart contract.contractInteraction.ts
: Functions for smart contract interactions.litProtocol.ts
: Handles encryption and decryption using Lit Protocol.signAttestations.ts
: Creates on-chain attestations using Sign Protocol.signSchemas.ts
: Defines schemas for Sign Protocol attestations.db/actions.ts
: Handles database operations for user rewards and notifications.
- Hooks (
/src/hooks
)useMediaQuery.ts
: Custom hook for responsive design.useSessionSigs.ts
: Manages Web3Auth sessions and Lit Protocol authentication.
- Components (
/src/components
)ContractInteraction.tsx
: Interface for waste reporting and contract interactions.Header.tsx
: Navigation bar with Web3Auth integration.Map.tsx
: Interactive map for waste reporting and hotspot visualization.Sidebar.tsx
: Main navigation menu.UserDashboard.tsx
: Displays user rewards and notifications.createSchemas.tsx
: Component to create Sign Protocol schemas.
- Scripts (
/src/scripts
)createSchemas.js
: Script to create Sign Protocol schemas programmatically.
The Ecomind.sol
contract is the core of the platform, handling:
- ERC20 token implementation (RWT - Reward Token)
- Dynamic reward calculation based on ETH price
- Weekly lottery using Chainlink VRF for randomness
- Chainlink Price Feed integration for real-time ETH prices
- Chainlink Functions for external data fetching
Built with Next.js, React, and TypeScript, key components include:
Header.tsx
: Navigation and user authenticationSidebar.tsx
: Main navigation menuMap.tsx
: Interactive map for waste reporting and hotspotsContractInteraction.tsx
: Interface for interacting with the smart contractUserDashboard.tsx
: Display user rewards and notifications
The backend functionality is primarily handled by the smart contract and various utility functions:
contractInteraction.ts
: Functions for interacting with the Ecomind contractlitProtocol.ts
: Functions for encrypting and decrypting waste datasignAttestations.ts
: Functions for creating on-chain attestationssignSchemas.ts
: Defines schemas for Sign Protocol attestations
- Used in
signAttestations.ts
andsignSchemas.ts
to create on-chain attestations for user activities. createSchemas.tsx
andcreateSchemas.js
are used to set up the attestation schemas.
- Integrated in
litProtocol.ts
for encrypting and decrypting waste data. - Used in
Map.tsx
andContractInteraction.tsx
for secure data handling. useSessionSigs.ts
hook manages Lit Protocol authentication.
- Price Feed: Used in
ecomind.sol
to get real-time ETH prices for dynamic reward calculation. - VRF (Verifiable Random Function): Implemented in
ecomind.sol
for the lottery system. - Functions: Integrated in
ecomind.sol
for external data fetching.
- Implemented in
Header.tsx
for user authentication. useSessionSigs.ts
hook manages Web3Auth sessions.
- Used in
litProtocol.ts
for storing encrypted waste data.
Ecomind now incorporates DIMO (Decentralized Internet of Mobility) to enhance its waste management capabilities and promote eco-friendly driving habits. This integration aligns with the project's goal of environmental sustainability and community engagement.
- DIMO API Handler (
src/pages/api/dimo.ts
)- Manages server-side interactions with the DIMO API
- Handles authentication and data fetching for user devices, vehicle status, and trip data
- Ensures secure communication between the application and DIMO services
- DIMO API Utility (
src/utils/dimoApi.ts
)- Provides client-side functions to interact with the DIMO API
- Includes fallback to dummy data for development and testing purposes
- Fetches user devices, vehicle data, and trip information
- DIMO Eco Score Component (
src/components/DimoEcoScore.tsx
)- Calculates and displays an eco-score based on DIMO data
- Considers fuel efficiency and eco-friendly trips
- Encourages users to adopt more sustainable driving habits
- DIMO Vehicle Data Component (
src/components/DimoVehicleData.tsx
)- Displays detailed vehicle information from DIMO
- Provides users with insights into their vehicle's status and performance
- Environmental Impact Tracking:
- The DIMO integration allows users to monitor their vehicle's environmental impact
- Eco scores incentivize users to adopt more sustainable driving habits, aligning with Ecomind's waste reduction goals
- Community Engagement:
- By incorporating vehicle data, Ecomind expands its scope beyond waste management
- Users can see how their driving habits contribute to overall environmental efforts
- Data-Driven Insights:
- DIMO data can be used to correlate driving patterns with waste generation and collection activities
- This information can help optimize waste collection routes and schedules
- Gamification and Rewards:
- The eco-score system adds another dimension to the app's gamification strategy
- Users can earn additional rewards for maintaining high eco-scores, further encouraging sustainable behaviors
- Holistic Approach to Sustainability:
- By combining waste management with vehicle efficiency tracking, EcoMind provides a more comprehensive platform for environmental consciousness
- This approach emphasizes that sustainability efforts extend beyond waste management to everyday activities like driving The DIMO integration enhances EcoMind's capabilities, providing users with a more comprehensive tool for managing their environmental impact. It reinforces the project's commitment to sustainability by addressing multiple aspects of users' daily lives and encouraging eco-friendly behaviors across different domains.