Skip to main content

Getting Started with Kotlin

Alpha Software

The IOTA SDK is currently in alpha. APIs, interfaces, and behavior may change without notice between releases. It is not yet recommended for production use.

The IOTA SDK Kotlin bindings allow JVM developers to interact with the IOTA network. These bindings use JNI (Java Native Interface) to bridge the performance of the Rust core SDK with the ease of use of Kotlin and Java.

Prerequisites

Before using the Kotlin bindings, ensure you have:

  • JDK: Version 11 or higher (JDK 17 recommended).
  • Build Tool: Gradle or Maven.
  • Architecture: The SDK currently supports x86_64 and ARM64 (macOS/Linux).

Installation

Gradle

Add the IOTA SDK dependency to your build.gradle.kts file:

bindings/kotlin/build.gradle.kts
loading...

Maven

Add the following to your pom.xml:

<dependency>
<groupId>org.iota</groupId>
<artifactId>iota-sdk</artifactId>
<version>0.0.1-alpha.4</version>
</dependency>
Native Library Loading

Since the Kotlin SDK wraps a Rust binary, the native library must be present in your library path. On some systems, you may need to specify the path manually when running your application:

java -Djava.library.path=/path/to/native/library -jar your-app.jar

Quick Start Example

The following example demonstrates how to initialize a client and retrieve the Chain ID using Kotlin.

1. Create a Main.kt

Create a new file and paste the following code:

bindings/kotlin/examples/ChainId.kt
loading...

2. Run the code

If using Gradle, run:

./gradlew run

What's Next?

Now that you have connected to the network, you can explore:

  • Wallet API: Manage high-level accounts and automated address syncing.
  • Secret Manager: Securely handle Mnemonic, Stronghold, or Ledger hardware wallets.
  • Output Builders: Create complex transaction outputs (NFTs, Alias, etc.).

View more comprehensive examples in the official Kotlin examples directory.