Enriching IoT data
To improve data visibility, data security, and data analysis options, you can integrate IoT data with non-IoT data and write the data to the blockchain.
For example, in a supply chain scenario where temperature-sensitive goods are shipped across the country, an IoT device might track container temperature but not the ID of the shipment. If the shipment exceeds the permitted temperature, you might need to look up multiple records to identify the shipment ID that corresponds to the sensor reading. This searching wastes valuable time, decreases visibility across multiple parties, and increases the risk for data loss.
With IoT Blockchain Service, you can enrich IoT data with non-IoT data by using Node-RED or a contract to merge the two data types based on a correlation parameter. In the supply chain example, the correlation parameter might be the IoT device ID. The device ID is recorded with other non-IoT data, such as the shipment ID, and is used to enrich the IoT data, such as temperature and location. By correlating the data this way, you can match and merge separate data sets and store them in a blockchain.
Important: It is likely that not all IoT data needs to be written to blockchain. Only certain events might be deemed important enough to warrant storage in the blockchain, for example if a shipment exceeds the permitted temperature. You can use Watson IoT Platform Service logical interfaces to update only on state change.
The IoT Blockchain Service event enrichment solution is described in more detail in the following sections.
Enriching IoT events with Node-RED
The following high-level IoT Blockchain Service event enrichment solution uses Node-RED as a connection point between the IoT data and the non-IoT data.
Tip: A Sample data enrichment Node-RED flow is available on GitHub. Follow the instructions in the information nodes that are included with the flow to modify this component to fit your environment.

Use the following high-level flow as a template for implementing the Node-RED data enrichment scenario in your environment.
- A company stores non-IoT shipment data in a database.
In this case, the shipment data includes shipment names, shipper names, container IDs, and the device IDs of temperature sensors. - An IoT device sends IoT data to Watson IoT Platform Service.
The data includes a temperature reading, location information, and a device ID. - A Node-RED application subscribes to Watson IoT Platform Service for IoT sensor data.
- The Node-RED application requests non-IoT data from the shipment database.
The application uses the device ID to request non-IoT data from the shipment database. The device ID is a correlation parameter and is common to both sources of data. - The Node-RED application creates an asset in IoT Blockchain Service.
The application combines sensor data, which is IoT data, and shipment data, which is non-IoT data, into an asset in accordance with the contract definition. - IoT Blockchain Service sends a transaction with the IoT and non-IoT data to IBM Blockchain Platform.
The transaction is stored as an IBM Blockchain Platform block. - The IoT Blockchain Service sends an enriched IoT event to a supply chain application as a notification of the success of the transaction and includes the transaction data.
Enriching IoT events with contracts
The following high-level event enrichment solution uses a contract as a connection point between the IoT data and the non-IoT data.
Tip: An IoT data enrichment sample contract is available on GitHub. Follow the instructions in the contract to modify this component to fit your environment.

Use the following high-level flow as a template for implementing the contract-based data enrichment scenario in your environment.
- A custom application sends shipment data to IoT Blockchain Service to create a shipment information asset.
The shipment data includes shipment names, shipper names, container IDs, and the correlation parameter device IDs of temperature sensors. IoT Blockchain Service creates a shipment information asset that includes the data in accordance with a contract. - An IoT device sends IoT data to Watson IoT Platform Service.
The sensor data includes a temperature reading, location information, and a device ID. - Watson IoT Platform Service sends the IoT data to IoT Blockchain Service.
The data includes the device ID correlation parameter. - IoT Blockchain Service sends a transaction that contains the IoT data to IBM Blockchain Platform.
The contract searches non-IoT shipment information assets by using the device ID correlation parameter. The matched IoT data and non-IoT data are merged to create an enriched asset in accordance with a contract. The enriched asset is stored in the blockchain. - IoT Blockchain Service sends an enriched IoT event to a supply chain application as a notification of the success of the transaction and includes the transaction data.