Hyperledger Fabric (iii)-Fabric-sdk-java

Source: Internet
Author: User
Tags git clone hyperledger fabric
First, the Fabric SDK

The latest official document for Hyperledger fabric (V1.1.0-preview), the description of the Fabric SDK is still poor, just a few simple descriptions, plus two GitHub links: Fabric-sdk-node Fabric-sdk-java

In fact, through the Hyperledger project on GitHub we can see that Hyperledger fabric also offers another three kinds of sdk:fabric-sdk-go fabric-sdk-py

Of course, the official document mentions the Fabric-sdk-node as well as the Fabric-sdk-java star more and more convenient to use. Convenience is impossible, in this life is impossible.
The official is just giving a perfect nodejs document, and a Java startup description that says nothing about the document. Eclipse startup instructions. So if you can, temporarily more recommended to use Fabric-sdk-node, um, and today I use the Fabric-sdk-java. Second, Fabric-java-sdk

Because there is no documentation, the best way to do this is to look at the test case and run the test case first. A set of fabric configurations is ready in the test case and can only be run on the basis of satisfying prerequisites. 2.1 Prerequisites JDK 1.8+ Apache Maven idea/eclipse Prerequisites 2.2 Download Project

$ git clone Https://github.com/hyperledger/fabric-sdk-java
2.3 Import Project

IntelliJ idea: Use MAVEN project to import projects, import dependencies.
Eclipse: See fabric-sdk-java/docs/eclipsesetup.md. 2.4 Third party dependence

The Fabric SDK relies on a small number of third-party libraries, executing the following instructions at the root location before running to get a list of dependencies:

$ MVN Dependency:tree

Or is

$ MVN dependency:list
2.5 Running Fabric
$ cd fabric-sdk-java/src/test/fixture/sdkintegration

$/fabric up
If error:mainfest for hyperledger/fabric-orderer:latest not found appears
The fabric-sdk-java/src/test/fixture/sdkintegration/.env will be modified as follows
#Image Tags:

image_tag_fabric=:x86_64-1.0.1
image_tag_fabric_ca=:x86_64-1.0.1

#IMAGE_TAG_FABRIC =


#IMAGE_TAG_FABRIC_CA =
If prompted: Pemmision denied
Then give fabric.sh power.
$ chmod +x fabric.sh

Run successfully as shown in the figure:
2.6 Running test Cases

We pick one of the most common End2endit.java runs:

Note: The fabric.sh script needs to be rerun each time the test is run, and the following instructions are recommended for cleaning the fabric environment, especially if the Chaincode is modified.

$./fabric.sh Clean
2.7 construct their own invocation and query methods

Can be extracted according to their own needs for easy debugging:

third, something

Experience the importance of the document, of course, the final in the case of the SDK for the Chaincode to debug a lot of convenience. In addition, this test case can be used for multiple node testing, can be said to be very powerful. Iv. Reference Links Fabric-sdk-java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.