- Visual Code. Install the Extension Pack for Java which contains the Maven plugin here.
- Maven 3.9.6 (Remember to set PATH)
- Hyperledger Fabric v2.5
- Open the downloaded project directory in Visual Studio Code.
- It should fetch most of the dependencies, except the JPBC libary. Import them manually:
- In
RefLib, there are totally four .jar - For each of the .jar in RefLib, install it into the local respository by issuing the following command
For example, refer to pom.xml, one dependency ismvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version>
The command is:<dependency> <groupId>gas.dia.unisa.it</groupId> <artifactId>jna</artifactId> <version>3.2.5</version> </dependency>
mvn install:install-file -Dfile=<path-to-file> -DgroupId="gas.dia.unisa.it" -DartifactId="jna" -Dversion="3.2.5"
- If the import is successful, there will be no compilation error for the Java sources.
- In
src\main\java\DisIMS\DisIMS.java contains the main() method to test the entire flow of the DisIMS scheme.
- Set up a test network. Guidelines. The network should contain two endorsing peers, one orderer and one CA, by issuing
./network.sh up createChannel -ca - Open the downloaded project directory in Visual Studio Code.
- Overwrite the folder "fabric-samples/asset-transfer-basic/chaincode-java" by "Fabric-Java/chaincode-java".
- Overwrite the folder "fabric-samples/asset-transfer-basic/application-java" by "Fabric-Java/application-java".
- Deploy the chaincode, "fabric-samples/asset-transfer-basic/chaincode-java".
- After chaincode is deployed successfully, copy the curve property file to the chaincode container.
- Run the Java program "fabric-samples/asset-transfer-basic/application-java/src/main/java/application/java/App.java". (Uncommment Lines 57 and 58 for admin enrolment and user registration for the first run)
- If the smart contract file is changed, use the following command in the root folder to generate the new Java Wrapper.
mvn web3j:generate-sources
src\main\java\DisIMS\DisIMSExperiment.java contains the main() method to test the entire flow of the DAC scheme. Place the .properties file in the root directory, which is not uploaded to github for security purpose. It contains the private key of the testing Ethereum testnet (Sepolia) account.
Java Pairing Based Cryptography Library (JPBC) is adopted here.