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."\nThis problem highlights the dangers of modern supply chains. They help lower costs and improve business efficiency, but they\u2019re 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\u2019re in transit or stored in a warehouse?\nIoT 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.\nBackground\nProducts need to be tagged at the source with the manufacturer\u2019s 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\u2019s like tracking your FedEx shipment but much more complex given:\n\nThe large number of products flowing through the supply chain\nMultiple parties involved in the manufacture, processing and transportation\nFluctuating temperature conditions in a truck and delayed shipments\nExcessive 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?\n\nBlockchains\nManually tracking the production and delivery of shipments isn\u2019t feasible as the number of suppliers and shipment volumes have exploded. What\u2019s 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:\n\nHyperledger Fabric is a widely used, open source blockchain implementation from the Linux Foundation. It\u2019s 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.\nSmart 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.\nPeer 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.\nOrderer nodes ensure the consistency of the blockchain and deliver the endorsed transactions to the peers of the network. They authenticate the supply chain\u2019s 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.\n\nHow Oracle applies IoT and blockchains\nManaging 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\u2019s how Oracle does it:\n\nPartners and sensors are first certified and authorized to access and update the blockchain simplifying the process of setting up a new integrated supply chain.\nThe 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.\nThen, data is collect from the disparate systems and partners in a cloud based blockchain. This digital thread records the data relating to an item\u2019s entire lifecycle \u2014 from production to consumption.\n\nHow sensor readings get reflected in a blockchain\nSensors don\u2019t 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.\nReacting in real time\nAs the volume of transactions and the cost a disruption in a supply chain increase, it\u2019s crucial that corrective action and product recalls happen quickly. Oracle\u2019s 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 \u2018learn\u2019 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.\nIntegrated IoT\u2013blockchain 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.