Skip to main content

derive_signing_key

Function derive_signing_key 

Source
pub fn derive_signing_key(
    mnemonic_str: &str,
    account: u32,
    index: u32,
) -> Result<SigningKey, CoreError>
Expand description

Derives an Ed25519 signing key from a BIP39 mnemonic at the given account and index.

Uses the MultiversX wallet derivation path: m/44’/508’/{account}‘/0’/{index}

§Arguments

  • mnemonic_str - BIP39 mnemonic phrase (12 or 24 words)
  • account - Account number in the derivation path (typically 0 for relayer, 1+ for stress testing)
  • index - Address index within the account

§Returns

The Ed25519 signing key, or an error if derivation fails.

§Examples

use mx_core::derive_signing_key;

let mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
let key = derive_signing_key(mnemonic, 0, 0).unwrap();