Skip to content

Instantly share code, notes, and snippets.

@hoytech
Created December 16, 2017 14:31
Show Gist options
  • Save hoytech/9fb8d6c9a78674e6d4ec3eeb512b5b55 to your computer and use it in GitHub Desktop.
Save hoytech/9fb8d6c9a78674e6d4ec3eeb512b5b55 to your computer and use it in GitHub Desktop.
// https://www.reddit.com/r/ethdev/comments/7jyzlw/50_in_ether_prize_for_puzzle_in_this_tweet/
// npm i bip39 ethereumjs-wallet allcombinations shuffle-array
const bip39 = require("bip39");
const hdkey = require('ethereumjs-wallet/hdkey');
const allcombinations = require('allcombinations');
const shuffle = require('shuffle-array');
let words = 'bright summer public tenant avocado chef depend romance school reason help start';
let allCombinationsGenerator = allcombinations(shuffle(words.split(' ')));
let total = 0, totalok = 0;;
for (let comb of allCombinationsGenerator) {
total++;
let joined = comb.join(' ');
let valid = bip39.validateMnemonic(joined);
if (!valid) continue;
totalok++;
if (totalok % 1000 === 0) console.log(`${totalok}/${total}`);
let hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(joined));
let wallet = hdwallet.derivePath("m/44'/60'/0'/0").getWallet();
if (wallet.getAddress().toString("hex") === '684c2a81a42e3511c9961eeb93e31c4890b07e0f') {
console.log(joined);
process.exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment