-
-
Save manniru/60786890efc772539d197e9fb8af3ae8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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