Skip to main content

Send a Transaction

Once you have created your account and requested funds from the faucet you are ready to send your first transaction.

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.


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

Code Example

The following example will:

  1. Create an account manager.
  2. Get Alice's account which was created in the first guide.
  3. Send 1 SMR to an address using the Account.send_amount(addresses_with_amount, options) function. Make sure to update the code sample to send to the address of your choice.

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

// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

//! cargo run --example transaction --release
// In this example we will send a transaction
// Rename `.env.example` to `.env` first

use std::env;

use dotenv::dotenv;
use iota_wallet::{account_manager::AccountManager, AddressWithAmount, Result};

async fn main() -> Result<()> {
// This example uses dotenv, which is not safe for use in production

// Create the account manager
let manager = AccountManager::builder().finish().await?;

// Get the account we generated with `01_create_wallet`
let account = manager.get_account("Alice").await?;

// Set the stronghold password

// Send a transaction with 1 Mi
let outputs = vec![AddressWithAmount {
address: "rms1qpszqzadsym6wpppd6z037dvlejmjuke7s24hm95s9fg9vpua7vluaw60xu".to_string(),
amount: 1_000_000,
let transaction = account.send_amount(outputs, None).await?;

"Transaction: {} Block sent: {}/api/core/v2/blocks/{}",
transaction.block_id.expect("no block created yet")


Run the Example

Run the example by running the following command:

cargo run --example transaction --release

Expected Output

Transaction: 0x6b05d2023a690e60464b507653601d990bacb3eada64e04981b7c3a417c07500 
Block sent: http://localhost:14265/api/core/v2/blocks/0x1b6839d2de7a7d856ab2cd66a3325a8fe0618e2d5406d1295348133abd09ee8e