IoT + Hyperledger Development from scratch within 21 days — Day 4

Davor Kljajic
7 min readApr 4, 2019

--

Hello everybody! In the previous article IoT + Hyperledger Development from scratch within 21 days — Day 3 we wrote about real-world examples that are developed on Hyperledger Fabric. In this article, we’ll describe how to design the architecture of Hyperledger Fabric solution for the logistics industry which we will develop in this series.

We will also define the problems that logistics industry faces currently, and in the end define primary goals and objectives that need to be achieved if we want to solve those problems with Hyperledger Fabric.

Understanding the problems

The first problem in the logistics industry is that processing and administration costs have risen up, and now they account for as many as 20% of transportation’s overall costs due to over-reliance on paper transactions.

The second problem is the fact that 8.5% of sensitive pharmaceutical shipments have been exposed to temperature deviations. Those products never make it past customs because they exceed the acceptable temperature ranges.

The third problem is that many transportation companies are wary of load boards because data can often get muddled or duplicated, providing an unreliable representation of demand.

The fourth problem is inefficiency. As many as 90% of trucking companies worldwide have six trucks or fewer. This causes the industry to struggle with matching shippers (the demand) with carriers (the supply). Also, an important fact to remember is that truckers drive 29 billion miles per year with partial or empty truckloads.

Trucking companies are losing millions of dollars every year due to this inefficiency. It also raises the shipping costs for consumers.

Goals

There a list of goals that we want to achieve in our series:

  1. Ensuring secure, authentic and immutability of data across the transportation and logistics ecosystem and also prevent unauthorized data modification, to build trust between parties.
  2. Creating a common view to prevent corruption and streamline the data with traceability and transparency in the real-time over IoT devices
  3. Enhance the possibilities and opportunity to tackle time-critical issues be automatizing the process with self-executing tasks

Objectives

To tackle our goals we will need a process where we can replicate above said. For that purpose, we will create a process with four parties involved: Buyer, Logistics, Regulator, and Seller.

The whole process is simplified so that when a buyer creates the order everybody in the network knows that the order is created. The seller gets the order and puts the asset into the container. Logistics company delivers the goods to the buyer. And regulator will be notified (without possibilities to manipulate the data) if the critical event occurs.

During transportation, the logistics will not be able to see any data related to order except coordinates and location, while a customer will be able to monitor the goods in real time.

Logistics process with blockchain network and IoT

Objective 1:

Create the blockchain network to support user and device authentication and identification within four organizations to enhance the process and move regulations insight into real-time

Objective 2:

Using the IoT devices for data context generation without any human touch to monitor the process from the beginning until the end of delivery.

Objective 3:

Create an event-based notification system to alarm required parties when something critical occurs and monitor the reaction time, to enhance reactivity.

Let’s take a look at how we can address our objectives with Hyperledger Fabric components:

1. Connect organizations into a private ecosystem which they will operate

Creating the blockchain network developed on the Hyperldger Fabric.

Network name: iot-logistic

Organizations:

  • Buyer
  • Logistic
  • Seller
  • Regulator

Orderer: iot-orderer (solo orderer)

All organizations will have two peers. They will be connected in the consortium called Logistics, and they will communicate through a channel called logistics_channel. The role of the orderer is to distribute messages within the network.

2. Authenticate and authorize each participant in the network

In our network we have multiple organizations/members involved, so we need to have a mechanism for each organization to create users for it cryptographically and to validate the user transactions.

Every blockchain solution is based on cryptography. All members/users in its organizations are created with a cryptographically encrypted key which will be validated by the blockchain network to participate in the network. This module is called the Membership Service Provider.

In each organization in our network, we will have one Central Authority. Its job will be to dispense and issue certificates.

Central authorities

  • ca_buyer
  • ca_seller
  • ca_logistic
  • ca_regulator

In our next articles, we will provide more information about this theme, also to get some idea you can check article day 2 :).

3.Ensures trustworthy data across the transportation and logistics ecosystem

