|
1 | | -# Hyperledger Fabric Shim for Java chaincode |
| 1 | +# Hyperledger Fabric Chaincode Java |
2 | 2 |
|
3 | | -This is a Java based implementation of Hyprledger Fabric chaincode shim APIs, which enables development of chaincodes using Java language. |
| 3 | +[](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Java/_build/latest?definitionId=39&branchName=master) |
| 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 | | -Application developers interested in developing smart contracts (what we call chaincode) for Hyperledger Fabric should |
6 | | -read the tutorial in TUTORIAL.md file and visit |
7 | | -[Chaincode for developers](https://hyperledger-fabric.readthedocs.io/en/latest/chaincode4ade.html). |
8 | | - |
9 | | -Contributors or early adopters who need to be able to build and test recent Java chaincode shim, should reference [FAQ.md](FAQ.md) file. |
| 7 | +This is a Java based implementation of Hyprledger Fabric chaincode shim APIs, which enables development of smart contracts using the Java language. |
10 | 8 |
|
11 | 9 | This project creates `fabric-chaincode-protos` and `fabric-chaincode-shim` jar |
12 | | -files for developers consumption and the `hyperledger/fabric-javaenv` docker image |
| 10 | +files for developers' consumption and the `hyperledger/fabric-javaenv` docker image |
13 | 11 | to run Java chaincode. |
14 | 12 |
|
15 | | -## Folder structure |
| 13 | +## Getting Started |
| 14 | + |
| 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. |
| 16 | + |
| 17 | +## Project structure |
| 18 | + |
| 19 | +### fabric-chaincode-protos |
| 20 | + |
| 21 | +Contains the protobuf definition files used by Java shim to communicate with Fabric peers. |
| 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 | +``` |
16 | 63 |
|
17 | | -The "fabric-chaincode-protos" folder contains the protobuf definition files used by |
18 | | -Java shim to communicate with Fabric peer. |
| 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. |
19 | 65 |
|
20 | | -The "fabric-chaincode-shim" folder contains the java shim classes that define Java |
21 | | -chaincode API and way to communicate with Fabric peer. |
| 66 | +Build javaenv docker image, to have it locally. |
22 | 67 |
|
23 | | -The "fabric-chaincode-docker" folder contains instructions to the build |
24 | | -`hyperledger/fabric-javaenv` docker image. |
| 68 | +``` |
| 69 | +./gradlew buildImage |
| 70 | +``` |
25 | 71 |
|
26 | | -The "fabric-chaincode-example-gradle" contains an example java chaincode gradle |
27 | | -project that includes sample chaincode and basic gradle build instructions. |
| 72 | +--- |
28 | 73 |
|
29 | | -# Compatibility |
30 | | -Java SDK 8 or above |
| 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