Ethereum Asked by good_evening on August 26, 2021
Let’s say I forgot first 2 words of the seed. I want to write a program that brute-forces all possible bip-39 word combinations for the first 2 words, generate private/public keys, addresses, and go through first 10 addresses to check if there’s ether stored in there, and in that case, get a notification. How could I achieve it? I guess I must download the whole Ethereum blockchain, what else?
You only need the first two words and the password if used (salt). Assuming you didn't use any salt your salt is the static value "mnemonic" that leaves you with 2048 * 2048 = ~ 4194304 possible options based on bip-0039 english dictionary.
You can use a tool like https://github.com/sc0tfree/mentalist to generate the permutation from the mnemonic dictionary or script it yourself.
Dictionary; https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
Answered by cucrisis on August 26, 2021
Use ganache cli to create the first 10 accounts from mnemonic. This will last less than a second and then you stop and restart with another permutation. So you can write a simple script to create the seeds and find the according accounts with a simple grep.
$ ganache-cli -h 0.0.0.0 --mnemonic "mimic dune forward party defy island absorb insane deputy obvious brother immense"
Expected output:
Ganache CLI v6.9.1 (ganache-core: 2.10.2)
Available Accounts
==================
(0) 0xfe84Ab89b7Fc902Ff3CfD756403a8f085B1639Aa (100 ETH)
(1) 0x9DC64b2558b458A15C7f01c192D874Ef460f0A29 (100 ETH)
(2) 0x94F57ed7e9af03A10e8EB23CE1B3c7914a182b0f (100 ETH)
(3) 0x936188f2C3C8E8c95e425b6fe41c2ac9E701585e (100 ETH)
(4) 0x95f29431AEb52C0D5DbEEEC36010b8e2CA69CB3D (100 ETH)
(5) 0x19356cc2300833E690088a5a09A2044A3CC2A1E2 (100 ETH)
(6) 0x8861CdFa38838531275cE12F9e795C3b9fF29cBE (100 ETH)
(7) 0x0712e8e819712C3bfdb098CE51C87a4Ac0296fd8 (100 ETH)
(8) 0xAA33d7188Eb4b4A51C37199eaaD2f73cf2bF0204 (100 ETH)
(9) 0xead34b583404E3Cb0C9b97C2d1C486BE67Be9F30 (100 ETH)
Private Keys
==================
(0) 0x6b657c280147dd393162442cda5f55b8af7c59986237f4c602531d1e994d5a6d
(1) 0x6c9ad2b70a3ca6e989a0715b710f3ed689b1cfe4c1494ede70241762ffb76c9b
(2) 0x50f58d79e0b89e2f4070721184eaa96fd5c3d096d4885969cf3fac70aaf522cd
(3) 0xfa30d0923973acd541d3dd3e9f8c2d253b7ecd52b316478f9dd24c88d7eff16d
(4) 0x407a6090c4b168dab2680cba8c4e6ff54b9d58ada126607b4451c9a4646f029b
(5) 0xe820b165e308ac2a2b32cc2fd4d694373b9910ce216ebeddcec10dbc2091c618
(6) 0x0402143af3ed84c7d05ce13b8601733a6e9c01d287f30e481f180bb38174aae7
(7) 0x5ca5f7763a6b5d49deca6620803ec47c4dd910380e8e9cf7780857b95318a1a3
(8) 0x6708567060a74fe47d7f9b9e7a5af1bc30ffbc641566c96f6413323591042a3c
(9) 0xf15dabfb20f3e891e7a9308bb3acb5498200b968ca4feebf8e2e9e561ee71778
HD Wallet
==================
Mnemonic: mimic dune forward party defy island absorb insane deputy obvious brother immense
Base HD Path: m/44'/60'/0'/0/{account_index}
Gas Price
==================
20000000000
Gas Limit
==================
6721975
Call Gas Limit
==================
9007199254740991
Listening on 0.0.0.0:8545
Answered by Markus Sprunck on August 26, 2021
For those wondering how many combinations have to be tried in the worst case scenario:
f(N) = Binomial[2048-(N-2), 2] * 2
with 2048
being the number of words in the wordlist and N
being the number of words in your seed phrase.
The factor 2
results from the two possible orders, in which the words can appear.
For a seed phrases with lengths of 12
, 18
, and 24
words, this would result in
f(12)= 4151406
f(18)= 4126992
f(24)= 4102650
combinations, respectively.
(I cannot comment.)
Answered by M. Heuer on August 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP