<p>Creation of an address is an entirely offline operation; there is no communication with the network.</p>
<p>If you'd (with unfathomable luck) create the same address as someone else, then you'll see incoming payments to it appear in your wallet, and be able to spend them.</p>
<p>There is no provision for dealing with this, because there does not need to be any. The probability of this ever occurring is so mind-blowingly small that it is simply not a consideration.</p>
<p>For typical addresses, there exist 1461501637330902918203684832716283019655932542976 valid distinct ones.</p>

CC BY-SA 4.0
2021-02-20T03:38:28.020Z
"There is no provision for dealing with this" ... so if it happens, the consequences are not predictable. Coins can flow into and out of this wallet as in any other wallet. It would be like two people having keys to the same bank locker and anyone can take out stuff put in by the other person. Can I assume this and move forward ...
Calcutta
CC BY-SA 4.0
2021-02-20T03:40:04.697Z
Yes. But you can also assume this will never ever happen, so it doesn't matter.
Pieter Wuille
CC BY-SA 4.0
2021-02-20T16:30:04.140Z
By my calculations, the odds of collision are somewhere around 1.3349919e+86:1, assuming I understand the formulas correctly. There are about 7.7e+9 people on Earth, so even if everyone on Earth generated billions of addresses for personal use, the odds of even a single collision is less likely than a naturally occurring extinction-level event by a ridiculous number of orders of magnitude. It's about as statistically impossible as you can get.
phyrfox
CC BY-SA 4.0
2021-02-20T20:44:29.500Z
Basically if this happens, you can pick up your phone dial a random number, and ask the person on other side to move his funds to a new address as you just generated their address.
Anunay
CC BY-SA 4.0
2021-02-20T03:20:26.197Z
2021-02-20T03:20:26.197Z
Pieter Wuille
<p>I understand that one can create a Bitcoin wallet as a pair of numbers (public &amp; private key) with the right specifications and this is done quite easily in places like bitaddress.org</p>
<p>I also understand that the probability of generating two identical public keys is infinitesimally small -- lesser than the probability of being hit by an asteroid, or so I am told.</p>
<p>But it is not zero.</p>
<p>My question is - if a duplication occurs, a hash collision happens, how does the protocol (a) detect it and (b) deal with it. In a simple, everyday hash table application, we do a lookup on the existing hashed values and if we detect a collision we ignore the last created value and generate a new one.</p>
<p>Is there a similar protocol in bitcoin address generation?</p>

<address-generation><key-collision>
How does the Bitcoin protocol deal with address collisions in wallets?
Calcutta
# How does the Bitcoin protocol deal with address collisions in wallets?

(Asked by: username_0 on 2021-02-20)

I understand that one can create a Bitcoin wallet as a pair of numbers (public & private key) with the right specifications and this is done quite easily in places like bitaddress.org

I also understand that the probability of generating two identical public keys is infinitesimally small -- lesser than the probability of being hit by an asteroid, or so I am told.

But it is not zero.

My question is - if a duplication occurs, a hash collision happens, how does the protocol (a) detect it and (b) deal with it. In a simple, everyday hash table application, we do a lookup on the existing hashed values and if we detect a collision we ignore the last created value and generate a new one.

Is there a similar protocol in bitcoin address generation?

**Tags:** address-generation, key-collision


---

## 1 answers

### Answer by username_1 on 2021-02-20. Score: 8 | Accepted answer

Creation of an address is an entirely offline operation; there is no communication with the network.

If you'd (with unfathomable luck) create the same address as someone else, then you'll see incoming payments to it appear in your wallet, and be able to spend them.

There is no provision for dealing with this, because there does not need to be any. The probability of this ever occurring is so mind-blowingly small that it is simply not a consideration.

For typical addresses, there exist 1461501637330902918203684832716283019655932542976 valid distinct ones.

> **Comments:**
> **username_0**: "There is no provision for dealing with this" ... so if it happens, the consequences are not predictable. Coins can flow into and out of this wallet as in any other wallet. It would be like two people having keys to the same bank locker and anyone can take out stuff put in by the other person. Can I assume this and move forward ...  
> **username_1**: Yes. But you can also assume this will never ever happen, so it doesn't matter.  
> **username_2**: By my calculations, the odds of collision are somewhere around 1.3349919e+86:1, assuming I understand the formulas correctly. There are about 7.7e+9 people on Earth, so even if everyone on Earth generated billions of addresses for personal use, the odds of even a single collision is less likely than a naturally occurring extinction-level event by a ridiculous number of orders of magnitude. It's about as statistically impossible as you can get.  
> **username_3**: Basically if this happens, you can pick up your phone dial a random number, and ask the person on other side to move his funds to a new address as you just generated their address.  

---

