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
- Install packages:
npm install
- Create a folder for local archive:
mkdir dist
- Generate the BNA (Business Network Archive) file:
npm run prepublish
- 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. - 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!
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)
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.
- Install nvm and Apple Xcode
- Installing Hyperledger Composer development tools (Most important:
npm install -g composer-cli
)
- 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
- 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.
- 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)
- 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
- Stop Fabric runtime at the end of your development session:
cd tools/fabric/
./stopFabric.sh
./teardownFabric.sh
- Build on template
- Hyperledger Composer Official Documentation
- Developer Guide
- In-depth research on hyperledger composer link