Skip to main content

Generate a Mnemonic

The following example will generate a mnemonic using a Client instance. Since this functionality doesn't need to communicate with any nodes, you can start your Client in offline mode.

The following code example will:

  1. Create a Client in offline mode.
  2. Use the created client to generate a mnemonic.

Code Examples

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

//! cargo run --example generate_mnemonic --release

use iota_client::{Client, Result};

async fn main() -> Result<()> {
let mnemonic = Client::generate_mnemonic()?;

println!("Mnemonic: {mnemonic}");


Run the example by running the following command:

cargo run --example generate_mnemonic --release

Expected Output

Mnemonic: glance zoo dove legend razor season evoke twenty flush solution essence destroy loud traffic friend decorate emotion total borrow expect actor switch shock zer