Note: This code pattern is currently being updated to focus on IBM Blockchain Platform V2.0.
This pattern addresses the very real problem of the safe delivery of perishable goods (food, medicine, livestock, etc.) that are sensitive to environmental conditions during shipment. Every shipment of perishable goods has thresholds (refrigeration requirements, avoidance of shocks or vibration, etc. ) to protect the goods from contamination or damage. If the shipment exceeds these thresholds, the goods are damaged and might become a health hazard. By recording the details (Where, What, and When) of a shipment that experienced extreme conditions (thresholds specified in the smart contract) developers can verify that the goods were delivered successfully (or not). Then, payment is predicated on successful delivery. Tracking the conditions of the shipment across multiple participants using a blockchain provides verification and trust in these processes. This IBM Code pattern provides an exemplar solution of IoT Asset Tracking via a Blockchain.
You can use this code pattern to track environmental conditions for a food safety supply chain, refrigerated medical supplies, garden plant shipments, or any perishable shipment that are sensitive to the temperature, humidity, vibration, or time. If a cargo needs to be delivered within safe environmental parameters and a safe amount of time, it is extremely valuable to use an IoT Asset Tracking device that combines environmental sensors, calculates its location via GPS, triangulation, or beacons, and then reports its location via Cellular, 5G, Sub1GHz, SigFox, or WiFi networks. When multiple participants, such as farms, manufacturers, processing plants, trucks, ports, ships, distribution centers, consumer retail outlets, are involved in the safe shipment and payment of the cargo, a Hyperledger blockchain can be used to record immutable transactions as the shipment progresses through its delivery journey.
- In the Node-RED Control Panel Dashboard, select the Asset Tracker device, and turn on geolocation reporting and make a call to Particle.io.
- Particle.io calls the Asset Tracker device over the cellular network to activate it.
- Geolocation data is transmitted periodically (interval is set in the Node-RED Control Panel dashboard) to Particle.io.
- Particle.io calls the Google Geolocation Triangulation service and turns cell tower identifier & signal strengths into geolocation latitude/longitude info.
- Particle.io transmits the latitude/longitude coordinates back down to the Asset Tracker device.
- The Asset Tracker device queries the temperature data and then queries the vibration data.
- The Asset Tracker device sends all of the collected sensor data to Particle.io.
- Node-RED listens for the temperature and vibration data that is arriving at Particle.io.
- Node-RED writes the temperature and vibration data to the Hyperledger Fabric Transaction History.
- The Node-RED Dashboard queries the Blockchain Hyperledger Fabric for transaction histories and plots the latitude/longitude, time, and sensor data on a map.
Find the detailed steps for this pattern in the README. The steps will show you how to:
- Configure the Particle Electron Asset Tracker board.
- Set up the Particle Electron toolchain.
- Set up the Watson IoT Asset Tracker program.
- Build a basic IBM Blockchain Hyperledger network.
- Create an IoT starter app in IBM Cloud.
- Open Node-RED and install additional nodes.
- Import a pre-build flow.
- Initialize the flow.
- Control and receive events from Particle.io.
- Write events to the perishable business network blockchain.
- Load blockchain transaction history.
- Build the asset tracking dashboard.