Skip to content

nulltea/chainmetric-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chainmetric: Client Application

dart badge  flutter badge  android badge  commit activity badge  license badge

Overview

Chainmetric Client Application provides a convenient visual user interface for interacting, managing, and monitoring assets stored on permissioned IoT-enabled blockchain as a part of supply-chain control needs.

A cross-platform application written with the help of the Flutter framework provides a way to input assets to the ledger, assign requirements of storing and delivering such assets, monitoring environmental metric readings sourced by IoT sensor-equipped devices and validated by blockchain network's Smart Contracts.

screenshots

Tradeoff

Chainmetric application is written using the Flutter UI development framework, which provides a convenient way of crafting fast user experiences for mobile, web, and desktop from a single codebase. Its programming language Dart has build-in support for declarative UI and its massive widget catalog makes Flutter a pretty hot alternative to native mobile development and other hybrid frameworks like React Native or Ionic Angular.

However, Flutter is still a young technology and its dedicated programming language may not have alternatives for some packages that may be crucial for the project. And that is exactly the tradeoff with the Chainmetric project since its blockchain network is built upon Hyperledger Fabric stack, which currently does not support client SDK for Dart (only Go, Python, NodeJS, and Java).

So, the available options here are to skip Flutter in favor of native development, try to use JS-based frameworks like React Native, or even implement own SDK on Dart, which actually is not that complicated, since foremost it uses common gRPC protocols communication.

Thankfully, there is one more option that happens to be ideal for this project, which implies binding Golang-written SDK using gomobile utility to mobile native languages, which in this case are Kotlin for Android, and Swift for iOS, and then use call this native functionality from Dart codebase using Method Channel. Even though this approach seems too complicated at the first glance, it is actually pretty straightforward and works just fine.

See details in Lorkhan readme.

Features

Asset and requirements management

Application allows supply chain participants to manage their assets: register them, transfer ownership, view changes history, etc.

Requirements for conditions in which such assets must be stored and transported during supply operations are also can be assigned, changed, and revoked without leaving app.

IoT devices management

IoT devices are essential for Chainmetric solution, they provide continuous flow of sensor reading from where the assets are located.

Application provides extensive functionality to manage such devices, register them, monitor their activity, transfer ownership, control and send remote commands.

devices screens

Bluetooth pairing

Each Chainmetric device is equipped with Bluetooth LE module, so that the phone with application can pair with them and perform some local communication, like share GPS location.

chainmetric bluetooth

Environment monitoring

Once asset is on Chainmetric blockchain ledger, and the requirements assigned to it, you can monitor its surrounding environment conditions in real time, verify if those are complied with required conditions, and receive notification whenever violations occurs.

chainmetric streaming

Environment metric readings from sensors connected to the device are being streamed directly to device, while being validated by on-chain Smart Contracts against previously assigned requirements.

The implementation of such feature requires the combination of Flutter's Event Channel with carefully choreographed event emitters and listeners throughout each level of the system:

diagram

Identity management

Application provides a convenient way of managing identities, user authentication and authorization.

Despite the fact that Hyperledger Fabric requires x509 cryptographic credentials for accessing it, application still can be signed in via basic auth credentials. See details at chainmetric-network/orgservices/identity.

Application allows to have multiple identities (including ones from different organizations) and switch between them on fly.

Requirements

  • Mobile phone with Android or IOS
  • Connection config which can be generated via fabnctl command line utility
  • Cryptographic credentials to access the network

Roadmap

  • IoT device Bluetooth pairing (#1)
  • GPS location tethering (#2)
  • Asset view page
  • Device view page
  • User profile tab (#11)
  • Home dashboard tab
  • Metric requirements violation notifications (#9)

Wrap up

Chainmetric application implementation manages to connect modern UI rendering engine and enterprise-grade permissioned blockchain by utilizing Golang cross-platform capabilities. Such an approach allowed to quickly create a decent-looking user interface that is truly reactive to changes in the blockchain network and allows to make them in any place at any time.

License

Licensed under the Apache 2.0.