sdk

Java SDK for interacting with the Hedera API

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.hedera.hashgraph
ArtifactId

ArtifactId

hedera-java-sdk
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

sdk
Java SDK for interacting with the Hedera API
Project URL

Project URL

http://www.hedera.com
Source Code Management

Source Code Management

http://github.com/hashgraph/hedera-sdk-java

Download hedera-java-sdk

How to add to project

<!-- https://jarcasting.com/artifacts/com.hedera.hashgraph/hedera-java-sdk/ -->
<dependency>
    <groupId>com.hedera.hashgraph</groupId>
    <artifactId>hedera-java-sdk</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.hedera.hashgraph/hedera-java-sdk/
implementation 'com.hedera.hashgraph:hedera-java-sdk:0.3.1'
// https://jarcasting.com/artifacts/com.hedera.hashgraph/hedera-java-sdk/
implementation ("com.hedera.hashgraph:hedera-java-sdk:0.3.1")
'com.hedera.hashgraph:hedera-java-sdk:jar:0.3.1'
<dependency org="com.hedera.hashgraph" name="hedera-java-sdk" rev="0.3.1">
  <artifact name="hedera-java-sdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.hedera.hashgraph', module='hedera-java-sdk', version='0.3.1')
)
libraryDependencies += "com.hedera.hashgraph" % "hedera-java-sdk" % "0.3.1"
[com.hedera.hashgraph/hedera-java-sdk "0.3.1"]

Dependencies

compile (19)

Group / Artifact Type Version
javax.xml.bind : jaxb-api jar 2.3.0
com.sun.xml.bind : jaxb-core jar 2.3.0
com.sun.xml.bind : jaxb-impl jar 2.3.0
javax.activation : activation jar 1.1.1
net.java.dev.jna : jna jar 4.2.2
commons-codec : commons-codec jar 1.10
org.apache.maven.plugins : maven-javadoc-plugin maven-plugin 2.10.4
com.google.api.grpc : proto-google-common-protos jar 1.12.0
com.google.protobuf : protobuf-java jar 3.6.0
io.grpc : grpc-all jar 1.17.1
net.i2p.crypto : eddsa jar 0.3.0
com.madgag.spongycastle : core jar 1.58.0.0
com.hedera.hashgraph : hedera-protobuf-java-api jar 0.3.1
ch.qos.logback : logback-classic jar 1.2.3
ch.qos.logback : logback-core jar 1.2.3
org.bouncycastle : bcpkix-jdk15on jar 1.60
org.slf4j : slf4j-api jar 1.7.25
com.google.guava : guava jar 23.6-jre
org.apache.httpcomponents : httpcore jar 4.4.8

test (8)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.2.0
org.junit.jupiter : junit-jupiter-engine jar 5.2.0
org.junit.platform : junit-platform-suite-api jar 1.1.0
org.junit.platform : junit-platform-commons jar 1.2.0
org.junit.platform : junit-platform-engine jar 1.2.0
org.junit.platform : junit-platform-launcher jar 1.1.0
org.junit.platform : junit-platform-runner jar 1.1.0
org.junit.jupiter : junit-jupiter-params jar 5.2.0

Project Modules

There are no modules declared in this project.

Hedera™ Hashgraph Java 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.

// Android, Corda DJVM, Java 7+
implementation 'com.hedera.hashgraph:sdk-jdk7:2.0.1'

// Java 9+, Kotlin
implementation 'com.hedera.hashgraph:sdk:2.0.1'

Select one of the following to provide the gRPC implementation.

// netty transport (for high throughput applications)
implementation 'io.grpc:grpc-netty-shaded:1.24.0'

// netty transport, unshaded (if you have a matching Netty dependency already)
implementation 'io.grpc:grpc-netty:1.24.0'

// okhttp transport (for lighter-weight applications or Android)
implementation 'io.grpc:grpc-okhttp:1.24.0'

Maven

Select one of the following depending on your target platform.

<!-- Android, Corda DJVM, Java 7+ -->
<dependency>
  <groupId>com.hedera.hashgraph</groupId>
  <artifactId>sdk-jdk7</artifactId>
  <version>2.0.0-beta.3</version>
</dependency>

<!-- Java 9+, Kotlin -->
<dependency>
  <groupId>com.hedera.hashgraph</groupId>
  <artifactId>sdk</artifactId>
  <version>2.0.0-beta.3</version>
</dependency>

Select one of the following to provide the gRPC implementation.

<!-- netty transport (for server or desktop applications) -->
<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-netty-shaded</artifactId>
  <version>1.24.0</version>
</dependency>

<!-- netty transport, unshaded (if you have a matching Netty dependency already) -->
<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-netty</artifactId>
  <version>1.24.0</version>
</dependency>

<!-- okhttp transport (for lighter-weight applications or Android) -->
<dependency>
  <groupId>io.grpc</groupId>
  <artifactId>grpc-okhttp</artifactId>
  <version>1.24.0</version>
</dependency>

Usage

Examples of several potential use cases and workflows are available within the repository in examples/.

Development

Dependencies

Compile

$ ./gradlew compileJava

Unit Test

$ ./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.

$ ./gradlew integrationTest -PCONFIG_FILE="<ConfigurationFilePath>"

An example configuration file can be found in the repo here:

sdk/src/test/resources/client-config-with-operator.json

The format of the configuration file should be as follows:

{
    "network": {
        "<NodeAddress>": "<NodeAccountId>",
        ...
    },
    "operator": {
        "accountId": "<shard.realm.num>",
        "privateKey": "<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.

$ ./gradlew integrationTest -POPERATOR_ID="<shard.realm.num>" -POPERATOR_KEY="<PrivateKey>"

HEDERA_NETWORK can optionally be used to use previewnet. This System Property can only be set to previewnet.

$ ./gradlew integrationTest -POPERATOR_ID="<shard.realm.num>" -POPERATOR_KEY="<PrivateKey>" -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

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.

$ ./gradlew -q example:run<NameOfExample>
$ ./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.

License Information

Licensed under Apache License, Version 2.0 – see LICENSE in this repo or apache.org/licenses/LICENSE-2.0.

com.hedera.hashgraph

Hedera Hashgraph LLC

Versions

Version
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1