This document provides a comprehensive guide for migrating from the Hedera Java SDK to the new Hiero Java SDK. The package has been transferred from the Hedera organization to the Hiero organization, and this migration reflects the updated namespace and group ID.
The Maven group ID and artifact ID are being updated to reflect the new organization ownership:
- Group ID:
com.hedera.hashgraph→org.hiero - Artifact ID:
sdk→sdk-java - Package namespace:
com.hedera.hashgraph.sdk→org.hiero.sdk
The functionality, API, features, and codebase remain exactly the same - only the dependency coordinates and import statements need to be updated.
Before:
dependencies {
implementation 'com.hedera.hashgraph:sdk:2.67.0'
}After:
dependencies {
implementation 'org.hiero:sdk:2.67.0'
}Before:
<dependency>
<groupId>com.hedera.hashgraph</groupId>
<artifactId>sdk</artifactId>
<version>2.67.0</version>
</dependency>After:
<dependency>
<groupId>org.hiero</groupId>
<artifactId>sdk</artifactId>
<version>2.67.0</version>
</dependency>Before:
import com.hedera.hashgraph.sdk.Client;
import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.sdk.AccountBalanceQuery;
import com.hedera.hashgraph.sdk.AccountCreateTransaction;
import com.hedera.hashgraph.sdk.TransferTransaction;
import com.hedera.hashgraph.sdk.Hbar;After:
import org.hiero.sdk.Client;
import org.hiero.sdk.AccountId;
import org.hiero.sdk.PrivateKey;
import org.hiero.sdk.AccountBalanceQuery;
import org.hiero.sdk.AccountCreateTransaction;
import org.hiero.sdk.TransferTransaction;
import org.hiero.sdk.Hbar;Before:
import com.hedera.hashgraph.sdk.PrecheckStatusException;
import com.hedera.hashgraph.sdk.ReceiptStatusException;
import com.hedera.hashgraph.sdk.MaxQueryPaymentExceededException;
try {
// SDK operations
} catch (PrecheckStatusException e) {
// Handle precheck exceptions
} catch (ReceiptStatusException e) {
// Handle receipt exceptions
}After:
import org.hiero.sdk.PrecheckStatusException;
import org.hiero.sdk.ReceiptStatusException;
import org.hiero.sdk.MaxQueryPaymentExceededException;
try {
// SDK operations
} catch (PrecheckStatusException e) {
// Handle precheck exceptions
} catch (ReceiptStatusException e) {
// Handle receipt exceptions
}Update all build.gradle or build.gradle.kts files:
Before:
plugins {
id 'java'
id 'application'
}
dependencies {
implementation 'com.hedera.hashgraph:sdk:2.67.0'
testImplementation 'junit:junit:4.13.2'
}After:
plugins {
id 'java'
id 'application'
}
dependencies {
implementation 'org.hiero:sdk:2.67.0'
testImplementation 'junit:junit:4.13.2'
}Update pom.xml files:
Before:
<dependencies>
<dependency>
<groupId>com.hedera.hashgraph</groupId>
<artifactId>sdk</artifactId>
<version>2.67.0</version>
</dependency>
</dependencies>After:
<dependencies>
<dependency>
<groupId>org.hiero</groupId>
<artifactId>sdk</artifactId>
<version>2.67.0</version>
</dependency>
</dependencies>build.gradle/build.gradle.ktsfilespom.xmlfilesgradle.propertiesfiles (if they reference the old group ID)settings.gradlefiles (if they have specific configurations)
- All Java files with import statements
- Test files
- Configuration classes
- Utility classes
- README files
- API documentation
- Code examples in documentation
- Tutorial files
- GitHub Actions workflows
- Jenkins pipelines
- GitLab CI files
- Docker files
Before:
import com.hedera.hashgraph.sdk.Client;
import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.PrivateKey;
public class Example {
public static void main(String[] args) {
Client client = Client.forTestnet();
AccountId operatorId = AccountId.fromString("0.0.1234");
PrivateKey operatorKey = PrivateKey.fromString("...");
client.setOperator(operatorId, operatorKey);
}
}After:
import org.hiero.sdk.Client;
import org.hiero.sdk.AccountId;
import org.hiero.sdk.PrivateKey;
public class Example {
public static void main(String[] args) {
Client client = Client.forTestnet();
AccountId operatorId = AccountId.fromString("0.0.1234");
PrivateKey operatorKey = PrivateKey.fromString("...");
client.setOperator(operatorId, operatorKey);
}
}Before:
import com.hedera.hashgraph.sdk.AccountCreateTransaction;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.sdk.Hbar;
AccountCreateTransaction transaction = new AccountCreateTransaction()
.setKey(PrivateKey.generate().getPublicKey())
.setInitialBalance(Hbar.fromTinybars(1000))
.setAccountMemo("Test account");After:
import org.hiero.sdk.AccountCreateTransaction;
import org.hiero.sdk.PrivateKey;
import org.hiero.sdk.Hbar;
AccountCreateTransaction transaction = new AccountCreateTransaction()
.setKey(PrivateKey.generate().getPublicKey())
.setInitialBalance(Hbar.fromTinybars(1000))
.setAccountMemo("Test account");Before:
import com.hedera.hashgraph.sdk.TransferTransaction;
import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.Hbar;
TransferTransaction transferTx = new TransferTransaction()
.addHbarTransfer(AccountId.fromString("0.0.1234"), Hbar.fromTinybars(-1000))
.addHbarTransfer(AccountId.fromString("0.0.5678"), Hbar.fromTinybars(1000));After:
import org.hiero.sdk.TransferTransaction;
import org.hiero.sdk.AccountId;
import org.hiero.sdk.Hbar;
TransferTransaction transferTx = new TransferTransaction()
.addHbarTransfer(AccountId.fromString("0.0.1234"), Hbar.fromTinybars(-1000))
.addHbarTransfer(AccountId.fromString("0.0.5678"), Hbar.fromTinybars(1000));There are no breaking changes in this migration. The package name change is purely cosmetic and does not affect:
- API functionality
- Method signatures
- Class structures
- Return types
- Error handling
- Transaction behavior
The new org.hiero:sdk artifact maintains full compatibility with the previous com.hedera.hashgraph:sdk versions. You can directly replace the dependency coordinates without any code changes beyond the import statements.
- After updating dependencies, refresh your Gradle/Maven project
- Use "Optimize Imports" (Ctrl+Alt+O) to clean up unused imports
- Use "Find and Replace in Path" (Ctrl+Shift+R) for bulk import updates
- Refresh your project after updating build files
- Use "Organize Imports" (Ctrl+Shift+O) to clean up imports
- Use "Search > File Search" for bulk text replacements
- Use the Java extension's "Clean Workspace" command
- Use "Find and Replace" across files for bulk updates
Solution: Ensure all import statements have been updated and dependencies are correctly specified in your build files.
Solution: Check that test files have also been updated with the new imports and that test dependencies are correctly configured.
Solution: Refresh/reimport your project and clear any caches.
If you encounter any issues during the migration:
- Check that all import statements have been updated
- Verify that your build configuration files are correct
- Ensure your dependency resolution is working properly
- Test your application thoroughly
For additional support, create an issue in the Hiero SDK repository.
- Effective Date: The new
org.hiero:sdkartifact is available immediately - Deprecation: The
com.hedera.hashgraph:sdkartifact will continue to work but will eventually be deprecated - Recommendation: Migrate as soon as possible to ensure you're using the officially supported artifact
Note: This migration is part of the broader transition from the Hedera organization to the Hiero organization. The SDK functionality remains unchanged, and this is purely a namespace update to reflect the new organizational structure.