Skip to content

Instantly share code, notes, and snippets.

@voltrevo
Last active May 2, 2024 17:56
Show Gist options
  • Save voltrevo/df7c306d0ccad3bbff3cec95a3ec752a to your computer and use it in GitHub Desktop.
Save voltrevo/df7c306d0ccad3bbff3cec95a3ec752a to your computer and use it in GitHub Desktop.
Test bip39 seedphrases

The following is a well known test seed phrase:

test test test test test test test test test test test junk

During development, it's beneficial to use seedphrases which are obviously meant for testing, so using test for the first 11 words is helpful. Since only 4 bits of 12-word bip39 seedphrases are for the checksum, 1 in 16 phrases are valid by chance. This gives us many additional options for the last word if you need more than one seedphrase:

test test test test test test test test test test test absent
test test test test test test test test test test test actual
test test test test test test test test test test test agree
test test test test test test test test test test test alone
test test test test test test test test test test test analyst
test test test test test test test test test test test apart
test test test test test test test test test test test ask
test test test test test test test test test test test aunt
test test test test test test test test test test test ball
test test test test test test test test test test test bean
test test test test test test test test test test test beyond
test test test test test test test test test test test blast
test test test test test test test test test test test boat
test test test test test test test test test test test boy
test test test test test test test test test test test bulb
test test test test test test test test test test test cabbage
test test test test test test test test test test test camera
test test test test test test test test test test test cargo
test test test test test test test test test test test cattle
test test test test test test test test test test test cherry
test test test test test test test test test test test churn
test test test test test test test test test test test cloth
test test test test test test test test test test test combine
test test test test test test test test test test test control
test test test test test test test test test test test cover
test test test test test test test test test test test critic
test test test test test test test test test test test curious
test test test test test test test test test test test dance
test test test test test test test test test test test decline
test test test test test test test test test test test deliver
test test test test test test test test test test test dice
test test test test test test test test test test test discover
test test test test test test test test test test test door
test test test test test test test test test test test drill
test test test test test test test test test test test eagle
test test test test test test test test test test test either
test test test test test test test test test test test enable
test test test test test test test test test test test enlist
test test test test test test test test test test test eternal
test test test test test test test test test test test exercise
test test test test test test test test test test test expand
test test test test test test test test test test test fame
test test test test test test test test test test test female
test test test test test test test test test test test filter
test test test test test test test test test test test flip
test test test test test test test test test test test fossil
test test test test test test test test test test test frown
test test test test test test test test test test test game
test test test test test test test test test test test gas
test test test test test test test test test test test glory
test test test test test test test test test test test gown
test test test test test test test test test test test grunt
test test test test test test test test test test test hair
test test test test test test test test test test test heavy
test test test test test test test test test test test hood
test test test test test test test test test test test hungry
test test test test test test test test test test test ignore
test test test test test test test test test test test initial
test test test test test test test test test test test input
test test test test test test test test test test test item
test test test test test test test test test test test junk
test test test test test test test test test test test key
test test test test test test test test test test test lab
test test test test test test test test test test test leaf
test test test test test test test test test test test lift
test test test test test test test test test test test lizard
test test test test test test test test test test test magic
test test test test test test test test test test test make
test test test test test test test test test test test material
test test test test test test test test test test test mercy
test test test test test test test test test test test minute
test test test test test test test test test test test mixed
test test test test test test test test test test test movie
test test test test test test test test test test test narrow
test test test test test test test test test test test nest
test test test test test test test test test test test notable
test test test test test test test test test test test okay
test test test test test test test test test test test once
test test test test test test test test test test test outside
test test test test test test test test test test test page
test test test test test test test test test test test patch
test test test test test test test test test test test photo
test test test test test test test test test test test pill
test test test test test test test test test test test plate
test test test test test test test test test test test popular
test test test test test test test test test test test priority
test test test test test test test test test test test pudding
test test test test test test test test test test test purse
test test test test test test test test test test test rabbit
test test test test test test test test test test test raw
test test test test test test test test test test test remove
test test test test test test test test test test test result
test test test test test test test test test test test rice
test test test test test test test test test test test ritual
test test test test test test test test test test test rubber
test test test test test test test test test test test say
test test test test test test test test test test test scorpion
test test test test test test test test test test test seat
test test test test test test test test test test test settle
test test test test test test test test test test test shoe
test test test test test test test test test test test sing
test test test test test test test test test test test sleep
test test test test test test test test test test test smart
test test test test test test test test test test test sound
test test test test test test test test test test test source
test test test test test test test test test test test spot
test test test test test test test test test test test still
test test test test test test test test test test test strategy
test test test test test test test test test test test summer
test test test test test test test test test test test sure
test test test test test test test test test test test switch
test test test test test test test test test test test tell
test test test test test test test test test test test then
test test test test test test test test test test test tip
test test test test test test test test test test test tomorrow
test test test test test test test test test test test trade
test test test test test test test test test test test tribe
test test test test test test test test test test test twelve
test test test test test test test test test test test unique
test test test test test test test test test test test use
test test test test test test test test test test test usual
test test test test test test test test test test test video
test test test test test test test test test test test vivid
test test test test test test test test test test test waste
test test test test test test test test test test test weather
test test test test test test test test test test test wheel
test test test test test test test test test test test winter
test test test test test test test test test test test zero
const ethers = require('ethers'); // v6
function isValidSeedPhrase(seedPhrase) {
try {
ethers.Wallet.fromPhrase(seedPhrase);
return true;
} catch {}
return false;
}
function findValidSeedPhrases() {
const prefix = 'test '.repeat(11);
let validSeedPhrases = [];
for (let i = 0; i < 2048; i++) {
const seedPhrase = `${prefix}${ethers.wordlists.en.getWord(i)}`;
if (isValidSeedPhrase(seedPhrase)) {
validSeedPhrases.push(seedPhrase);
}
}
return validSeedPhrases;
}
console.log(findValidSeedPhrases().join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment