# hedera-sdk-java **Repository Path**: qq2276632042/hedera-sdk-java ## Basic Information - **Project Name**: hedera-sdk-java - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-15 - **Last Updated**: 2021-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Hedera™ Hashgraph Java SDK ![](https://img.shields.io/badge/java-7%2B-blue?style=flat-square) ![](https://img.shields.io/badge/android-19%2B-blue?style=flat-square) [![](https://img.shields.io/github/workflow/status/hashgraph/hedera-sdk-java/Java/develop?style=flat-square)](https://github.com/hashgraph/hedera-sdk-java/actions) [![](https://img.shields.io/maven-central/v/com.hedera.hashgraph/sdk/2?label=maven&style=flat-square)](https://search.maven.org/artifact/com.hedera.hashgraph/sdk) > The Java SDK for interacting with Hedera Hashgraph: the official distributed > consensus platform built using the hashgraph consensus algorithm for fast, > fair and secure transactions. Hedera enables and empowers developers to > build an entirely new class of decentralized applications. ## Install #### Gradle Select _one_ of the following depending on your target platform. ```groovy // Android, Corda DJVM, Java 7+ implementation 'com.hedera.hashgraph:sdk-jdk7:2.0.4' // Java 9+, Kotlin implementation 'com.hedera.hashgraph:sdk:2.0.4' ``` Select _one_ of the following to provide the gRPC implementation. ```groovy // netty transport (for high throughput applications) implementation 'io.grpc:grpc-netty-shaded:1.35.0' // netty transport, unshaded (if you have a matching Netty dependency already) implementation 'io.grpc:grpc-netty:1.35.0' // okhttp transport (for lighter-weight applications or Android) implementation 'io.grpc:grpc-okhttp:1.35.0' ``` Select _one_ of the following to enable or disable Simple Logging Facade for Java (SLFJ4). ```groovy // Enable logs implementation 'org.slf4j:slf4j-simple:1.7.29' // Disable logs implementation 'org.slf4j:slf4j-nop:1.7.29' ``` #### Maven Select _one_ of the following depending on your target platform. ```xml com.hedera.hashgraph sdk-jdk7 2.0.4 com.hedera.hashgraph sdk 2.0.4 ``` Select _one_ of the following to provide the gRPC implementation. ```xml io.grpc grpc-netty-shaded 1.35.0 io.grpc grpc-netty 1.35.0 io.grpc grpc-okhttp 1.35.0 ``` ## Usage Examples of several potential use cases and workflows are available within the repository in [`examples/`](./examples/src/main/java). * [Create Account](./examples/src/main/java/CreateAccountExample.java) * [Transfer Hbar](./examples/src/main/java/TransferCryptoExample.java) * [Hedera Consensus Service (HCS)](./examples/src/main/java/ConsensusPubSubExample.java) ## Development ### Dependencies * [Java Development Kit (JDK)](https://adoptopenjdk.net/) v12+ (note this is to _build_, not run) ### Compile ```sh $ ./gradlew compileJava ``` ### Unit Test ```sh $ ./gradlew test ``` ### Integration Test The easiest way to run integration tests is by providing network and operator information in a configuration file. This configuration file is passed into system properties. ```sh $ ./gradlew integrationTest -PCONFIG_FILE="" ``` An example configuration file can be found in the repo here: [sdk/src/test/resources/client-config-with-operator.json](sdk/src/test/resources/client-config-with-operator.json) The format of the configuration file should be as follows: ``` { "network": { "": "", ... }, "operator": { "accountId": "", "privateKey": "" } } ``` If a configuration file is not provided, `OPERATOR_ID` and `OPERATOR_KEY` must be passed into system properties and integration tests will run against the Hedera test network. ```sh $ ./gradlew integrationTest -POPERATOR_ID="" -POPERATOR_KEY="" ``` `HEDERA_NETWORK` can optionally be used to use `previewnet`. This System Property can only be set to `previewnet`. ```sh $ ./gradlew integrationTest -POPERATOR_ID="" -POPERATOR_KEY="" -PHEDERA_NETWORK="previewnet" ``` Note: It is also possible to use a custom network in a configuration file and pass `OPERATOR_ID` and `OPERATOR_KEY` into system properties. An example configuration file containing only network information can be found in the repo here: [sdk/src/test/resources/client-config.json](sdk/src/test/resources/client-config.json) ### Examples Requires `OPERATOR_ID` and `OPERATOR_KEY` to be in a .env file in the examples directory. Many examples run against the Hedera test network. ```sh $ ./gradlew -q example:run $ ./gradlew -q example:runGenerateKey ``` ## Contributing to this Project We welcome participation from all developers! For instructions on how to contribute to this repo, please review the [Contributing Guide](CONTRIBUTING.md). ## License Information Licensed under Apache License, Version 2.0 – see [LICENSE](LICENSE) in this repo or [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).