Supply chain track and trace

Azure IoT Hub

Solution ideas

This article is a solution idea. If you'd like us to expand the content with more information, such as potential use cases, alternative services, implementation considerations, or pricing guidance, let us know by providing GitHub feedback.

A common blockchain pattern is the IoT-enabled monitoring of an asset, as it moves along a multi-party supply chain.

Architecture

Architecture diagram shows I O T devices to hub; data from message broker to transaction builder then Blockchain to Event Grid for use by consumers. Download an SVG of this architecture.

IoT devices communicate with IoT Hub. IoT Hub as a route configured that will send specific messages to a Service Bus associated with that route. The message is still in the native format for the device and needs to be translated to the format used by Azure Blockchain Workbench.

An Azure Logic App performs that transformation. It's triggered when a new message is added to the Service Bus associated with the IoT hub, it then transforms the message and delivers it to the Service Bus used to deliver messages to Azure Blockchain Workbench.

The first service bus effectively serves as an "Outbox" for IoT Hub and the second one serves as an "Inbox" for Azure Blockchain Workbench.

Dataflow

  1. IoT devices communicate with IoT Hub. IoT Hub as a route configured that will send specific messages to a Service Bus associated with that route. The message is still in the native format for the device and needs to be translated to the format used by Azure Blockchain Workbench. An Azure Logic App performs that transformation. It's triggered when a new message is added to the Service Bus associated with the IoT hub, it then transforms the message and delivers it to the Service Bus used to deliver messages to Azure Blockchain Workbench. The first service bus effectively serves as an "Outbox" for IoT Hub and the second one serves as an "Inbox" for Azure Blockchain Workbench.
  2. DLT Consumer fetches the data from the message broker (Service Bus) and sends data to Transaction Builder - Signer.
  3. Transaction Builder builds and signs the transaction.
  4. The signed transaction gets routed to the Blockchain (Private Ethereum Consortium Network).
  5. DLT Watcher gets confirmation of the transaction commitment to the Blockchain and sends the confirmation to the message broker (Service Bus).
  6. DB consumers send confirmed blockchain transactions to off-chain databases (Azure SQL Database).
  7. Information analyzed and visualized using tools such as Power BI by connecting to off-chain database (Azure SQL Database).
  8. Events from the ledger are delivered to Event Grid and Service Bus for use by downstream consumers. Examples of "downstream consumers" include logic apps, functions or other code that is designed to take action on the events. For example, an Azure Function could receive an event and then place that in a datastore such as SQL Server.

Components

  • Application Insights: Detect issues, diagnose crashes, and track usage in your web app with Application Insights. Make informed decisions throughout the development lifecycle.
  • Web Apps: Quickly create and deploy mission critical web apps at scale
  • Storage Accounts: Durable, highly available, and massively scalable cloud storage
  • Virtual Machines: Provision virtual machines for Ubuntu, Red Hat, and more
  • Microsoft Entra ID: Synchronize on-premises directories and enable single sign-on
  • Azure SQL Database is a relational database service that lets you rapidly create, extend, and scale relational applications into the cloud.
  • Azure Monitor: Highly granular and real-time monitoring data for any Azure resource.
  • Service Bus: Connect across private and public cloud environments
  • Event Grid: Get reliable event delivery at massive scale

Scenario details

Potential use cases

A great example of this pattern is the refrigerated transportation of perishable goods like food or pharmaceuticals where certain compliance rules must be met throughout the duration of the transportation process. In this scenario, an initiating counterparty (such as a retailer) specifies contractual conditions, such as a required humidity and temperature range, that the custodians on the supply chain must adhere to.

At any point, if the device takes a temperature or humidity measurement that is out of range, the smart contract state will be updated to indicate that it's out of compliance, by recording a transaction on the blockchain and triggering remediating events downstream.

Deploy this scenario

Next steps