Getting started

Configure the SDK, connect to a Hedera network

In this guide, we'll get up and running with the Hedera Java SDK, connect to a Hedera network, and confirm our setup.

Hedera currently only provides support of the Java SDK, more languages are supported by the community. A complete list of SDKs for Hedera can be found here.


1. Configure the Hedera Java SDK

Use a build automation tool to add the Hedera Java SDK. If you're not familiar with Java dependecies, step-by-step guides are available.

Using Maven

Update the pom.xml file to include the following:


Using Gradle

In your Build.Gradle file update the dependecies block to include:

 compile "com.hedera.hashgraph:sdk:0.5.2"

GitHub Download

Alternatively, you can download the SDK in full from the Hashgraph GitHub.

git clone
cd hedera-sdk-java/
mvn install

Upon successful install, open the hedera-sdk-java folder in your IDE of choice; we recommend IntelliJ Idea or Eclipse.

2. Connect to a Hedera network

To submit transactions to a Hedera network, either the mainnet or testnet, we must specify the network and node(s).

To find testnet details, log in to your Hedera Portal profile. Learn how to get testnet access here.

We can do this by modifying the included .env.sample or by adding a .env file to the root directory of the SDK. In this file we'll add our desired Hedera testnet or mainnet node and account information. Prior to updating with your information, the file should look as follows:

# Network Node ID and Address – find testnet nodes at

# Your Account ID and Private Key

Lastly, be sure to rename the .env.sample file to .env. And just like that, you're now able to connect to a Hedera network.

3. Test your SDK setup

To make sure the SDK is properly configured, navigate to src/main/java and create a new Java class.

If you run into any issues, be sure to ask questions in the Hedera developer Discord chat. There's a community and the Hedera team ready to help.

Enter in a name for the class like generateKeys and update to include the following:

import com.hedera.hashgraph.sdk.HederaException;
import com.hedera.hashgraph.sdk.crypto.ed25519.*;

public class generateKeys {

    public static void main(String[] args) throws HederaException {

        // Generate a Ed25519 private, public key pair
        var newKey = Ed25519PrivateKey.generate();
        var newPublicKey = newKey.getPublicKey();

        System.out.println("private key = " + newKey);
        System.out.println("public key = " + newPublicKey);


Run generateKeys.main(). This should have an output similar to as follows:

private key = 302e020100300506032b6570042204203fd0f58986f71b83a77966ba0b35edc6e23451d25f89bf4e27532202aeaxba0
public key = 302a300506032b657003210073873d8479896de585b25abe9e8fb27e2816d8bbccdec124bce88d1a2axb0g

Congrats, you've successfully installed the Hedera Java SDK, configured your connection to a Hedera network, and are ready to move on to bigger and better things.

In the next step we'll learn how to use our .env in our app to send transactions, create accounts, and transfer your first hbars.

Updated 4 months ago

What's Next

Create accounts and send your first hbars.


Getting started

Configure the SDK, connect to a Hedera network

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.