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:

dependencies {
implementation("org.iota:iota-sdk:0.0.1-alpha.4")
}

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 connect to the IOTA Testnet and retrieve the Chain ID.

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 more advanced features:

  • Accounts and Addresses: create a mnemonic, derive addresses, and check coin balances.
  • Transactions: build, sign, and send Programmable Transaction Blocks (PTBs), including staking and reusing command results.
  • Queries: query owned objects, events, and transactions with the GraphQL client.

View more comprehensive examples in the official Kotlin examples directory.