Skip to content

🚚 ❄️ Quality Assurance for Cold Chain Networks using Blockchain and IoT with Optimal Routing

License

Notifications You must be signed in to change notification settings

karthiknmenon/ColdBlocks

Repository files navigation

ColdBlocks

Netlify Status

Run in Postman
🚚 ❄️ 🌡️

Problem Statement

Cold Chain Logistics company lack the an organised system for Quality Assurance and Tracking which provides real time data availability and end-to-end data transparency. End Consumers have no means of determining the quality of the product during transportation and have to rely on expiry date mentioned on the product.

Solution

ColdBlocks is a product that enables secure transactions in a cold chain network using blockchain. It provides real time data availability and end to end transparency using IoT, the goal of the product is to allow the cold chain network to carefully check the status of the product during transportation and to maintain a secure log of transactions. It also allows the end consumers of the product to check if the product was transported in optimal temperature during transportation or not.

Specification

ColdBlocks is a decentralized record management system to store electronic transaction records giving priority to the Quality Assurance (QA), security and real time data availability. It aims to enhance the working of the current cold chain network.
ColdBlocks is based on the following technologies -

  • IoT Using temperature sensors and GPS sensors along with node MCU ESP8266 module to provide WiFi connectivity. The data from these sensors is sent directly to a remote server.
  • Blockchain Blockchain is used for Quality Assurance of the product being transported in cold storage. Every package is associated with a threshold temperature, if the temperature in which the consignment is being transported overshoots the threshold temperature, then the status of the product is updated to "0" which means it's tampered.
  • coldAR Status Check for customers by just scanning a qr-code.
  • Route Optimization Route Optimization is based on VRP is implemented using Python and Google or-tools, Gooogle Maps API and Google Directions API.
  • Progressive Web App using angularJS and reactJS for admin and other actors of the use case.
  • Android App for QR-Code scanning. ColdBlocks was developed as part of our final year project during B.tech.
Say Hi to our contributors -
     Karthik Menon 💻 🐛 🚀
     Denil John Titus 📖 📂
     Jim Thomas 💻 📊
     Kevin Thomas 🔌 📖

Hardware Requirements

  • nodeMCU ESP8266 Module for Wifi Connectivity
  • DHT22 Temperature Sensor for gathering Temperature Data
  • U-Blox Neo 6M for gathering GPS Data
  • Breadboard, basic connection wires

Software Requirements

    1. Blockchain

  • Version Specifications
    • Hyperledger Composer v0.20.9
    • Hyperledger fabric v1.2
    • Docker version 19.03.1, build 74b1e89
    • npm version - 6.11.3
    • node version - 8.16.1
  • CardName - admin@coldblocks
  • BusinessNetwork - coldblocks
  • Network Version - 1.1.1
  • BNA file - coldblocks@1.1.1.bna
  • Netword Card - networkadmin.card

    2. Back-End

  • nodeJS backend
  • twilio for WhatsApp integration
  • open-cage API for reverse geo encoding of coordinates into location
  • ngrok for public url

    3. Front-End Application

  • PWA using angularJS for admin-UI and reactJS for both admin and authorised users
  • react-google-maps for live mapping of package location on to maps
  • Downloadable and Dynamic QR-Code generator for HolderChange event on admin's login
  • Link : https://colddash.netlify.com

    4. Route Optimization

  • is implemented using Python and Google or-tools, Gooogle Maps API and Google Directions API.
  • The data is then hosted on a port in the machine using Flask
  • Version Requirements
    • Python Version - v3.5.6
    • pip3 Version - v20.0.2
    • Flask Version - v1.1.1
    • Google ortools

    5. AR for Status Check

  • AR.js
  • three.js

Setup and Installation

     To download and setup -
     git clone https://github.com/mojojojo20/ColdBlocks.git
     cd ColdBlocks

    1. composer-rest-server

  • cd coldblocks
    • Use Hyperledger documentation for installation and setup of Hyperledger Composer and Fabric
    • Start the network and install the BNA.
    • Start the composer REST server using, composer-rest-server -c admin@coldblocks -n never -u true -w true
    • To clear test data in development environment, run composer network reset -c admin@coldblocks

    2. node Backend

  • cd coldblocks-nodejs
    • npm install (to install all packages)
    • npm run dev
  • Use ngrok to generate a remote server link
  • Use the generated ngrok URL as nodeURL in reactJS front-end and as the HostURL in hardware code.

    3. angular front-end (UI for admin)

  • cd coldblocks-angular
    • npm install (to install all packages)
    • npm start

    4. react front-end (UI for Suppliers, Manufacturers, Distributors & Consumers)

  • cd coldblocks-react
    • npm install (to install all packages)
    • Change nodeURL in variables.jsx with the new server URL.
    • npm start
    • Basic Auth Credentials -
      • username : admin
      • password : admin
    • Credentials for all other users can be set through the admin login. All passwords are SHA256 encrypted.

    5. coldblocks-AR

  • git clone https://github.com/mojojojo20/ColdBlocks-AR.git
  • cd coldblocks-AR
  • update ngrok link in coldAR index.html file
    • use app to scan QR-code
    • Ok means the product is of optimal quality and Tampered means that the product is not of optimal quality.

    6. Hardware Code -

  • cd coldblocks-hardware
    • Update server link in Hardware Code with latest generated ngrok link for node back-end on port 4000
    • Compile and Upload sketch to nodeMCU ESP8266 module using Arduino IDE

    7. Route Optimization -

  • cd coldblocks-route
    • Requires Google Maps API, Directions API, Google or-tools, python3.7
    • python3 vrp.py
    • curl 127.0.0.1:5000\
    • Path /sendLocation to POST Addresses and path / to GET Optimal Path

Disclaimer Please Note that this is a research project.