The U.S. Centers for Disease Control and Prevention recently advised "consumers to throw away any store-bought romaine lettuce and warned restaurants not to serve it amid an E. coli outbreak that has sickened more than 50 people in several states."

This problem highlights the dangers of modern supply chains. They help lower costs and improve business efficiency, but they’re complex and a single failure can sicken people thousands of miles away. The food we eat and the medicines we use come from remote suppliers, transported in refrigerated trucks, and stored in different warehouses. How can perishable commodities be tracked from suppliers to customers? How can the temperature conditions during shipment be monitored to avoid contamination? How can spoilt products be quickly recalled even if they’re in transit or stored in a warehouse?

IoT sensors and blockchain have the potential to protect supply chains, identify where the contamination occurred and expedite product recalls. The solution is complex and involves multiple parties, just like the problem to be solved.

Background

Products need to be tagged at the source with the manufacturer’s info along with the time and location. Low cost RFID tags and barcodes make this feasible for the millions of products. A bigger challenge is tracking an item as it moves through the supply chain - from manufacturer, transporter, warehouse and finally to the store. It’s like tracking your FedEx shipment but much more complex given:

The large number of products flowing through the supply chain Multiple parties involved in the manufacture, processing and transportation Fluctuating temperature conditions in a truck and delayed shipments Excessive time spent in warehouses that may cause spoilage to sensitive products and in the event that a product (like a batch of lettuce) has been contaminated, how can other shipments in transit be identified and recalled?

Blockchains

Manually tracking the production and delivery of shipments isn’t feasible as the number of suppliers and shipment volumes have exploded. What’s needed is an automated system to record and enforce transactions. It has to be trusted, irreversible and accessible by different suppliers, transporters and distributors involved in the supply chain. An ideal blockchain application. Here are the components:

Hyperledger Fabric is a widely used, open source blockchain implementation from the Linux Foundation. It’s used to record and share information between members in the supply chain. For instance when a batch of lettuce leaves the warehouse, sensors on a truck will record it along with the time and location as well as the temperature in the truck. Smart Contracts (also called "chaincode") are a means to digitally facilitate, and enforce the performance of a contract. They allow the performance transactions without third parties and are trackable and irreversible. A Smart Contract may record that the truck delivered the batch of lettuce to a warehouse at a given time and location. Peer nodes in the Fabric Network execute chaincode, access ledger data, endorse transactions and interface with applications. So for instance a retailer may have an application that can query the ledger to check on the status of their lettuce shipments. Orderer nodes ensure the consistency of the blockchain and deliver the endorsed transactions to the peers of the network. They authenticate the supply chain’s member identity and roles. A transporter is first authenticated by a digital certificate by an order node before it can update the fabric with delivery details.

How Oracle applies IoT and blockchains

Managing a mission critical supply chain is daunting. The infrastructure has to support dozens of vendors using different software applications processing millions of transactions generated by both apps and sensors. Here’s how Oracle does it:

Partners and sensors are first certified and authorized to access and update the blockchain simplifying the process of setting up a new integrated supply chain. The process starts by monitoring the production line to detect anomalies and ensuring quality control. As this takes place, it is also continuously tracking goods moving through the supply chain including driver and vehicle conditions. Then, data is collect from the disparate systems and partners in a cloud based blockchain. This digital thread records the data relating to an item’s entire lifecycle — from production to consumption.

How sensor readings get reflected in a blockchain

Sensors don’t write to blockchain directly. Sensors handle basic functions such as sense and report. The logic to decide whether and how to sensor readings are handled by a separate application. Oracle IoT Apps decide at the business logic layer which sensor readings should be written to the blockchain. This is a more scalable and practical approach rather than adding logic to individual IoT sensors.

Reacting in real time

As the volume of transactions and the cost a disruption in a supply chain increase, it’s crucial that corrective action and product recalls happen quickly. Oracle’s autonomous cloud uses artificial intelligence (AI) and machine-learning (ML) algorithms, to reduce risk and get predictive insights. For instance a system can be trained to ‘learn’ the usual amount of time and temperature conditions inside a delivery truck. It can then detect anomalies in a delivery and flag that shipment for inspection as the items being transported may have deteriorated in transit.

Integrated IoT–blockchain systems are evolving as they get deployed. But thanks to Oracle, the Linux Foundation, IBM and other providers, we should be able to eat lettuce with confidence.