<p>In elliptic curve cryptography, public keys are derived from private keys, with seemingly random distribution.  You are correct that two different private keys could produce two different public keys that just so happen to hash to the same Bitcoin address.</p>

<p>A SCRIPT_SIG of the transaction that spends from that address would need to provide:</p>

<ol>
<li>A public key that hashes to that address</li>
<li>A signature of the transaction produced from a private key that matches the given public key</li>
</ol>

<p>Since two different key pairs could both meet this criteria, either one of them could spend the bitcoins.</p>

<p>However, this is <strong>very</strong> unlikely.  So much so, that it's not even worth considering as a possibility.  The best metaphor I've seen on why this isn't an issue is explained in this video:  <a href="https://www.youtube.com/watch?v=ZloHVKk7DHk" rel="nofollow">https://www.youtube.com/watch?v=ZloHVKk7DHk</a></p>

CC BY-SA 3.0
2016-04-04T19:26:24.850Z
2016-04-04T19:26:24.850Z
Jestin
<p>Both people would have access to any funds in the address. Whoever is first to spend these funds wins.</p>

<p>Of course, it is extremely unlikely that there will be such a collision.</p>

CC BY-SA 3.0
2016-04-04T00:38:26.547Z
2016-04-04T00:38:26.547Z
Meni Rosenfeld
<p>As @Meni answered, both people would have access to the funds.</p>

<p>To illustrate how unlikely this is to ever happen, consider the following simple attack:</p>

<pre><code>while True:
    genereate new keys and address
    if address has funds:
        transfer to ME
</code></pre>

<p>This attack can scan through an astronomical number of addresses each day. And it is so simple, anyone can carry it out and get rich! Except that it doesn't work. If it did, the bitcoin network would quickly collapse.</p>

<p>The reason it doesn't work is that the address space is so big, it is <strong>extremely</strong> unlikely for a collision to ever happen purely by chance (bugs in random generators are a different story...).</p>

CC BY-SA 3.0
2016-04-04T17:26:21.810Z
There is a nice paper on the topic that explains how unlikely it is to perform such an attack and get a profit http://diyhpl.us/~bryan/papers2/bitcoin/bitcoin-birthday.pdf
galileopy
CC BY-SA 3.0
2016-04-04T04:38:00.430Z
2016-04-04T17:16:01.887Z
2016-04-04T17:16:01.887Z
shx2
<p>Since the addresses are hashes of a public portion of a public/private ECDSA keypair, what would happen to two different people with different keys that hashes into the same address?
How would transactions to those addresses be handled?</p>

CC BY-SA 3.0
2016-04-04T07:48:45.750Z
related: [Is each Bitcoin address unique?](http://bitcoin.stackexchange.com/q/8804/5406)
Murch
<address><hash><ecdsa><key-collision>
How does Bitcoin handle address collisions?
Marco
# How does Bitcoin handle address collisions?

(Asked by: username_0 on 2016-04-03)

Since the addresses are hashes of a public portion of a public/private ECDSA keypair, what would happen to two different people with different keys that hashes into the same address?
How would transactions to those addresses be handled?

**Tags:** address, hash, ecdsa, key-collision

> **Comments:**
> **username_1**: related: [Is each Bitcoin address unique?](http://bitcoin.stackexchange.com/q/8804/5406)  

---

## 3 answers

### Answer by username_2 on 2016-04-04. Score: 0 | Accepted answer

In elliptic curve cryptography, public keys are derived from private keys, with seemingly random distribution. You are correct that two different private keys could produce two different public keys that just so happen to hash to the same Bitcoin address.

A SCRIPT\_SIG of the transaction that spends from that address would need to provide:

1. A public key that hashes to that address
2. A signature of the transaction produced from a private key that matches the given public key

Since two different key pairs could both meet this criteria, either one of them could spend the bitcoins.

However, this is **very** unlikely. So much so, that it's not even worth considering as a possibility. The best metaphor I've seen on why this isn't an issue is explained in this video: <https://www.youtube.com/watch?v=ZloHVKk7DHk>


---

### Answer by username_3 on 2016-04-04. Score: 2

Both people would have access to any funds in the address. Whoever is first to spend these funds wins.

Of course, it is extremely unlikely that there will be such a collision.


---

### Answer by username_4 on 2016-04-04. Score: 1

As @username_3 answered, both people would have access to the funds.

To illustrate how unlikely this is to ever happen, consider the following simple attack:

```
while True:
    genereate new keys and address
    if address has funds:
        transfer to ME

```

This attack can scan through an astronomical number of addresses each day. And it is so simple, anyone can carry it out and get rich! Except that it doesn't work. If it did, the bitcoin network would quickly collapse.

The reason it doesn't work is that the address space is so big, it is **extremely** unlikely for a collision to ever happen purely by chance (bugs in random generators are a different story...).

> **Comments:**
> **username_5**: There is a nice paper on the topic that explains how unlikely it is to perform such an attack and get a profit http://diyhpl.us/~bryan/papers2/bitcoin/bitcoin-birthday.pdf  

---

