Giter Site home page Giter Site logo

blockchain-supply-chain's Introduction

blockchain-supply-chain

A technical framework for improving traceability in supply chain systems using blockchain. Developed as part of my final year project at University. See dissertation.pdf for further discussion.

Improving Supply chain systems offers benefits to quality, cost, and regulatory compliance, but interoperability between organisations is an obstacle. This project addresses the issue of interoperability through the introduction of blockchain technology, implementing a complex supply chain model from literature on the Hyperledger platform.

The process of translating a supply chain network model to an implementation is described in detail; coupled with the the complexity of the network model chosen, this allows the system to be generalised well to a variety of supply chain use cases. The system includes infrastructure, application and integration layers, providing an end-to-end reference implementation for creation of supply chain systems in enterprise.

Prequisites

  • Docker
  • Postman
  • Node.js / npm
  • yarn

Install

Download Fabric Docker images

curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0-rc1

(docs)

Install Composer command line tools

npm i -g [email protected] [email protected] passport-github

Import sample participant identities

cd network
./importIdCards.sh

Enable authentication for API server

Create a new OAuth application on GitHub

  • Application name: composer-rest-server
  • Homepage URL: http://localhost:3000/
  • Application description: OAuth application for the multi-user mode of composer-rest-server
  • Authorization callback URL: http://localhost:3000/auth/github/callback

Run

Start the network

# in 'network' directory
export COMPOSE_PROJECT_NAME=biswas
./deployNetwork.sh

Start the API server

export COMPOSER_PROVIDERS='{
  "github": {
    "provider": "github",
    "module": "passport-github",
    "clientID": "REPLACE_WITH_CLIENT_ID",
    "clientSecret": "REPLACE_WITH_CLIENT_SECRET",
    "authPath": "/auth/github",
    "callbackURL": "/auth/github/callback",
    "successRedirect": "/",
    "failureRedirect": "/"
  }
}'

composer-rest-server -c grower-network-admin@biswas -a true -m true

The API explorer is now located http://localhost:3000/explorer.

Interacting with the network

Import identities into API server

  • Navigate to http://localhost:3000/auth/github and authenticate with GitHub
  • Find the /wallet/import endpoint at the bottom of the list in the API explorer
  • Import the admin identity card from ./network/fabric/id-cards/grower-network-admin/card using the name admin
  • Import the identity cards for the sample network participants from ./network/fabric/id-cards/users using the same endpoint. The names should be the same as the name of the card, i.e. the file distributor.card should be imported as distributor

Add sample data using Postman

  • Navigate to the end-to-end test run documentation and click 'Run in Postman'
  • Select the imported sample-env environment
  • Display your OAuth access token in the explorer by clicking 'show'. Copy this into your Postman environment as the value for the key accessToken
  • Run the requests using the collection runner

View traceability information

  • Copy your OAuth access token into line 9 of ./frontend/src/controllers/api.js
  • Start the web application by running yarn start inside ./frontend
  • Copy the value of bottleID from the Postman environment
  • Navigate to the frontend at http://localhost:3001/
  • Search for the copied bottleID.

Development

Unit tests

# in ./network/composer
npm t

blockchain-supply-chain's People

Contributors

mattdean1 avatar

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.