Search projects, hackathons, sponsors and tech

    ← All projects

    Demo

    About

    The problem it solves 、# FoodGuard: A Decentralized Food Safety Governance System Powered by Blockchain ## 🎯 Project Overview **FoodGuard** is a revolutionary decentralized platform for food safety governance. By leveraging blockchain technology, it redefines the traditional centralized regulatory model and transforms it into a community-driven autonomous system. This ensures a transparent, fair, and efficient mechanism for handling food safety issues. ### Core Value Propositions - **Decentralized Governance**: Eliminates single points of failure and enables community-based decision-making. - **Economic Incentives**: Implements a token-based collateral system to ensure participant integrity. - **Smart Automation**: Uses Chainlink services for fair randomness and automated execution. - **Transparency and Traceability**: All processes are recorded on-chain, ensuring complete transparency and immutability. ## 🛠️ Solution: A Hybrid Architecture Combining On-Chain Arbitration and Off-Chain Services To ensure **decentralized trust** while providing a **Web2-level user experience** and **low operational costs**, we have innovatively designed a hybrid system architecture. ### Core Highlights #### Minimalist On-Chain Core (Immutable Trust Root) Smart contracts serve as the tamper-proof trust foundation, handling only the most critical logic: - User role registration - Fund custody (collateral) - Key state transitions - Arbitration event broadcasting This design dramatically reduces contract complexity and gas consumption, making the system more secure, economical, auditable, and upgradable. #### High-Performance Off-Chain Services (Efficient Business Logic) Complex business logic—such as user profile management, complaint storage, case tracking, and vote records—is handled by high-performance backend APIs (based on **Next.js API Routes**). This ensures: - Fast application response - Efficient data querying - Storage for large volumes of evidence, text, and images Thus, overcoming blockchain’s storage cost limitations. #### Dynamic Game Theory and Incentive Mechanism The platform is more than just a tool—it’s a **self-sustaining economic ecosystem**. Through: - Collateral systems - Dynamic risk assessment - Voting/challenge rewards - Reputation point system All participants (complainants, enterprises, DAO arbitrators) are incentivized to act fairly, creating a positive feedback loop that promotes integrity and fairness. #### DeFi-Level Automation and Fairness Guarantees We integrate leading decentralized services from **Chainlink**: - **Chainlink VRF (Verifiable Random Function)**: Ensures fair and tamper-proof random selection of arbitrators from the DAO pool. - **Chainlink Automation**: Acts as an autonomous system scheduler that monitors case states and automatically triggers contract functions (e.g., voting timeouts), ensuring uninterrupted 24/7 operation. ## 🧱 Technical Architecture ### Frontend: `Next.js (React)` + `TypeScript` + `Wagmi` + `RainbowKit` - Offers a modern, type-safe, componentized, and responsive UI. - Seamless wallet integration via Wagmi and RainbowKit greatly lowers the Web3 onboarding barrier. ### Smart Contracts: `Solidity` + `Foundry` - Developed and tested using the fast and efficient Foundry framework. - Contracts follow minimalist design principles with clear and focused responsibilities. ### Backend/API Layer: `Next.js API Routes` - Unified with the frontend for simplified development. - Handles off-chain data processing and serves as the bridge between on-chain and off-chain worlds. ### Decentralized Oracle: `Chainlink` - **VRF** guarantees fair selection of arbitrators (see lines 566–612 in `FoodSafetyGovernance.sol`). - **Automation** ensures reliable and autonomous case progression (see lines 615–715 in `foodguard-contract.sol`). ## 🔁 System Workflow (End-to-End) A fully closed-loop process ensures each case is handled fairly and efficiently: ### Preparation Phase: Registration and Collateral Deposit Participants (complainants, enterprises, DAO members) connect their wallets and register on-chain. They deposit collateral into the system’s fund pool—an essential prerequisite for all subsequent interactions. ### Initiation Phase: Complaint Submission Complainants submit a complaint with key elements (e.g., accused party, risk level) stored on-chain, triggering a `CaseCreated` event. Detailed evidence (texts, images, documents) is stored off-chain via API and linked to the on-chain case ID. ### Arbitration Phase: Random Selection and Voting - Chainlink VRF randomly selects an odd number of active DAO members as arbitrators. - Within a defined time window, arbitrators vote based on evidence provided by both sides. - Voting is recorded on-chain but remains anonymous. - DAO members may **challenge** any arbitrator they believe to be unfair, initiating a second-layer dispute process. ### Settlement Phase: Automated Judgment a