# What if I create a new address and I'm given one which clashes (already exists, it is being used by other user)

Addresses are like GUIDs, no? They are created randomly whenever you request the creation of a new address.

But what if when creating one, it clashes with one already created? I know that the probability of this is staggeringly low, but there is a probability, it is not impossible.

What would happen in this case?

## 4 Answers

A bitcoin address is a 20-byte hash of a 64-byte public key (plus an ID and checksum to bring it up to 25 bytes). As such, there are two theoretical possibilities with a clash:

• Two separate people own public keys which hash to the same value
• Two separate people own the same public key

Due to the way that Bitcoin transactions work, either of these situations would be enough for one party to spend the funds attached to the address.

So it's worth considering the likelihood of such a scenario. Let's assume we have 7 billion people on the planet and they all use Bitcoin. For there to be a 0.00000000001% chance of just two of the total in-use addresses clashing somewhere each person would need to have 4 trillion active addresses.

(Note that this is just calculating the chance of a hash collision; the chance of hitting the same keypair is so much more remote it's not worth bothering with).

• if every person in the planet ends up using bitcoin, and each person has 10 wallets, would it still be so low? – knocte Apr 13 '13 at 21:13
• Going back to the same question again, are you sure that by obtaining the same address, you would obtain the same private key? I think an address is a hash, and by having the hash you cannot obtain the private key, but you do in the other way around. So many private keys would resolve to the same hash. – knocte Apr 14 '13 at 16:13
• Sorry but I never asked about a duplicate key but about a duplicate address. Can you remove any parts of your reply that cover the "duplicate key" topic? – knocte Apr 14 '13 at 16:28
• Okay removed the various comments on the answer and just put it all directly in to the answer itself. – jgm Apr 14 '13 at 17:36
• Could you explain how you got that probability? – Jeremy Apr 14 '13 at 18:27

Coins sent to the shared address would appear in both wallets, but would then disappear from both of them when one of the persons spends them. As the network acknowledges and confirms that the coins have left that address, the wallet of the second person would be notified of this and decrease its value accordingly.

This would only affect coins sent to that specific address; the other coins in the two wallets would remain unrelated.

The first address would be able to spend bitcoins belonging to the second, and vice-versa.

The chances are suuuppppeeeer low, even when every person would have 1.000.000 wallets it would be super low.

And last but not least Bitcoin supports also the OP_HASH256 so if necessary the address range could be easily expanded to an even higher number. So do not worry ;-)

• While this is true, it doesn't answer the question that knocte posed. – Nick ODell Apr 13 '13 at 23:01