Skip to main content

Getting Started With Rust

Password Storage

Never store passwords or seeds on a host's environment variables or in the source code in a production setup. Please follow our backup and security recommendations for production use.

Requirements

  • Rust and Cargo.
  • (for Linux only) libudev. You can install it with apt install libudev-dev.

Include the Library in Your Cargo.toml

The only thing you need to do to start using the library is to add it as dependency in your Cargo.toml file:

[dependencies]
iota-client = { git = "https://github.com/iotaledger/iota.rs", branch = "develop" }
tokio = { version = "1.22.0", features = [ "full" ] }

Use the Library

This example fetches node information.

use iota_client::{Client, Result};

#[tokio::main]
async fn main() -> Result<()> {
// Create a client with that node.
let client = Client::builder()
.with_node("https://api.testnet.shimmer.network")?
.with_ignore_node_health()
.finish()?;

// Get node info.
let info = client.get_info().await?;

// Print node info.
println!("{info:#?}");

Ok(())
}

What's Next?

Now that you are up and running, you can get acquainted with the library using its how-to guides and the repository's code examples.