10

There is a very very low chance for the same private key to be generated. (source)

However, what happens when my generated private key matches a private key that is already used?

Does the protocol reject private keys if they are already used?

If not, what kind of damage will be done?

3 Answers 3

11

However, what happens when my generated private key matches a private key that is already used?

Then you got lucky, and can spend someone else's coins.

Does the protocol reject private keys if they are already used?

No, how should it? Keys can be used more than once in normal operation.

Fortunately, it is extremely unlikely that this ever happens. See also these two related questions.

2
  • Is the length of the private key going to be changed in the future?
    – Pacerier
    Jun 18, 2012 at 3:51
  • 1
    It is hard to make predictions, especially about the future, but I would assume that Bitcoin will eventually support (and encourage) other algorithms or key lengths if the current one becomes insecure (just like SSL certificates are now being issued with longer keys). The old ones would still be working, but you'd want to migrate your coins over to the more secure keys.
    – Thilo
    Jun 18, 2012 at 4:10
7

This is like worrying that your house will get hit by two asteroids. There are so many ways your house can get destroyed that are millions of times more likely. So it's not rational to worry about this, except for the second or two it takes to realize that it's not worth worrying about. For example, a collision on the hash of the public key is about 80 billion, billion, billion times more likely.

4
  • 1
    Ic. I'm not really worried about it, but more of wanting to know what-happens-next when it does.
    – Pacerier
    Jun 18, 2012 at 9:27
  • It won't ever happen since long before it does, the entire system will have been radically redesigned due to the problem of public key hash collisions. Jun 18, 2012 at 10:35
  • Ok, the word "possible" is ambiguous and has many definitions. I was talking about in the mathematical sense, where "possible" means > 0.
    – Pacerier
    Jun 18, 2012 at 12:34
  • There is no conceivable solution to this problem. If the protocol could detect such a conflict, the odds would be billions of times higher that it was due to an electrical flaw in the computer than that it was due to an actual random conflict. Jun 18, 2012 at 20:46
2

The Bitcoin protocol does not enforce anything from the wallet, asides requiring specific ECDSA curve to be used for key generation. If you happen to generate a keypair colliding with another keypair, congratulations, it's a very rare occurrence ! Same if your public key will hash into the same Bitcoin address (in theory you could have two different keypairs that have the same address associated with them).

The consequence for such an occurrence is that both of the owners of the keys can spend the money associated with the corresponding address, not an ideal situation. If you are lucky, you might be able to steal someone's Bitcoins (but shame on you if you do), but most likely you'll just come across some address that was used only once, as the standard client has a tendency of generating new keypairs for every transaction in order to protect your anonymity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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