Skip to main content

Run Code Examples

Each language has different set up instructions you need to follow to get the code examples up and running.

Prerequisites

Before you can run the examples, please refer to the Rust Getting Started guide to install the library.

Clone the Repository

To run the rust examples, you will first need to clone the repository. You can do so by running the following command:

git clone git@github.com:iotaledger/iota.rs.git

Set Up Your .env file

After you have cloned the project, you should:

  1. Move into the project directory by running the following command:
cd iota.rs
  1. Create your .env file by making a copy of the .env.example file by running the following command:
cp .env.example .env

Run Code Examples

The iota.rs library has numerous examples you can run to get acquainted with the library. After you have followed the instructions to install the library, you can run any example with the following command from the examples directory:

cargo run --example node_api_core_get_health --release

Examples List

You can replace the node_api_core_get_health by any other example from the Rust examples directory.

You can get a full list of examples by running the following command:

cargo run --example