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.
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.
- Rust
- Nodejs
- Python
- Java
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:
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
Prerequisites
Before you can run the examples, please refer to the Node.js 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:
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.
Install Dependencies
Before you can try out the examples, you must install the necessary dependencies using npm. You can do this by running
the following command from the binding/nodejs
directory:
npm i
Build the Library
Once you have set up your .env
file and installed the necessary dependencies
, you can build the library by running the following command:
npm run build
Run the Examples
The wallet.rs library has numerous examples you can run to get acquainted with the library. Once you followed the instructions to build the library and installed the dependencies, you will need to select one of the Node.js examples. Run the selected example with your local Node.js interpreter.
Install Dependencies
Before you can run any example, you should install their dependencies by running the following command from the
/bindings/nodejs/examples
directory:
npm i
To run examples, you will need to change to the wallet/bindings/nodejs/examples
directory, and run any example.
The following command will run the 10-node-info.js
example:
node 10-node-info.js
Prerequisites
Before you can run the examples, please refer to the Python Getting Started guide to install the library.
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 wallet/bindings/python
directory:
python3 example/[example file name]
Where [example file name] is one of the examples.
For instance, to run
00_get_info.py
,
you should run:
python3 examples/00_get_info.py
Prerequisites
Before you can run the examples, please refer to the Java 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:
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 IOTA Wallet Java library has numerous examples
you can run to get acquainted with the library. You can run any example with the following
command from the examples
directory:
.././gradlew run -Pexample=CreateAccount
To run another example of your choice, replace CreateAccount
with the name of any other example from the Java examples directory.