Skip to main content

Run Code Examples

Hornet Node

Most of the examples require a Hornet Node running the Stardust upgrade. You can connect to a node you trust, use the public API, run your own node or run a local private tangle

Public API

You can use the Shimmer Testnet as well as its Faucet to quickly run the examples.

Run Your Own Node

If you want direct access to the Tangle, you can set up a HORNET node using docker.

Run a Local Private Tangle

If you want to run the examples locally, you can set up a private tangle in a few simple steps.

Language Specific Instructions

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/wallet.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 wallet.rs
  1. Create your .env file by making a copy of the .env.example file by running the following command:
cp .env.example .env

You should update the NODE_URL and FAUCET_URL values to match the Hornet node you want to use.

Run Code Examples

The wallet.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 0_generate_addresses --release

Examples List

You can replace the 0_generate_addresses 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