Skip to content

Mnemonic

A mnemonic can be created using entropy or the crypto.Rand package

Mnemonic using Entropy

NewMnemonicFromEntropy returns the mnemonic generated by the given entropy.

mnemonic, err := txbuilder.NewMnemonicFromEntropy(entropy)

Random Mnemonic

NewMnemonic returns a new mnemonic using the crypto.Rand package.

mnemonic, err := txbuilder.NewMnemonic()

Addresses

Using the Mnemonic you can generate the correct address using the following functions:

  • MnemonicToCosmosAddressWithPath(mnemonic, hdPath, prefix)
  • MnemonicToCosmosAddress(mnemonic, prefix) // It uses the default hdPath
  • MnemonicToEthereumAddressWithPath(mnemonic, hdPath, prefix)
  • MnemonicToEthereumAddress(mnemonic, prefix) // It uses the default hdPath
  • MnemonicToAddressWithPath(mnemonic, hdPath, prefix, algo) // For internal use