|
1 | | -# Hyperledger Fabric - Java Contract and Chaincode |
| 1 | +# Hyperledger Fabric Chaincode Java |
2 | 2 |
|
3 | | -This is a Java implementation of Hyperledger Fabric chaincode shim APIs and contract programming model. This enables development of using Java language or other JVM based languages |
| 3 | +[](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Java/_build/latest?definitionId=39&branchName=release-1.4) |
| 4 | +[](https://maven-badges.herokuapp.com/maven-central/org.hyperledger.fabric-chaincode-java/fabric-chaincode-shim) |
| 5 | +[](https://chat.hyperledger.org/channel/fabric-java-chaincode) |
4 | 6 |
|
5 | | -## Developers |
| 7 | +This is a Java based implementation of Hyprledger Fabric chaincode shim APIs, which enables development of smart contracts using the Java language. |
6 | 8 |
|
7 | | -Application developers interested in developing smart contracts should read the [introductory tutorial](CONTRACT_TUTORIAL.md) and for a full scenario visit the |
8 | | -[Commercial Paper](https://hyperledger-fabric.readthedocs.io/en/latest/tutorial/commercial_paper.html) tutorial. |
| 9 | +This project creates `fabric-chaincode-protos` and `fabric-chaincode-shim` jar |
| 10 | +files for developers' consumption and the `hyperledger/fabric-javaenv` docker image |
| 11 | +to run Java chaincode. |
9 | 12 |
|
10 | | -We recommend using the IBM Blockchain Platform [VSCode extension](https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform) to assist you in developing smart contracts. The extension is able to create sample contracts for you, an example of such a contract is in the [fabric-contract-example](./fabric-contract-example) directory; there are folders for using both gradle and maven. |
| 13 | +## Getting Started |
11 | 14 |
|
12 | | -In addition, this has reference to other tutorials to get you started |
| 15 | +Application developers interested in developing Java smart contracts for Hyperledger Fabric should read the [JavaDoc](https://fabric-chaincode-java.github.io/) which inludes download information, and links to documentation and samples. |
13 | 16 |
|
14 | | -## Contributors |
| 17 | +## Project structure |
15 | 18 |
|
16 | | -Contributors or early adopters who need to be able to build and test recent builds, should reference the [contributing](CONTRIBUTING.md) guide. |
| 19 | +### fabric-chaincode-protos |
17 | 20 |
|
18 | | -This project creates `fabric-chaincode-protos` and `fabric-chaincode-shim` jar files for developers consumption and the `hyperledger/fabric-javaenv` docker image to run the Java chaincode and contracts. |
| 21 | +Contains the protobuf definition files used by Java shim to communicate with Fabric peers. |
19 | 22 |
|
| 23 | +### fabric-chaincode-shim |
| 24 | + |
| 25 | +Contains the java shim classes that define Java chaincode API and way to communicate with Fabric peers. |
| 26 | + |
| 27 | +### fabric-chaincode-docker |
| 28 | + |
| 29 | +Contains instructions to build the `hyperledger/fabric-javaenv` docker image. |
| 30 | + |
| 31 | +### fabric-chaincode-integration-test |
| 32 | + |
| 33 | +Contains higher level tests for Java chaincode. |
| 34 | + |
| 35 | +> **Note:** in the future these should be replaced with a separate suite of [Cucumber](https://cucumber.io) tests which run against all chaincode implementations. |
| 36 | +
|
| 37 | +### fabric-chaincode-example-gradle |
| 38 | + |
| 39 | +Contains an example java chaincode gradle project that includes sample chaincode and basic gradle build instructions. |
| 40 | + |
| 41 | +## Building and testing |
| 42 | + |
| 43 | +Make sure you have the following prereqs installed: |
| 44 | + |
| 45 | +- [Docker](https://www.docker.com/get-docker) |
| 46 | +- [Docker Compose](https://docs.docker.com/compose/install/) |
| 47 | +- [Java 8](https://www.java.com) |
| 48 | + |
| 49 | +> **Note:** Java can be installed using [sdkman](https://sdkman.io/). |
| 50 | +
|
| 51 | +Clone the repository if you haven't already. |
| 52 | + |
| 53 | +``` |
| 54 | +git clone https://github.com/hyperledger/fabric-chaincode-java.git |
| 55 | +``` |
| 56 | + |
| 57 | +Build java shim jars (proto and shim jars) and install them to local maven repository. |
| 58 | + |
| 59 | +``` |
| 60 | +cd fabric-chaincode-java |
| 61 | +./gradlew clean build install |
| 62 | +``` |
| 63 | + |
| 64 | +> **Note:** `./gradlew clean build classes` can be used instead to reduce the binaries that are built. This should be sufficient for using the local repository. |
| 65 | +
|
| 66 | +Build javaenv docker image, to have it locally. |
| 67 | + |
| 68 | +``` |
| 69 | +./gradlew buildImage |
| 70 | +``` |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +[](http://creativecommons.org/licenses/by/4.0/) |
| 75 | +This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) |
0 commit comments