Skip to main content

Getting Started with Rust

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 Rust SDK is the core library for interacting with the IOTA network. It provides a native Rust interface for building high-performance applications, and serves as the foundation for all other language bindings.

Prerequisites​

Before using the Rust SDK, ensure you have:

  • Rust: Version 1.75 or higher (installed via rustup).
  • Cargo: Included with the Rust toolchain.

Installation​

cargo add iota-sdk@=3.0.0-alpha.1

Quick Start Example​

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

1. Create a new project​

cargo new iota-quickstart
cd iota-quickstart

2. Install the SDK​

Install the SDK as mentioned above and also add tokio as a dependency for asynchronous support.

3. Write src/main.rs​

Replace the contents of src/main.rs with the following:

crates/iota-sdk/examples/chain_id.rs
loading...

4. Run the code​

cargo 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 Rust examples directory.