By Amitranjan Gantait, Joy Patra, Ayan Mukherjee | Updated June 1, 2017 - Published January 9, 2017
Internet of things (IoT) solutions are being successfully adopted in many different industries, such as healthcare, warehousing, transportation, and logistics. Current centralized, cloud-based IoT solutions may not scale and meet the security challenges faced by large-scale enterprises. The use of blockchain as a distributed ledger of transactions and peer-to-peer communication among participating nodes can solve such problems. This article provides an overview of blockchain-enabled IoT solutions and demonstrates how to use the IBM Blockchain platform for an IoT application in a multi-partner environment.
Blockchain refers to a distributed ledger where a list of transactions is stored in multiple participating servers rather than on a central transaction server. Each participant in the blockchain network is granted access to an up-to-date copy of this encrypted ledger so they can read, write, and validate transactions. Refer to the Related topics for more details on blockchain and how IBM is contributing to developing a blockchain for business.
While the key blockchain usage scenarios are in the financial domain, blockchains have recently gained a lot of attention in IoT solutions. Blockchain can significantly help in achieving the vision of decentralized IoT, facilitating transactions and coordination among interacting devices.
IoT has introduced huge opportunities for businesses and consumers, especially in the areas of healthcare, warehousing, transportation, and logistics. IoT solutions involve a complex network of smart devices, and IoT provides the opportunity to develop new services based on cloud-enabled connected physical devices—from machines and cars to home appliances. There are three main tiers of IBM Cloud-supported IoT solutions, each with specific responsibilities of its own:
While IoT adoption is growing significantly, some key challenges need to be addressed to make IoT solutions scale and support the ever-growing demand for more and more connected devices. IoT solutions must address the security and privacy concerns around these devices and the data they collect. Some of these challenges are:
Blockchain technology and IoT offer a new world of promise, and can be leveraged to address the problems described above. Open-standards-based distributed IoT networks can solve many of the problems associated with today’s centralized, cloud-based IoT solutions, including security, scalability, and cost. For example, connected devices could communicate directly with distributed ledgers. Data from those devices could then be used by smart contracts to update and validate the data and subsequently deliver it to all interested participants in the business network. This would reduce the need for human monitoring and actions, and promote trust in the data generated by the devices. Decentralized blockchain networks can also improve the security of IoT solutions by executing predefined smart contracts and implementing specific consensus mechanisms that eliminate actions from compromised devices.
The IBM Watson IoT Platform now supports the use of IBM Blockchain services for IoT applications. Data from IoT devices can now be integrated with the private blockchain ledgers and shared transactions with high security. The blockchain’s distributed replication mechanism eliminates the need to have all IoT data collected and stored centrally, and enables the use of the IoT data in a decentralized way.
The combination of IoT and blockchain is creating a lot of new possibilities for using smart devices in the asset management cycle. As assets go through the various phases of their lifecycle, devices monitor different aspects and integrate the data from the assets into a blockchain of the business participants to provide real-time, trusted data. With blockchain’s smart contracts, rules can be created to monitor and control the temperature of a building based on the consumption of energy and price information of the energy from suppliers participating in the network. Similarly, the quality (and price) of the food items can be determined based on the real-time refrigeration data used in transportation. IBM (along with Samsung) demonstrated the use of blockchain in autonomous washing machines that can reorder detergent and replacement parts, and arrange for after-sales service using smart contracts.
Several consortiums (such as Chain of Things) and start-up companies (such as Filament) have demonstrated other smart ways of leveraging distributed ledgers in IoT networks to automate the end-to-end processes and integration with business participants. The table below lists some blockchain-based IoT use cases for different industries:
Figure 1 shows the high-level architecture of IoT applications that use IBM Cloud-based Hyperledger services.
Data from devices are sent to Watson IoT Platform using MQTT protocol. Blockchain proxy in the Watson IoT Platform sends the data to the chaincode based on a pre-defined configuration. Smart transactions are executed in IBM Cloud based on the device data.
Individual components are described in the next section.
IBM Blockchain provides the private blockchain infrastructure for developing blockchain-enabled solutions. The Blockchain service is an implementation of Hyperledger Fabric. It provides the following:
Figure 2 shows the different subcomponents of the IBM Blockchain services.
Smart contracts form the core of blockchain-based solutions and encapsulate the business logic. Each invocation of a smart contract is recorded as a blockchain transaction. IBM Blockchain contracts (chaincode) are developed using the Go language and need to implement the Contracts API. Smart contracts need to be registered with blockchain services using pre-defined APIs.
Contract API needs to be implemented by a smart contract developer. It has three main functions: Init(), Invoke(), and Query(). Refer to the IBM Cloud documentation for more details about this API.
Blockchain API is the client API for blockchain applications. The Hyperledger Fabric Client (HFC) SDK enables application developers to build Node.js applications that interact with a blockchain network. Applications can securely register users and submit transactions using this API.
There are several alternatives to developing client applications for blockchain:
The blockchain REST API helps to interact with the blockchain peers using the http interface. A list of supported operations is shown in the table below:
IBM-Blockchain-js is a Node.js wrapper library over the REST API that’s provided by Blockchain services. It provides functions in the easy-to-use Node.js API that are similar to those available in the REST API.
The client application is responsible for providing the required data to stakeholders to meet their business needs and provide a rich user experience. Client applications need to use the blockchain API as provided for the smart contracts to interact with the business ledger. These applications can also process the events generated by the blockchain components.
The IBM Watson IoT Platform receives data from all of the registered devices and processes that data into the required format for integration with blockchain. This means the blockchain contract developer doesn’t need to know the details about the source of the data, and can focus on developing the contract logic.
Figure 3 shows the key steps in developing a blockchain-enabled IoT application using the IBM Watson IoT Platform and Blockchain services. Developers need to have several skills to develop end-to-end IoT applications using these services.
Here’s a brief overview of each step in the process:
Developers need to set up a private blockchain based on the IBM Blockchain service. Refer to the IBM Cloud documentation on setting up private blockchain services.
Develop and deploy smart contracts in blockchain based on device data. A contract can be set up to reject a shipment or reduce a price if the temperature of the container (measured by sensors) exceeds a certain threshold.
Connect the sensors / gateway to the Watson IoT Platform. This will enable the devices to send data to filter / aggregate and subsequently forward to the blockchain. Follow the documentation to add the devices to the Watson IoT Platform. When successfully added, the Devices page on the Watson IoT dashboard will look like this:
Once the device data is received, either the incoming raw data or filtered/analyzed data need to be sent to the Blockchain service running in IBM Cloud. Blockchain smart contracts can be triggered using the HFC REST API from the Node-RED workflow. Node-RED can also be used to aggregate and/or filter device events and invoke the smart contracts with the required parameters.
The final step is to make the transaction outputs / events available for the end users. A client application can be developed using the blockchain API (as mentioned in the previous section) and other analytical services using multiple languages / platforms supported by IBM Cloud.
As you can see, there is huge potential for developing applications using blockchain in IoT solutions, and this combination can solve some of the key problems that limit adoption of IoT, such as security and scalability. A distributed ledger with embedded smart contracts can improve security and trust, and automate complete processes comprised of multiple business partners. The IBM Watson IoT Platform can be combined with IBM Cloud-based Blockchain services to provide a ready-to-deploy platform for blockchain-based (and open-standards-based) IoT applications.
There are, however, a few challenges that need to be overcome. One of the key challenges of blockchain-based IoT applications is the limited computing power of many IoT devices. Encryption and verification of blockchain transactions can require considerable processing power, which may not be available in low-end devices. And use of more processing power can increase both the energy consumption and the cost of the solution.
In Part 2 of this article, we will demonstrate the integration of the IBM Watson IoT Platform with IBM Blockchain services to develop an application that uses (simulated) vehicle and V2V sensor data to execute smart transactions in IBM Blockchain.
June 7, 2019
May 6, 2019
September 23, 2019
Back to top