# What are the odds of getting same address or private-key or 12/24 set of mnemonic to 2 different people

Questions!!

1. What are the chances that 2 people get the same set of those 12 or 24-word mnemonic??

2. In web3.js, there is a function ' web3.eth.accounts.wallet '... It spits out a set of accounts and private keys... What are the odds of getting the wallet or address ?? (I think its related to the question above)

3. (Noobie question) Let's say I generated a wallet. now,

• is it possible to create 12/24 mnemonic from that wallet (mostly no but still I need your point of view)
• If I want to create my own wallet using javascript, how can I get that functionality to generate that set of mnemonic (a feature used by Metamask)
• "What are the odds of getting the wallet or address ??" What do you mean by this? – Morten Jun 21 '20 at 18:58
• Look at ethereum.stackexchange.com/questions/4299/… and its Linked questions like ethereum.stackexchange.com/questions/1115/… – eth Jun 21 '20 at 19:09
• @Morten I mean if we create a wallet (that contain a set of addresses) ... can 2 people get same wallet( set of addresses ) or same address ( singular unit [ may be one of them ] ) – SAHIL SIKARWAR Jun 22 '20 at 5:51
• Also @Morten ... one more question ... ( let take an example of MyEtherWallet.com ) They generate a 12/24 word mnemonic. Now suppose I get a set of mnemonic. now, what are the chances that you go to that same website and get the same set of mnemonic? – SAHIL SIKARWAR Jun 22 '20 at 5:55
• @SAHILSIKARWAR Unless they use a weak random number generator, the website you go to does not change the probability of generating the same mnemonic phrase. A private key is 256 bits long, so the chance to guess it is 2^-256, just like a 24 word mnemonic, like I explained below. – Morten Jun 22 '20 at 9:53

What are the chances that 2 people get the same set of those 12 or 24-word mnemonic?

Mnemonic phrases are generated from 128 bits (12 words) to 256 bits (24 words) of entropy. The probability to guess a mnemonic phrase is 2^-128 to 2^-256, which is very small. The longer the mnemonic phrase, the smaller the chance to guess it though.

Is it possible to create 12/24 mnemonic from that wallet?

Mnemonic phrases only go one way. You generate a mnemonic phrase, and derive a private key from that. You cannot "import" a private key into the mnemonic phrase, without brute forcing the mnemonic phrase. As explained above, that would be near impossible.

Here is a more detailed explanation of mnemonic phrases.

If I want to create my own wallet using javascript, how can I get that functionality to generate that set of mnemonic

You can use Ethers.js to generate a random mnemonic phrase:

``````import { utils } from 'ethers';

const entropy = utils.randomBytes(16);
const mnemonicPhrase = utils.entropyToMnemonic(entropy);
``````

This will generate a random 12 word mnemonic phrase. If you want to generate a 24 word mnemonic phrase, change `utils.randomBytes(16)` to `utils.randomBytes(32)` instead.