Skip to main content

Send a Transaction

Wallet.rs

Though it is possible to send transactions with iota.rs, we strongly recommend that you use the official wallet.rs library together with the stronghold.rs enclave for value-based transfers. This combination incorporates the best security practices while dealing with seeds, related addresses, and UTXO.

The following code example will:

  1. Create a Client which will connect to the Shimmer Testnet.
  2. Create a SecretManager from a mnemonic.
  3. Generate a public address.
  4. Build and post a block with an output address and amount to send.
  5. Log the transaction.
Iota.js

You can also find this guide in the native iota.js library

Code Example

Dotenv

This example uses dotenv, which is not safe to use in production environments.

client/examples/block/transaction.rs
loading...

Run the Example

Run the example by running the following command:

cargo run --example transaction --release

Expected Output

Transaction sent: https://explorer.shimmer.network/testnet/block/0x0e4c43eb9402aad8af70bbabfc4eb43ca4b603feb77d7bbcec43ccd06d9389bb