1

I am using bitcoinlib in python to create bitcoin wallet as shown here. My question is that how random private keys are which are generated by bitcoinlib?

For example Alice has private key '5ThisIsMyPrivateKey' which was created by some other program (bitcoin core, coinbase, hitbtc or anyone) and I am using bitcoinlib and I have a wallet for Bob and Bob's private key generated by bitcoinlib can be '5ThisIsMyPrivateKey'? What is possibility of it?

Another question is that is there a possibility of having same public key of two or more private key? I have seen lots of different private key structure when I was looking for information and I found three of examples where private keys starts with "5", "K" and "L" so is it possible that same public address can be created by using either of private key version?

I am still new here at encryption and bitcoin and I am just looking for information.

Thanks for your time.

3

When you create a private key, this process is (or at least should be) completely random - meaning that in theory, the probability of creating some specific private key is 1/N where N is the number of possible private keys. There's nothing stopping someone from creating an already created private key, except chance.

A private key is made up of 256 completely random bits. Thus, the number of possible private keys is 2^256 (approximately 10^77) and the chance of getting a certain exact private key is 10^-77. It's hard to overstate how tiny this probability is - for example, it's roughly equal to the number of hydrogen atoms in the observable universe. We can treat this probability as essentially 0.

is there a possibility of having same public key of two or more private key?

Yes, absolutely. There is nothing preventing two private keys from being associated with the same public key - however, the only way of finding such a case would be through brute force (generating keys until you find a pair that match, and as we learnt above bruteforcing 256 bits is essentially impossible. Even doing a birthday attack - where you generate keys until ANY two of the generated match, you will still have to create 10^38 keys before a 50% chance of collision.

Also, if by public key you are referring to bitcoin addresses, then this can very easily be mathematically proven to be true by the pigeonhole principle. There are 2^256 possible private keys but only 2^160 possible addresses - so it's impossible to have each private key generate a unique address.

  • You're welcome. Feel free to upvote too if it helped :) – mxbi Jan 3 '18 at 23:05
  • I tried to upvote first but I don't have enough reputation to do it. But I want to tell here that it is really good answer and It helped me a lot to understand more in depth about behind the scene of bitcoin. – Amit Pandya Jan 4 '18 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.