<p>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.</p>

CC BY-SA 3.0
2012-06-18T09:27:58.983Z
Ic. I'm not really *worried* about it, but more of wanting to know *what-happens-next* when it does.
Pacerier
CC BY-SA 3.0
2012-06-18T10:35:27.357Z
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.
David Schwartz
CC BY-SA 3.0
2012-06-18T12:34:55.073Z
Ok, the word "possible" is ambiguous and has many definitions. I was talking about in the mathematical sense, where "possible" means > 0.
Pacerier
CC BY-SA 3.0
2012-06-18T20:46:23.470Z
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.
David Schwartz
CC BY-SA 3.0
2012-06-18T08:55:22.197Z
2012-06-18T08:55:22.197Z
David Schwartz
<p>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).</p>

<p>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.</p>

CC BY-SA 3.0
2012-06-18T11:18:50.907Z
2012-06-18T11:18:50.907Z
ThePiachu
<blockquote>
  <p>However, what happens when my generated private key matches a private key that is already used?</p>
</blockquote>

<p>Then you got lucky, and can spend someone else's coins.</p>

<blockquote>
  <p>Does the protocol reject private keys if they are already used?</p>
</blockquote>

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

<p>Fortunately, it is <em>extremely</em> unlikely that this ever happens. See also these two <a href="https://bitcoin.stackexchange.com/questions/3679/has-someone-compared-the-cost-of-mining-vs-that-of-brute-forcing-addresses">related</a> <a href="https://bitcoin.stackexchange.com/questions/22/is-it-possible-to-brute-force-bitcoin-address-creation-in-order-to-steal-money">questions</a>.</p>

CC BY-SA 3.0
2012-06-18T03:51:26.097Z
Is the length of the private key going to be changed in the future?
Pacerier
CC BY-SA 3.0
2012-06-18T04:10:17.703Z
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
CC BY-SA 3.0
2012-06-18T03:31:06.970Z
2012-06-18T03:31:06.970Z
2017-04-13T12:47:33.660Z
Thilo
<p>There is a very very low chance for the same private key to be generated. (<a href="https://en.bitcoin.it/wiki/Weaknesses#Generating_tons_of_addresses">source</a>)</p>

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

<p>Does the protocol reject private keys if they are already used?</p>

<p>If not, what kind of <em>damage</em> will be done?</p>

<protocol><attack><private-key>
Does the protocol ensures that private keys are unique?
Pacerier
# Does the protocol ensures that private keys are unique?

(Asked by: username_0 on 2012-06-18)

There is a very very low chance for the same private key to be generated. ([source](https://en.bitcoin.it/wiki/Weaknesses#Generating_tons_of_addresses))

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?

**Tags:** protocol, attack, private-key


---

## 3 answers

### Answer by username_3 on 2012-06-18. Score: 11 | Accepted answer

> 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](https://bitcoin.stackexchange.com/questions/3679/has-someone-compared-the-cost-of-mining-vs-that-of-brute-forcing-addresses) [questions](https://bitcoin.stackexchange.com/questions/22/is-it-possible-to-brute-force-bitcoin-address-creation-in-order-to-steal-money).

> **Comments:**
> **username_0**: Is the length of the private key going to be changed in the future?  
> **username_3**: 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.  

---

### Answer by username_1 on 2012-06-18. Score: 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.

> **Comments:**
> **username_0**: Ic. I'm not really *worried* about it, but more of wanting to know *what-happens-next* when it does.  
> **username_1**: 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.  
> **username_0**: Ok, the word "possible" is ambiguous and has many definitions. I was talking about in the mathematical sense, where "possible" means > 0.  
> **username_1**: 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.  

---

### Answer by username_2 on 2012-06-18. Score: 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.


---

