Hedera
Search…
Generate a mnemonic phrase
Generate a 12 or 24-word mnemonic phrase that can be used to recover the private keys that are associated with it.
V2
V1
Method
Type
Description
Mnemonic.generate24()
Mnemonic
Generates a 24-word recovery phrase that can be used to recover a private key
Mnemonic.generate12()
Mnemonic
Generates a 12-word recovery phrase that can be used to recover a private key
Java
1
// 24-word recovery phrase
2
Mnemonic mnemonic = Mnemonic.generate24();
3
System.out.println("mnemonic 24 word = " + mnemonic);
4
​
5
​
6
//12 word recovery phrase
7
Mnemonic mnemonic12 = Mnemonic.generate12();
8
System.out.println("mnemonic 12 word = " + mnemonic12);
9
​
10
//v2.0.0
Copied!
JavaScript
1
// generate a 24-word mnemonic
2
const mnemonic = await Mnemonic.generate();
3
​
4
console.log(mnemonic)
Copied!
Go
1
//Generate 24 word mnemonic
2
mnemonic24, err := hedera.GenerateMnemonic()
3
​
4
if err != nil {
5
panic(err)
6
}
7
​
8
privateKey, err := mnemonic24.ToPrivateKey( /* passphrase */ "")
9
​
10
if err != nil {
11
panic(err)
12
}
13
​
14
publicKey := privateKey.PublicKey()
15
​
16
fmt.Printf("mnemonic = %v\n", mnemonic)
17
​
18
//v2.0.0
Copied!
Method
Description
Mnemonic.generate()
Generates a 24 word mnemonic phrase
Java
1
Mnemonic mnemonic = Mnemonic.generate();
2
​
3
//1.3.2
Copied!
JavaScript
1
const mnemonic = Mnemonic.generate();
2
//v1.4.4
Copied!
Copy link