Skip to main content

Mint Native Tokens

You can use a node running the stardust update to mint native tokens. To do so, you will only need to add some funds to your account, define the native token's options and call the Account.mint_native_token(native_token_options, options) function.

Online Faucet

You can request test funds from the Shimmer Testnet Faucet.

Code Example

The following example will:

  1. Create an account manager.
  2. Get Alice's which was created in the first guide.
  3. Create the NativeTokenOptions.
  4. Mint the native token by calling the Account.mint_native_token(native_token_options, options) function.

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

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

//! cargo run --example mint_native_token --release
// In this example we will mint a native token
// Rename `.env.example` to `.env` first

use std::env;

use dotenv::dotenv;
use iota_wallet::{account_manager::AccountManager, NativeTokenOptions, Result, U256};

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

// First create an alias output, this needs to be done only once, because an alias can have many foundry outputs
let transaction = account.create_alias_output(None, None).await?;
"Transaction: {} Block sent: {}/api/core/v2/blocks/{}",
transaction.block_id.expect("no block created yet")

// Wait for transaction to get included
.retry_until_included(&transaction.block_id.expect("no block created yet"), None, None)


let native_token_options = NativeTokenOptions {
alias_id: None,
circulating_supply: U256::from(100),
maximum_supply: U256::from(100),
foundry_metadata: None,

let transaction = account.mint_native_token(native_token_options, None).await?;
"Transaction: {} Block sent: {}/api/core/v2/blocks/{}",
transaction.transaction.block_id.expect("no block created yet")

Run the Example

Run the example by running the following command:

cargo run --example mint_native_token --release

Expected Output

Transaction: 0xaa9737fb4007e8b0f4c181d6923b0e3547ae178c23c25233985bb22f61c84de7 
Block sent: http://localhost:14265/api/core/v2/blocks/0x807dbdde107008dcc9acae29a0e32c261590bef13e5f5d8d3bb60949e633abd8