This readme explains what generatecode.sh does and how it works and what the specific JavaScript files does as well.
The script takes input of how many organizations that is wanted, then it copies files from the templates folder, reads the files and updates them to work with the number of organizations that was put in.
The script is meant to be used with the network scripts to start the auction with a specified number of organizations, but it can also be used separately to generate JavaScript files.
The script is called by the setup.sh-script (
D0020E-Project/src/network/setup.sh
Line 201 in 8880a83
./generatecode.sh <number>
where number is replaced with how many organizations that is desired.
Due to some bad practice where the script creates multiple duplicate functions in the JavaScript files this script needs to be modified if the intent is to have many organizations.
Below is a short description of what each of the JavaScript files that is modified by the script does.
This file contains a function that creates the chaincode path that all the other files imports.
This file is used to generate a bid and the bid's hash-value will be printed to the terminal. Before a bid is generated it checks to see if the bid is valid. If a bid already has been submitted by the organization then the bid's Valid status will be set to False.
This file is used to close an auction. Originally used by the seller but currently this is automatically used when all participating organizations has submitted a bid.
This file creates a new auction.
This file is used end an auction.
This file is used to enroll admins, at least one for each organization is needed.
This is used to query an auction and it will display information about the auction in the terminal.
This is used to query a bid and it will display information about the bid in the terminal.
This file is used to register and enroll users, for example the seller and bidders. Before this can be used the enrollAdmin.js for this organization has to be used.
This is used to reveal submitted bids. An auction can not end without at least one revealed bid.
This file is used to submit bids to an auction. Before a bid is submitted a check is made to see if the bid is Valid or not. If it's not valid it will not be submitted.