Hey guys
Is there any way to get all the address of a given seed phrase ?

Jan 13, 2023, 5:51 PM
You can with web3.py or js
There is a website too that will compute the addresses, but beware
Jan 13, 2023, 5:52 PM
https://iancoleman.io/bip39/
Jan 13, 2023, 5:52 PM
yea that is it, but use it offline (at least)
Jan 13, 2023, 5:52 PM
or the Iron Coleman guy may nuke your wallet
Jan 13, 2023, 5:53 PM
Thanks for the help mate
Jan 13, 2023, 5:53 PM
Cant be too careful with that stuff
Jan 13, 2023, 5:53 PM
check this in node


//you can use console.log() instead of debugcode to display the results
const debugCode = require('debug')('app:debug');

const { ethers , Wallet } = require("ethers");

const mnemonic = Wallet.createRandom().mnemonic;

//incase you know the nemonic words then you can comment the line above and uncomment the line below
//const mnemonic = "XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX";


//increment the last number to get the second account
const wallet1 = ethers.Wallet.fromMnemonic(mnemonic,"m/44'/60'/0'/0/0");
const wallet2 = ethers.Wallet.fromMnemonic(mnemonic,"m/44'/60'/0'/0/1");
const wallet3 = ethers.Wallet.fromMnemonic(mnemonic,"m/44'/60'/0'/0/2");

debugCode(mnemonic);

debugCode("The public Address is "+wallet1.address+" and the private key is "+wallet1.privateKey);
debugCode("The public Address is "+wallet2.address+" and the private key is "+wallet2.privateKey);
debugCode("The public Address is "+wallet3.address+" and the private key is "+wallet3.privateKey);
Jan 13, 2023, 5:56 PM
I think its a huge amount of unique addresses if im not mistaken
Jan 13, 2023, 6:05 PM
Well the website is not giving me the same exact like the metamask does
Jan 13, 2023, 6:06 PM
i guess it uses a different index
the site is what ledger refers to if you need to get the private key of the seed phrase, and do a emergency recovery.. i use it to generate test wallets
Jan 13, 2023, 6:08 PM
Yea might be
Is there any GitHub repo that does so ?
Jan 13, 2023, 6:09 PM
you can do it with python or nodeJs with a loop, i dont know if the index will follow the same pattern
Jan 13, 2023, 6:12 PM
You have to iterated through the mnemonic, remember that you can create an infinite wallets from the same mnemonic
Jan 13, 2023, 6:35 PM
not infinite, just a very huge amount
Jan 13, 2023, 6:36 PM
are you sure?
Jan 13, 2023, 6:39 PM
2^256 unique private keys i think it is
Jan 13, 2023, 6:40 PM
maybe not infinite but a huge amount of them
Jan 13, 2023, 6:40 PM
it's infinite in the sense that we won't have enough resources to iterate through all
Jan 13, 2023, 6:41 PM
I have created this function that will use ethers.js to get the specific amount of mnemonic wallet, I hope it will help you

export const walletListFromMnemonic = (mnemonic, amount = 5) => {
let HDNode = ethers.utils.HDNode.fromMnemonic(mnemonic, null, ethers.wordlists.en);

let walletList = [];
for (let i = 0; i < amount; i++) {
const derivedNode = HDNode.derivePath(`m/44'/60'/0'/0/${i}`);
walletList.push(derivedNode.address)
}
return walletList;
}
Jan 13, 2023, 6:41 PM
I would use the term near infinite, or near impossible then
Jan 13, 2023, 6:45 PM

© 2024 Draquery.com All rights reserved.