Skip to main content

Getting Started with Rust

Safe Password Storage

In a production setup, do not store passwords in the host's environment variables or in the source code. See our backup and security recommendations for production setups.



We recommend you update Rust to the latest stable version rustup update stable.

The library uses cmake and openssl. You may need install additional build tools on your system to run the build process successfully using Cargo.


You can install all needed prerequisites on Windows with Chocolatey. If you have any of the tools already installed just remove them from the command

Install Chocolatey with

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))

and install the needed packages with

choco install visualstudio2022buildtools visualstudio2022-workload-vctools rust-ms msys2 llvm


You can install cmake and openssl with Homebrew by running the following commands:

brew install cmake
brew install [email protected]
# you may want to add this to your .zshrc or .bashrc since you'll need it to compile the crate
OPENSSL_ROOT_DIR=$(brew --prefix [email protected])


You can install cmake and openssl with your distro's package manager or download from their websites. On Debian and Ubuntu you will also need the build-essential package.

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:

iota-wallet = { git = "", branch = "develop" }
tokio = "1.21.2"

Use the Library

In order to use the library, you need to create an AccountManager:

use std::path::PathBuf;

use iota_wallet::{
secret::{stronghold::StrongholdSecretManager, SecretManager},
ClientOptions, Result,

async fn main() -> Result<()> {
// Shouldn't be hardcoded in production
// mnemonic can be generated with `manager.generate_mnemonic()?` and will be the only way to recover your funds if
// you loose the stronghold file/password, so be sure to save it securely
let nonsecure_use_of_development_mnemonic = "endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river".to_string();
let stronghold_password = "some_hopefully_secure_password";

// Setup Stronghold secret_manager
let mut secret_manager = StrongholdSecretManager::builder()

// The mnemonic only needs to be stored the first time

// Create the accounts_and_addresses manager with the secret_manager and client options
let client_options = ClientOptions::new().with_node("http://localhost:14265")?;

let manager = AccountManager::builder()

// Create a new accounts_and_addresses, this will automatically generate an address
let account = manager

"Generated a new accounts_and_addresses with addresses {:?}",


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.