- folder `supplychain` contains the client code to use the smart contract
- folder `supplychain` contains the client code to use the smart contract
- folder `supplychain/typescript` contains the client code in typescript
- folder `supplychain/typescript` contains the client code in typescript
- folder `supplychain/app` contains the web app in flask to use the smart contract
- folder `supplychain/app` contains the web app in flask to use the smart contract
- folder `first-network` contains the basic network configuration for our application (taken from the fabric-samples repo)
- folder `first-network` contains the basic network configuration for our application (taken from the fabric-samples repo)
To start the application:
# Starting the application
- run `./cleanup.sh` (if you already used it in the past)
- run `./teardownAll.sh` (if you already used it in the past)
-`cd supplychain/`
- run `./startFabric.sh` (this may take a few minutes and will compile the chaincode and start the network and also to compile the client code and bootstrap a local wallet)
- run `./startFabric.sh` (this may take a few minutes and will compile the chaincode and start the network)
- run `./runWebApp.sh` (this will launch the web server)
-`cd typescript`
- run `./launchBrowser` (opens a browser with a tab for one farmer (F0), one shipper (S0) and the evaluator)
- run `./initchainclient.sh` (this will compile the client code and bootstrap a local wallet)
- run `cd..` and `./runwebclient.sh` (which will start the Flask web server on localhost)
You can then go to `127.0.0.1/5000/user=N` with N = 1,2 or 3 and `127.0.0.1/5000/admin` in your browser.
To compile the client code again you can run `npm run build` from `supplychain/typescript`.
To compile the client code again you can run `npm run build` from `supplychain/typescript`.
# Extending the project
When creating a new app/contract you can (and possibly should) change the "supplychain" string by:
When creating a new app/contract you can (and possibly should) change the "supplychain" string by:
- editing {.,chaincode}/supplychain/typescript/package.json and replacing the "name" field
- editing {.,chaincode}/supplychain/typescript/package.json and replacing the "name" field
- changing CONTRACT_NAME in contractConfig.sh
- changing CONTRACT_NAME in contractConfig.sh
...
@@ -23,3 +23,18 @@ When creating a new app/contract you can (and possibly should) change the "suppl
...
@@ -23,3 +23,18 @@ When creating a new app/contract you can (and possibly should) change the "suppl
- renaming folders {.,chaincode}/supplychain;
- renaming folders {.,chaincode}/supplychain;
- changing class/type names wherever you find it appropriate
- changing class/type names wherever you find it appropriate
# Installing prerequisites (only if not in the VM)