Generating 12 word seed phrases for Exodus/Trust Wallet

Rayan Fernandes
1 min readSep 19, 2023

--

Hey there, superstar!

Here’s a simple function to generate a 12-word seed phrase. I’ll use a list of words, which typically comes from the BIP39 word list, but for simplicity, I’ll just use a small sample. You should replace this with the actual BIP39 list for true randomness and security.

The list can be found at https://www.blockplate.com/pages/bip-39-wordlist

const sampleWords = [
"apple", "banana", "cherry", "date", "elderberry", "fig",
"grape", "honeydew", "kiwi", "lemon", "mango", "nectarine",
// ... (this should be expanded to include the full BIP39 word list)
];

function generateSeedPhrase() {
let seedPhrase = [];
for (let i = 0; i < 12; i++) {
const randomWord = sampleWords[Math.floor(Math.random() * sampleWords.length)];
seedPhrase.push(randomWord);
}
return seedPhrase.join(' ');
}

console.log(generateSeedPhrase()); // This will print a random 12-word phrase from the sample

Note:

The above code is just for demonstration. In a real-world application, you’d use the full BIP39 word list (which contains 2048 words) for generating seed phrases. And remember, seed phrases are sensitive, so be careful when generating and storing them. It’s critical not to expose these to potential attackers or save them in insecure locations.

--

--