Skip to main content

Run Code Examples

You can use the following how-to guides to get acquainted with wallet.rs from creating an account to minting NFTs and native tokens.

You can start anywhere, but since the guides may build on previous examples, if you are new to wallet.rs you should probably start by creating a wallet account and then carry on to the next guide.

Requirements

Hornet Node

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

Shimmer Testnet

You can use the following public, load-balanced endpoint to run code examples:

Node URL

https://api.testnet.shimmer.network

Faucet URL

https://faucet.testnet.shimmer.network/api/enqueue

Language Specific Instructions

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

Password Storage

It is not recommended to 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.

Prerequisites

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

Set Up Your .env file

The code examples use a .env file to store variables. You can download the example file or create a new one with the following variables:

wallet/.env.example
loading...

The .env.example uses public Shimmer Beta URLS. If you want to use another node, 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