supply chain management on the blockchain with iot, azure, bigchaindb, vuejs

Post on 21-Jan-2018

228 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Supply Chain Management on the Blockchain

Johann RomefortTech Evangelist @Stylight

I’m Johann● Tech Evangelist @Stylight

● 7 years in San Francisco● Since 3 years in Munich

● Organize many meetups..● Organizer of DAHO.AM conference

● Twitter: @romefort ● johann.romefort@stylight.com

GitHub Repo

https://github.com/romefort/techfest2017

GOAL

Building a simple system capable of tracking an asset on a supply chain with immutable traceability

Why Blockchain forSupply Chain Management?

● Distributed Ledger● Guarantees Immutability● Publicly available● Enable product traceability at each

step of the supply chain● Tracking of important information:

○ Temperature○ Quality of goods○ Shipment and delivery dates○ Safety certifications of facilities.

Application examples

● Food supply chain : Fraud up to $40B / year, globally ○ Traceability at each step can allow fast tracking of food

poisoning ○ Walmart, Nestlé, Unliver...are deploying prototypes on

the blockchain (using Hyperledger)● Traceability of luxury goods from one owner to the

next● Container transportation management● Traceability of diamonds● Traceability in Pharma industry (10% to 30% of drugs

in dev. Countries are fake.

Building our prototype

What do we need?

Technologies involved

ESP8266 (NodeMCU) RFID Scanner (MFRC522)

Azure IoT hub BigchainDB

10000 feet view

Caveats● RFID can be cloned● Prototype built in 48h with disregard for

security ● Some things are hardcoded ;-)● Want industrial secure system?

○ https://www.riddleandcode.com/

ESP8266 / NodeMCU● Cheap ($2)● WIFI on board ● Low-power● Programmable on Arduino

● On TECHFEST: ○ You need to register your mac address

to access the wifi network○ Serial.println(WiFi.macAddress());

Install ESP8266 inside Arduino http://arduino.esp8266.com/stable/package_esp8266com_index.json

MFRC522

● Low Cost Scanner ($1)● Tags are cheap and come in various

forms: Cards, fobs, stickers● Stickers are small and can easily added

to any product

Using MFRC522 on NodeMCUMFRC522 Pins NodeMCU pins

SDA D8

SCK D5

MOSI D7

MISO D6

IRQ -

GND GND

RST D3

3.3V 3.3V

● Connect pins =>● Add the MFRC522

○ Sketch > Include Libraries > Manage Libraries○ Search MFRC522○ Install

● Verify working setup○ File > Example > MFRC522 > DumpInfo○ #define RST_PIN D3

#define SS_PIN D8○ Scan a tag and verify you get its UID

Reading an RFID Tag

github.com/romefort/techfest2017/nodemcu-mfrc522/TestMFRC522.ino

Azure IoT Hub

● Connect devices● Send/Receive data with

HTTP/MQTT● Execute Azure

Functions● Store data in Azure

Storage● Analytics...

Connecting to Azure IoT Hub

1/ Register your device

Connecting to Azure IoT

Hub

2/ Get your connection

string

Connecting to Azure IoT Hub3/ Get your SAS Token

1. $ npm install iothub-explorer -g2. $ iothub-explorer login “*connection _string*” (see previous slide)3. $ iothub-explorer sas-token *registered_device_name* -d 600000

Connecting To Azure

IoT Hub

4/ Arduino Sketch

MQTT using PubSub Client

Connecting to Azure IoT Hub5/ Verify that messages are going through

$ iothub-explorer monitor-events *your_registered_device* --login "*your_connection_string"

What do we have so far?

● An IoT device capable of scanning code, connecting to WIFI and communicating with the outside world through MQTT

What are we missing?

Receiving MQTT messages

Creating transactions on BigchainDB

Seeing transaction on a user-friendly UI

Getting MQTT messages from Azure IoT hub

Create a Transaction in BigchainDB

Transfering an asset in BigChainDB

Listening to transactions on BigchainDB

Run an express server and forward incoming transactions to the frontend with socket.io

It’s showtime!

Thank You!

https://github.com/romefort/techfest2017

@romefort

top related