Skip to content

A decentralized platform that tracks agricultural produce through the entire supply chain, ensuring transparency in pricing, quality, and origin verification.

Notifications You must be signed in to change notification settings

idityaGE/food-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 AgriChain - Blockchain Agricultural Supply Chain

SIH 2025 License Blockchain

Blockchain-powered agricultural transparency from farm to table

A decentralized platform that tracks agricultural produce through the entire supply chain, ensuring transparency in pricing, quality, and origin verification.


Demo Video:

SIH_project_demo.mp4

πŸ“‹ Problem Statement

Problem Statement ID: 25045

Problem Statement Title: Blockchain-Based Supply Chain Transparency for Agricultural Produce

Description

Create a blockchain-based system to track agricultural produce from farm to consumer, ensuring transparency in pricing, quality, and origin. The solution should allow stakeholders (farmers, distributors, retailers) to verify transactions and reduce exploitation in the supply chain.

Expected Outcome

A decentralized platform with a user-friendly interface for farmers and consumers to trace produce, reducing fraud and ensuring fair pricing, deployable on low-cost hardware or cloud infrastructure.

Technical Feasibility

Leverages existing blockchain frameworks like Ethereum or Hyperledger, with smart contracts for automated tracking and QR code integration for consumer access.

Organization: Government of Odisha
Department: Electronics & IT Department
Category: Software
Theme: Agriculture, FoodTech & Rural Development


πŸ’‘ Our Solution

Key Features

  • πŸ”— Blockchain Integration

    • Smart contracts for automated tracking and verification
    • Deployed on Polygon network for low-cost, fast transactions
    • Immutable records ensuring data integrity
  • πŸ‘₯ Stakeholder Management

    • On-chain registration for farmers, distributors, retailers, and inspectors
    • Role-based access control and permissions
    • Transparent ownership transfer tracking
  • πŸ“¦ Batch Tracking System

    • Each harvest batch recorded with detailed metadata
    • Hash-based verification for authenticity
    • Complete supply chain journey tracking
  • βœ… Quality Assurance

    • Independent inspector verification system
    • AI-powered harvest image validation
    • Quality reports attached to each batch
  • πŸ“± QR Code Integration

    • Instant access to complete product history
    • Consumer-friendly verification interface
    • Transparent pricing and origin information
  • πŸ€– AI Validation (Coming Soon)

    • Automated harvest image verification
    • Invoice validation and fraud detection
    • Smart anomaly detection

Innovation & Uniqueness

  • Hybrid Data Storage: Essential data on blockchain, detailed information in database for cost optimization
  • Low-Cost Infrastructure: Runs on Polygon for affordable, scalable deployment
  • AI Integration: Validates harvest images and invoices automatically
  • Multi-Stakeholder Design: Benefits farmers, distributors, retailers, consumers, and government
  • QR Code Accessibility: Simple consumer verification without technical knowledge

πŸ—οΈ Architecture

System Overview

System Architecture Diagram

Technical Flow

Technical Implementation Flow

πŸ› οΈ Tech Stack

Frontend

  • Next.js 14 - React framework for production-grade applications
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Shadcn/UI - Modern component library
  • React Native (Expo) - Mobile app (Coming Soon)

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web application framework
  • TypeScript - Type-safe backend development
  • JWT - Authentication & authorization

Database

  • PostgreSQL - Relational database
  • Prisma ORM - Type-safe database client
  • AWS S3 - File storage (Coming Soon)

Blockchain

  • Polygon Network - Layer 2 scaling solution
  • Solidity - Smart contract development
  • Ethers.js - Ethereum interaction library
  • Foundry - Smart contract development toolkit
  • Anvil - Local Ethereum node

DevOps & Tools

  • Bun - Fast JavaScript runtime (backend)
  • PNPM - Fast, disk space efficient package manager (frontend)
  • Git - Version control
  • Docker - Containerization (Coming Soon)

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18 or higher)
  • Bun (for backend) - Install Bun
  • PNPM (for frontend) - Install PNPM
  • PostgreSQL (v14 or higher)
  • Git

Installation

1. Clone the Repository

git clone https://github.com/idityaGE/sih-project.git
cd sih-project

2. Setup Backend

# Navigate to backend directory
cd backend

# Install dependencies
bun install

# Copy environment variables
cp .env.example .env

# Configure your .env file with:
# - Database connection URL
# - JWT secrets
# - Blockchain RPC URLs
# - Private keys (for development only)

3. Setup Database

# Start local development database
bun run db:dev

# Run database migrations
bunx prisma migrate dev --name init

# Open Prisma Studio (optional - database GUI)
bun run db:studio

4. Setup Blockchain

# Start local Ethereum node (in a new terminal)
anvil

# Deploy smart contracts (in another terminal)
cd ../blockchain
forge build
forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast

5. Start Backend Server

cd ../backend
bun run dev

The backend server will start on http://localhost:8080

6. Setup Frontend

# Navigate to frontend directory
cd ../frontend

# Install dependencies
pnpm install

# Copy environment variables
cp .env.example .env.local

# Configure your .env.local with:
# NEXT_PUBLIC_API_URL=http://localhost:8080

7. Start Frontend Development Server

pnpm dev

The frontend will start on http://localhost:3000


πŸ“± Usage

For Farmers

  1. Register on the platform as a FARMER
  2. Create new batch records for harvested produce
  3. Add details: product name, quantity, harvest date, pricing
  4. Transfer batches to distributors/retailers

For Distributors/Retailers

  1. Register as DISTRIBUTOR or RETAILER
  2. Receive batch transfers from farmers
  3. Update batch status during transit
  4. Transfer to next stakeholder in the chain

For Quality Inspectors

  1. Register as QUALITY_INSPECTOR
  2. Access assigned batches for inspection
  3. Add quality reports and grades
  4. Attach verification certificates

For Consumers

  1. Scan QR code on product
  2. View complete supply chain history
  3. Verify product authenticity
  4. Check quality reports and pricing

🎯 Roadmap

Phase 1: Core Platform βœ…

  • User authentication & authorization
  • Batch creation and management
  • Blockchain integration
  • Basic supply chain tracking

Phase 2: Enhanced Features (In Progress)

  • QR code generation and scanning
  • Quality inspector workflow
  • Advanced analytics dashboard
  • Multi-language support

Phase 3: AI Integration (Planned)

  • Harvest image validation
  • Invoice verification
  • Fraud detection system
  • Predictive analytics

Phase 4: Mobile & Scale (Future)

  • React Native mobile app
  • Offline mode support
  • Cloud deployment
  • Performance optimization

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“ž Contact

For any queries or support, please reach out:


πŸ™ Acknowledgments

  • Government of Odisha - For problem statement and support
  • Electronics & IT Department - For guidance and mentorship
  • SIH 2025 - For providing the platform
  • Polygon - For blockchain infrastructure
  • All open-source contributors

About

A decentralized platform that tracks agricultural produce through the entire supply chain, ensuring transparency in pricing, quality, and origin verification.

Resources

Stars

Watchers

Forks