Skip to content

cr22rc/fabric-sdk-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java SDK for Hyperledger Fabric

Welcome to Java SDK for Hyperledger project. This is a summary of steps required to get you started with building and using the Java SDK. Please note that this is not the API documentation or a tutorial for the SDK, this will only help you familiarize to get started with the SDK if you are new in this domain.

Compiling

To build this project, following dependencies must be met

  • JDK 1.8 or above
  • Apache Maven

Once your JAVA_HOME points to your installation of JDK 1.8 (or above) and JAVA_HOME/bin and Apache maven are in your PATH, issue the following command to build the jar file: mvn install or mvn install -DskipTests if you don't want to run the unit tests

Running the unit tests

To run the unit tests, please use mvn test or mvn install which will run the unit tests and build the jar file. You must be running a local instance of membersrvcs and a peer to be able to run the unit tests. Please follow the instructions here to setup the development environment.

Using the SDK

To use the SDK in your code, simply add the generated JAR file in your classpath. Once the JAR file is in your classpath, create a chain instance to interact with the network.
Chain testChain = new Chain("chain1");

Add the membership service:
testChain.setMemberServicesUrl("grpc:https://localhost:7054", null);

Set a keyValueStore:
testChain.setKeyValStore(new FileKeyValStore(System.getProperty("user.home")+"/test.properties"));

Add a peer to the chain:
testChain.addPeer("grpc:https://localhost:7051", null);

Get a member:
Member registrar = testChain.getMember("admin");

Enroll a member:
Member member = testChain.enroll("user", "secret");

SDK dependencies

SDK depends on few third party libraries that must be included in your classpath when using the JAR file. To get a list of dependencies, refer to pom.xml file or run mvn dependency:tree or mvn dependency:list.

Alternatively, mvn dependency:analyze-report will produce a report in HTML format in target directory listing all the dependencies in a more readable format.

Releases

No releases published

Packages

No packages published

Languages

  • Java 86.9%
  • Protocol Buffer 13.1%