Getting Started with Rust
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.
Install the IOTA SDK
The IOTA SDK requires
Cargo. You can find installation instructions in
the Rust documentation.
We recommend that you update the Rust compiler to the latest stable version first:
rustup update stable
You must also install
openssl. You may need to install additional build tools on
your system to run the build process successfully using Cargo.
You can install
openssl with your distro's package manager or download them from their websites.
On Debian and Ubuntu, you will also need the
You can install
brew install cmake [email protected]
./vcpkg.exe install openssl:x64-windows
./vcpkg.exe integrate install
# You may want to add this to the system environment variables since you'll need it to compile the crate
choco install openssl
# You may need to set the OPENSSL_DIR environment variable
set OPENSSL_DIR="C:\Program Files\OpenSSL-Win64"
Install the SDK Using Cargo
- Cargo add
To start using the IOTA SDK in your Rust project, you can include it as a dependencies in your project's
Cargo.toml by running:
cargo add iota-sdk
To start using the IOTA SDK in your Rust project, you can include the following line under
dependencies in your
iota-sdk = "1.0.0"
Build the SDK from Source
Download the repository to any directory you choose:
git clone https://github.com/iotaledger/iota-sdk
Move to the base directory:
Build the SDK by running the following:
To use the Client module, you simply need to create a
To use the Wallet module, you need to create a
For this example to work
features = ["stronghold"] is needed in the Cargo.toml import. To persist the wallet in a database,
"rocksdb" can be added.
You can use the provided code examples to get acquainted with the IOTA SDK. You can use the following command to run any example:
cargo run --release --all-features --example example_name
example_nameis the name from the Cargo.toml name from the example folder. For example:
cargo run --release --all-features --example node_api_core_get_info
You can get a list of the available code examples with the following command:
cargo run --example
The IOTA SDK Rust API Reference is in the crate documentation.