Skip to main content

Getting Started with Go

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 Go bindings allow you to build high-performance applications that interact with the IOTA network using native Go code. These bindings wrap the core Rust SDK via a Foreign Function Interface (FFI).

Prerequisites​

Before using the Go bindings, ensure you have:

  • Go: Version 1.21 or higher.
  • CGO: Enabled (required for the Rust-to-Go FFI layer).

Installation​

Add the IOTA SDK to your Go project using go get:

go get github.com/iotaledger/iota-sdk-go

The package automatically includes pre-built native libraries for most modern operating systems (Windows, macOS, and Linux).

Quick Start Example​

The following example demonstrates how to connect to the IOTA Testnet and retrieve the Chain ID.

1. Create a main.go file​

Create a new file named main.go and paste the following code:

bindings/go/examples/chain_id/main.go
loading...

2. Run the code​

In your terminal, run:

go run main.go

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 Go examples directory.