Skip to content

ThisIs-Developer/MediChain

Repository files navigation

MediChain: Blockchain-Based Pharmaceutical Supply Chain Management

License Build Status Version Ethereum Solidity


⚙️ Overview

MediChain is a secure, transparent, and efficient blockchain-based system that transforms pharmaceutical supply chain management. Built on Ethereum, this solution provides end-to-end traceability of medical products from manufacturers to patients, eliminating counterfeit drugs and ensuring patient safety.


✨ Features

  • 🔒 Secure Drug Registration: Immutable blockchain ledger for manufacturers
  • 🔁 Automated Ownership Transfer: Smart contract-based secure handovers
  • 🧭 State Management: Track medicine journey from production to sale
  • 📱 QR Code Verification: Instant authentication with a simple scan
  • 🏛️ Decentralized Architecture: No single point of failure
  • ⏱️ Real-Time Tracking: Monitor the movement of medicines live

🛠️ Tech Stack

  • Blockchain: Ethereum (Private Network), Solidity
  • Frontend: HTML, CSS, JavaScript
  • Web3 Integration: MetaMask, Web3.js
  • Smart Contracts IDE: Remix IDE

🏗️ System Architecture

MediChain consists of three integrated layers:

1️⃣ Blockchain Network

  • Private Ethereum blockchain as the foundational database
  • Solidity smart contracts for business logic automation
  • Immutable record-keeping with timestamped transactions

2️⃣ Client Communication Layer

  • Web3.js for blockchain connectivity
  • User interfaces for stakeholder interactions
  • MetaMask integration for secure authentication and transaction signing

3️⃣ Application Layer

  • HTML-CSS-JavaScript frontend interface
  • QR code integration for product verification
  • Real-time tracking dashboard

Architecture Diagram


🧩 Key Modules

🔗 Smart Contract Operations

Smart contracts written in Solidity handle:

  • addMedicine() – Register medicines with full traceability
  • purchaseMedicine() – Buy securely with automatic ownership transfer
  • updateMedicineState() – Update lifecycle state (e.g., Manufactured, In Stock, Sold, Expired)
  • getMedicine(), getMedicineState() – Retrieve real-time product and status info

🖥️ Dashboard

  • Clean, professional interface modeled after modern commerce platforms
  • Track:
    • 🧾 Order history
    • 💊 Total drugs registered
    • 📦 Total stock across batches
    • 🏷️ Total units sold
  • Manufacturer insights, quantity analytics, and QR-based lookup tools

🔍 Track Medicine

  • Search by medicine ID to view:
    • 🧬 Batch metadata
    • 🏭 Manufacturer identity
    • ⏳ Lifecycle state and timestamps
    • 👤 Current owner in the supply chain
  • One-click Verification Report generation for regulators or consumers

🛒 Buy Medicine

  • 🔎 Live search and filter system
  • 💳 Detailed product cards with dynamic pricing
  • ✅ Integrated blockchain validation before purchase
  • ⚡ Smooth transaction flow with MetaMask authentication

👥 User Management

  • Register as:
    • 🏭 Manufacturer
    • 🚚 Distributor
    • 🏪 Pharmacy
  • Role-based login with Ethereum identity
  • All interactions are cryptographically signed

🖼️ Screenshots

🧾 Dashboard Overview
Dashboard
Dashboard

🔍 Track Medicine
Track Medicine

🛒 Buy Medicines
Buy Medicine
Buy Medicine


⚡ Performance

Optimized for speed and cost-efficiency:

  • 🚀 Transaction Speed: Avg. 100ms response under 500 concurrent users
  • Gas Optimization: Lower costs via optimized smart contracts
  • 📈 Scalability: Supports thousands of participants and millions of transactions
  • 🔐 Security: Multi-layer protection against unauthorized access

🚀 Future Enhancements

  • 📊 Advanced Analytics: ML-powered risk prediction
  • 🔗 Cross-Chain Integration: Interoperability with other networks
  • 📡 Expanded Verification Methods: NFC and RFID support

👨‍💻 Contributors


📄 License

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