Hedera
Search…
Recover keys from a mnemonic phrase
Recover private keys from a mnemonic phrase.
V2
V1
Method
Type
Description
PrivateKey.fromMnemonic(<mnemonic>)
Mnemonic
Recover a private key from a mnemonic phrase compatible with the iOS and Android wallets
PrivateKey.fromMnemonic(<mnemonic, passphrase>)
Mnemonic. String
Recover a private key from a generated mnemonic phrase and a passphrase
Java
1
//Use the mnemonic to recover the private key
2
PrivateKey privateKey = PrivateKey.fromMnemonic(mnemonic);
3
PublicKey publicKey = privateKey.publicKey();
4
​
5
//v2.0.0
Copied!
JavaScript
1
//Use a recovered mnemonic to recover the private key
2
const recoveredMnemonic = await Mnemonic.fromString(mnemonic.toString());
3
const privateKey = await recoveredMnemonic.toPrivateKey();
4
​
5
//v2.0.5
Copied!
Go
1
recoveredKey, err := hedera.PrivateKeyFromMnemonic(mnemonic, "")
2
publicKey := recoveredKey.PublicKey()
3
​
4
//v2.0.0
Copied!
Method
Type
Description
Ed25519PrivateKey.fromMnemonic(<mnemonic>)
Mnemonic
Recover a private key from a mnemonic phrase compatible with the iOS and Android wallets
Ed25519PrivateKey.fromMnemonic(<mnemonic, passphrase>)
Mnemonic, String
Recover a private key from a generated mnemonic phrase and a passphrase
Java
1
//Use the mnemonic to recover the private key
2
Ed25519PrivateKey privateKey = Ed25519PrivateKey.fromMnemonic(mnemonic);
Copied!
JavaScript
1
//Use the mnemonic to recover the private key
2
Ed25519PrivateKey privateKey = Ed25519PrivateKey.fromMnemonic(mnemonic);
Copied!
Copy link