This project leverages blockchain technology to detect and prevent counterfeit drugs within the medicine supply chain. The system provides a secure, immutable, and transparent ledger to track the lifecycle of pharmaceutical products from manufacturers to end consumers. The primary goal is to ensure drug authenticity, enhance patient safety, and combat counterfeit drug trafficking.
- Drug Tracking: Trace the origin and movement of medicines throughout the supply chain.
- Immutable Ledger: Blockchain ensures tamper-proof records of drug transactions.
- Smart Contracts: Automate verification processes to validate drug authenticity.
- Decentralized Storage: Distributed ledger provides transparency and trust among stakeholders.
- Real-time Monitoring: Track shipments and detect anomalies in the supply chain.
The project employs Hyperledger Fabric for its permissioned blockchain network. The components include:
- Manufacturer: Registers drug batches on the blockchain.
- Distributor: Updates location and shipment status.
- Pharmacy: Verifies drug authenticity before distribution.
- Consumer: Scans QR codes to verify the source and authenticity of the medicine.
Before we start, please install the following tools and dependencies:
- Node.js and npm (comes with Node)
- Git
- ganache-cli
- Truffle
- nodemon (install globally with
npm install -g nodemon)
$ ganache-cli -i 5777- Compile the contract:
$ truffle compile- Deploy the contract:
$ truffle migrateInstall all dependencies:
$ npm installTo run the application:
$ nodemon- Manufacturer: 0xa979c826045277fc53eA0CDC71E9E7B3333d71aC
- Wholesaler: 0x7608c8887Bdcd9094Aba725fAfadDeD8fB46a6aA
- Retailer: 0xC752Ac4F151D210623582B3f48fde870DF3dfdAa
- Customer: 0xeFdc965B5a26E9Ca83634BdBf9325cb79D9150F7
- POST /addDrug: Add a new drug to the blockchain.
- GET /verifyDrug/:id: Verify a drug's authenticity using its ID.
- GET /trackDrug/:id: Track the drug's journey through the supply chain.
curl -X POST "https://api.example.com/addDrug" \
-H "Content-Type: application/json" \
-d '{
"drug_id": "12345",
"name": "PainRelief",
"manufacturer": "PharmaCorp",
"batch_number": "PR202410",
"expiry_date": "2026-12-31"
}'{
"status": "success",
"message": "Drug successfully added to the blockchain."
}- Role-Based Access Control (RBAC): Restrict access based on user roles.
- Data Encryption: Secure sensitive information using AES encryption.
- Smart Contract Auditing: Regularly audit smart contracts to identify vulnerabilities.
- Blockchain Framework: Hyperledger Fabric
- Programming Language: Node.js
- Database: PostgreSQL
- Tools: Docker, Kubernetes