Git Product home page Git Product logo

esumit / trace-fruits Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 16.27 MB

TraceFruits is a conceptual demonstration designed to visualize fruit supply chain events stored in an immutable ledger. Leveraging Splunk for data analysis, the project utilizes Hyperledger Fabric's blockchain ledgers to create an informative and transparent overview of the fruit supply chain process.

License: MIT License

Shell 48.76% Go 51.24%
hyperledger-fabric splunk-application chaincode smart-contracts blockchain hyperledger

trace-fruits's Introduction

Trace Fruits

About

Traceability Fruits

Trace Fruits is a conceptual demo designed to visualize fruit supply chain events stored in an immutable ledger. It utilizes Splunk to analyze data generated from Hyperledger Fabric's blockchain ledgers.

This demo is inspired by the GS1 Global Traceability Standard, which provides guidelines for fresh fruit and vegetable traceability. The major supply chain events for traceability include:

  • Harvesting - The producer harvests the crop and packs the products into cases.
  • Packing/Repacking - The packer/repacker transforms ungraded commodities into retail-ready products.
  • Shipping - The packer/repacker palletizes the cases of product.
  • Transporting - The carrier arrives and loads the pallets onto the truck.
  • Receiving - The pallets arrive at the retailer or foodservice operator's distribution center.
  • Selling or Consumption - The products have arrived at the retail store and have been placed on the shelves.

Tracefruit WorkFlow

By leveraging blockchain technology and data analysis, Trace Fruits aims to provide better transparency and traceability throughout the entire fruit supply chain process. harvesting-traceability event as stored in ledger

{
  "_id": "0e8a4c14-02f2-42b5-939c-a8de8d2c7db6",
  "_rev": "1-c1b69236a1b423ec7806837549c32c8c",
  "attributes": {
    "event-when": "2021-05-24 18:47:22.151667 +1000 AEST",
    "event-where": "Johannesburg, South Africa",
    "event-why": "harvesting-traceability",
    "expiration-datetime": "2021-12-24 18:47:22.1515 +1000 AEST",
    "fruit-name": "Apricots",
    "fruit-type": "deciduous",
    "quantity": 313,
    "weight": 212
  },
  "header": {
    "batch-lot": "AB-123",
    "event-id": "0e8a4c14-02f2-42b5-939c-a8de8d2c7db6",
    "gln": "9501101530911",
    "gln-location-type": "planting",
    "gtin": "09501101530003",
    "gtin-trade-id-type": "crate-trade-id",
    "trace-id": "11111111"
  },
  "metaInfo": {
    "createdAt": "2021-06-26T18:45:04.140564684Z",
    "docType": "harvesting"
  },
  "~version": "\u0000CgMBBAA="
}

A trace-id is unique for set of product's supply chain events.

Tracefruit Blockchain Network

Tracefruit Blockchain Network

Demo Recording

https://tinyurl.com/trace-fruits-demo

How conceptually it works ?

Tracefruit Context

  • At every logical step of the fruit supply chain, a fresh fruit supply chain event with a unique trace-id is inserted into the blockchain ledger (e.g., harvesting event or shipping event). This event contains crucial information to identify and verify the supply chain event.

  • The inserted unique trace-ids correspond to a batch of fruit products, and the trace-id is inserted for each event from start to finish for that batch of fruit products (e.g., from harvesting to retail).

  • A complete audit trail of events from start to finish can be queried from the ledger using the trace-id.

  • Individual events can also be queried from the ledger.

  • Events are inserted along the supply chain process.

How To

Step-1 : Clone this repository to linux flavour machine e.g. Ubuntu 20.04.2 LTS
Step-2 : Install Prerequisites of hyperledger fabric
Step-3 : Install Samples, Binaries, and Docker Images

Execute the command to pull down the binaries and images

curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.6 1.4.6 0.4.18
  • hyperledger/fabric-baseos 0.4.18
  • hyperledger/fabric-ca 1.4.6
  • hyperledger/fabric-orderer 1.4.6
  • hyperledger/fabric-peer 1.4.6
Step-5 : Setup network, necessary dockers , orgs, peer , channels , Splunk

Inside this repo, call start shell script. It will setup necessary dockers images e.g. couch, Splunk, fabric network, orgs, peers, channels

./start.sh

After a successful run of start.sh

Step-6 : Run init ledgers from command line
./init_ledgers.sh

It will insert 18 supply events into the via trace_fruits_cc chaincode to the ledgers.

After a successful run of init-ledgers.sh

Step-7 : Open couchdb Fauxton , a native web-based interface built into CouchDB :
http://<ip address>:5984/_utils/

Click on databases Click on fruitsreceiver_trace_fruits_cc

After a successful init of events in world state After a successful init of events in world state After a successful init of events in world state

Step-9 : Run Send Txns to continuously send events to Trace Fruits ledgers
./send_txns.sh

After a successful run of send txns

Step-10 : Open splunk enterprise :
http://<ip-address>:8000/en-US/account/login 

username : admin 
Password : changeme 
 
if local then ip address is 127.0.0.1 

Open Splunk App for Hyperledger Fabric Click on Trace Fruits On the Side Bar

Click on Trace Fruits On the Side Bar Navigate on the About Page of Trace Fruits Sample Data Analysis of Ledger generated data Sample Data Analysis Of Trace Fruits Events Payloads.png

To shutdown the environment

./stop.sh.

On successful run of stop sh

Note
  • .checkpoints is an empty file -> ./.checkpoints:/usr/src/app/.checkpoints in docker-compose-splunk.yaml
  • splunk-apps is an empty dir -> - ./splunk-apps:/opt/splunk/etc/apps in docker-compose-splunk.yaml
  • trace-fruits-apps contains trace-fruits splunk app available tar.gz, and a regular folder
  • trace-fruits chaincode available in trace-fruits-cc directory
  • trace-fruits-splunk-app.tar.gz also available in s3 https://trace-fruits.s3.ap-southeast-2.amazonaws.com/trace-fruits-splunk-app.tar.gz
  • Audit trail query is not implemented yet
  • Tar file of Trace-Fruits-1 doesn't work if created from mac,

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.