Git Product home page Git Product logo

hyperledger-composer-supply-chain-network's Introduction

Hyperledger Composer Supply Chain Network

This is one implementation of Hyperledger Composer for supply chain, which demonstrates how Hyperledger blockchain improve transparency and traceability of industrial supply chain.

Master Thesis: An Approach for Improving Transparency and Traceability of Industrial Supply Chain with Blockchain Technology

How to run it?

  1. Install packages: npm install
  2. Create a folder for local archive: mkdir dist
  3. Generate the BNA (Business Network Archive) file: npm run prepublish
  4. Next, in a browser, navigate to the online Bluemix Composer Playground http://composer-playground.mybluemix.net and import the newly-generated BNA file into the Playground using the "Import/Replace" button at the bottom left of the screen. Locate the dist/hyperledger-supply-chain-network.bna file under your 'hyperledger-supply-chain-network' folder and upload it. This automatically deploys the new business network.
  5. Try to play with it. (Playground Tutorial)

Congratulations!

P.S. No.4 just only runs on web brower, all the data are stored in local storage. If you want run it on real blockchain network. Please follow Developer Guide and Developer Environment to make it real!

Model

This business network defines:

  • Participant Supplier Manufacturer Distributor Retailer Customer

  • Asset Commodity

  • Transaction InitiatePO TransferCommodity SetupDemo

  • Event none

Commodity are owned by a Supplier, Manufacturer, Distributor, Retailer or Customer, and the owner property on a Commodity can be modified by submitting a transaction (e.g. M2O, O2D). The transaction emits a SampleEvent that notifies applications of the old and new values for each modified Commodity.(WIP)

How to play on Bluemix Composer Playground?

To test this Business Network Definition in the Test tab:

Create a Manufacturer participant:

{
  "$class": "org.hcsc.network.Manufacturer",
  "tradeId": "M1",
  "companyName": "FAST"
}

Create a Commodity asset:

{
  "$class": "org.hcsc.network.Commodity",
  "tradingSymbol": "ts1",
  "description": "Aliquip.",
  "quantity": 216.3,
  "owner": "resource:org.hcsc.network.Manufacturer#M1"
}

Submit a TransferCommodity transaction:

{
  "$class": "org.hcsc.network.TransferCommodity",
  "commodity": "resource:org.hcsc.network.Commodity#ts1",
  "issuer": "resource:org.hcsc.network.Manufacturer#M1",
  "newOwner": "resource:org.hcsc.network.Distributor#D1"
}

After submitting this transaction, you should now see the transaction in the Transaction Registry and that a SampleEvent has been emitted (WIP). As a result, the value of the tradingSymbol:ts1 should now be new owner in the Asset Registry.

Pre-requisites on MacOS

Installing and running Hyperledger Composer Playground locally

  1. Pick a directory that you want to install into, then run the following command to download and start a Hyperledger Fabric instance and Hyperledger Composer Playground:
curl -sSL https://hyperledger.github.io/composer/install-hlfv1.sh | bash
  1. Access your local Hyperledger Composer Playground by clicking this link: http://localhost:8080. Please note: Private browsing is not supported when running the Playground locally.

Set Up Fabric

  1. kill and remove all running containers, and should remove all previously created Hyperledger Fabric chaincode images.
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
  1. Download the fabric runtime first. If you have already downloaded it, then start the fabric environment, and create a Hyperledger Composer profile:
cd tools/fabric/
./downloadFabric.sh
./startFabric.sh
./createComposerProfile.sh
  1. Stop Fabric runtime at the end of your development session:
cd tools/fabric/
./stopFabric.sh
./teardownFabric.sh

More info:

hyperledger-composer-supply-chain-network's People

Contributors

aprilsnows avatar enbochen avatar kant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hyperledger-composer-supply-chain-network's Issues

Admin privileged access limited

The latest release has a breaking change:

introduction of a business network administrator (see changes linked to #670 for details). For all previous releases of Composer, all digital certificates with admin in the name (case insensitive) have had "privileged access" to the business network - essentially it acted as if the access control rules were disabled. Replacing this method with the business network administrator delivers an improved security model, but the changes are significant, and could break business network definitions that relied upon the old behaviour.

(Check more in https://github.com/hyperledger/composer/releases/tag/v0.14.0)

How to query the ledger

Hello, please excuse my naivete, I am teaching myself blockchain from generous projects such as this one. Thank you so much for posting this, Ms. Chen. I have learned much from you.
I have deployed successfully and have created many commodities and POs (of course participants as well). My question is: how do I see the full history of a commodity? I have researched hyperledger in general and it seems there's a way to query through the API, but I don't see that defined in this API? Again, I apologize for being so new. Thank you for your time!

"TransferCommodity" transaction not working

Throws an error while submitting the "TranferCommodity" transaction.
screenshot from 2018-05-03 12-13-17

t: Instance org.hcsc.network.Commodity#ts1 has property company with type org.hyperledger.composer.system.NetworkAdmin that is not derived from org.hcsc.network.TraderA

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.