As we said in previous articles, we do not have the central authority for transaction validation, but a policy called “Endorsement Policy”.

The main role of “Endorsement Policy” is to define which of the participants (Organizations) must endorse a transaction. I will demonstrate how everybody in the network must know that order and transaction are created.

{
"identities": [
{ "role": { "name": "member", "mspId": "RegulatorMSP" }},
{ "role": { "name": "member", "mspId": "BuyerMSP" }},
{ "role": { "name": "member", "mspId": "LogisticMSP" }},
{ "role": { "name": "member", "mspId": "SellerMSP" }}
],
"policy": {
"4-of": [{ "signed-by": 0 }, { "signed-by": 1 },{ "signed-by": 2},{ "signed-by": 3}]
}
}

This policy will succeed if a transaction is signed by members from Regulator, Logistic, Seller and Buyer organizations. That’s how we make sure that each participant in the network knows that order is created.

4. Using The Internet Of Things (IoT) throughout the logistics process

Using IoT sensors in trucks and other shipping vehicles, shippers and transportation companies can detect the amount of space taken up in a shipment and determine cost accordingly, or in our case, they can monitor temperature, humidity, and location, and transmit information to the blockchain, respectively into a ledger.

To achieve this all IoT solutions have 4 stages:

stages_of_iot_solutions

In stage one sensors collect the data from the physical environment (temperature, humidity, etc.) The main task at stage two is that Internet getaways first collect the data from sensors and that the data is then digitized and aggregated. Edge IT systems perform enhanced analytics and pre-processing, for example, machine learning and visualization happen in stage three. The last stage of IoT architecture happens in the data center or cloud. Precisely, it enables in-depth processing, along with a follow-up revision for feedback.

IoT sensors will create transactions into blockchain network, and that way we will have an immutable, secure record of all documentation throughout the logistics process. We’ll also maintain the integrity of the valuable product that is being transported without human touch.

If you want to make a transaction in the blockchain network, you must have associated certificates and we will register the sensor as a user in the network and with that in mind, we have a blockchain managing IoT devices. Isn’t that cool?

5. Increase efficiency with smart contract

By using blockchain, smart contracts could completely eliminate the need for all of these administrative steps, cutting costs and virtually removing all possibilities for error.

In our smart contract, we will demonstrate how to convert business logic from the real world to program and thus automatize the whole logistic process based on our example.

As it’s said earlier, we have a group of four organizations on the same channel where some data must be private, like temperature and humidity. We will show how to achieve this with Hyperledger Fabric feature called “ Private Data” where the actual private data is being sent peer-to-peer via gossip protocol, but only to the organization(s) authorized to see it.

Challenges

In all IoT project security and privacy concerns must be a top priority. The number of connected devices is going to reach 26 billion by 2020, therefore the number of potential attack points is staggering. Human labor will be needed for successful IoT integration, a lot of great data scientist and a lot of their time.

Another challenge is that IoT sensors generate tons of data, and the question arises: ‘Where to store this data?’. There are also data privacy concerns: ‘Is my data secure or can my competitor do espionage? Who owns the data? Am I allowed to track an asset or does this tracking indirectly also track human beings, for example, the truck driver?’

In this series, we want to solve and challenge IoT device management and provisioning with blockchain. We also want to create a connection form the IoT devices to the blockchain trough access point and proxy to simulate real-world example.

Conclusion

To have a clear picture of Hyperldger Fabric, it is important to understand both the business and technical side. The main objective is to improve and optimize existing business processes. The reason why we use the logistics process is that it’s the best way to show how IoT+Blockchain can add value to the business processes by generating data and storing it in an immutable and secure way.

In the next article, we will show how to set up the development environment.

See ya in the next article very soon! Here you can check our previous articles:

  • Day 1.
  • Day 2.
  • Day 3.

Work with Beyondi

Beyondi offers high-quality services: Web Development and Design, Mobile Development and Design, Embedded Solutions, Blockchain Solutions, and Team Augmentation? You can find more about our services on our website.

--

--