TrustChain is a blockchain-based solution that aims to create consumer trust in products by tracking their raw materials throughout the supply chain. It allows consumers to verify the origin, authenticity, and journey of a product by leveraging blockchain technology.
TrustChain is a platform that enhances transparency and builds trust between consumers and manufacturers. By tracking the entire supply chain on Hyperledger Fabric Blockchain, TrustChain provides consumers with access to valuable information about the product's raw materials, sourcing, and production processes.
Verify that you have the following installed:
$ node -v
v16.20.0
$ npm -v
8.19.4
$ docker -v
Docker version 23.0.1, build a5ee5b1
$ docker-compose -v
Docker Compose version v2.15.1
$ git --version
git version 2.39.2
Clone the repository
$ git clone https://github.com/raj-71/supply-chain-fabric.git
$ cd supply-chain-fabric
Start the hyperledger fabric network
$ ./fablo up fablo-config.json
$ cd backend/config
$ ./generate-ccp
Start the backend server
$ cd backend
$ npm install
$ node app.js
CouchDB
as DatabasecreateToken
- to generate a token for a produce only by farmer
transferFrom
- when someone sells a token to other user
createTokenOverToken
- when someone create a product from raw material, new tokens are created over those tokens
lockToken
- when retailer sells product to consumer, no new metadata can be added to that token
readNFT
- read data of a token from the ledger only if the user owns it
readAllNFT
- read all the tokens that the user owns
getHistory
- get all the transactions related to that token
Incase if any of the commands fail due to configurations or the network was not brought down properly use the following commands to clear the corrupted docker images and fix the issue.
Stop the network
$ ./fablo down
Again Up the network
$ ./fablo up fablo-config.json
Stop the containers
$ docker stop $(docker ps -a -q)
Remove the containers
$ docker rm $(docker ps -a -q)
Remove all local volumns
$ docker volume prune
Remove all wallets
$ cd backend
$ rm -rf /backend/*-wallet
Authorization error code 71 -> Regenerate all connection profies in backend
$ cd backend/config
$ ./generate-ccp
Incase of affiliation error -> authorization error code 20
Copy paste these lines in all the fabric-ca-server-config.yaml (total 4 such files) files in the network. File locations:
/fablo-target/fablo-config/fabric-ca-server-config/*.supplychain.com/fabric-ca-server-config.yaml
affiliations:
farmer:
- department1
seller:
- department1
consumer:
- department1