29

I am wondering whether each bitcoin address is unique. I would assume yes. Then, how is this enforced given the distributed address generation?

As I understand it, each time an address is generated, a new key-pair is also generated. On what basis is this done? Since the address is the hash of the public half of the key-pair that would also allow (at least theoretically) multiple public keys to have the same hash.

Murch
  • 75,206
  • 34
  • 186
  • 622
dexter
  • 393
  • 1
  • 3
  • 5
  • If you are afraid someone will find your key, spread your wealth among several different addresses you control. – zundi Nov 22 '17 at 06:52

4 Answers4

31

TL;DR: There are so many addresses that it is improbable that anyone will ever generate a duplicate of another address in use – as long as random number generators work as they should.

2^160 possible addresses

Bitcoin addresses consist of an alphanumerical string with a length of up to 34 characters, excluding the capital "O", the capital "I" and the lowercase "l", as well as the number "0". This would allow for 58^34 possible combinations, however, as some of the positions are used for a checksum this is reduced to 2^160 valid addresses. The checksum on the other hand allows to detect mistyped addresses as invalid, so that it is highly unlikely to accidentally input another valid address.

Chance of 3.42*10^(-27) for a collision at one trillion addresses

Even if we generously assume that at some point there will be one trillion addresses (approx. 160 for each of this planet's population), according to the simple approximation formula for the Birthday attack given on Wikipedia, the chance is 3.42*10^(-27) that any two of those Bitcoin addresses collide. In comparison, the figure of addresses that were ever used to receive bitcoins was just over 13 million in May 2013.

Address space could be augmented

Especially as the protocol at any point could be adapted to accept even longer addresses, we can say, yes, it is theoretically possible, but unlikely enough that we can assume for our purposes that it will never happen.*

It's impractical to generate addresses for gain

To answer your other question: For each address there apparently are 2^96 different private keys whose corresponding public key will map to the same address. So to actually try to pursue Bitcoin theft, it would be much more sensible to just generate random private keys and hope to find one that has a corresponding address with money on it. In all likelihood the power for such calculations would cost more than anyone could earn with such a scheme.

*As long as certain random number generators work as well as they should... :)

Murch
  • 75,206
  • 34
  • 186
  • 622
10

It is enforced simply having such an enormous number of addresses, that generating one equal to another one is so unlikely it can be considered as good as impossible.

o0'.
  • 5,240
  • 6
  • 39
  • 66
  • 2
    So, what would be the chance of two addresses to be the same? – dexter Mar 28 '13 at 10:47
  • @dexter so small it's irrelevant. If you want actual figures there are plenty of threads asking that, you may search for them if you like. – o0'. Mar 28 '13 at 10:51
  • 2
    Actually, if your random number generator provider is flawed (hello Debian and most recently NetBSD) it might occur that two generated addresses collide. – Stéphane Gimenez Mar 28 '13 at 14:52
  • Does bitcoin use the system rng? Sounds dangerous. – alamar Mar 28 '13 at 15:09
  • @StéphaneGimenez so what? If something is broken, it will damage something else. That happens, like, everywhere? – o0'. Mar 28 '13 at 16:53
  • 1
    @dexter If this answer solved your question, you should click the checkmark next to it to show that this answer solved your question (that's how this site works). – jobukkit May 18 '13 at 12:29
  • @dexter an address is a 160-bit number (so 2^160 possible addresses). Given the birthday paradox, if I didn't screw the math the probability of a collision givien n addresses is 1 - (2^160)! / (2^160 - n)! / (2^160)^n. – kaoD Jan 08 '14 at 21:36
  • Probability and reality are different things for me. Murphy law is there to show. I am really curious if exists any code check and secure behave if the wallet from the person which has they wallet address "cloned". What happens with the balance of the first/original wallet? Do they lose everything? or does the second wallet gain all balance? – ceinmart Oct 27 '21 at 20:33
  • 1
    @ceinmart they would both be able to access the same balance in that specific address – o0'. Nov 03 '21 at 11:08
5

By the pigeonhole principle yes, there could be two bitcoin addresses that are the same.

The Pigeonhole Principle states, that if there are N items for M spots with N > M then there must be at least 2 of the N items in one of the M spots.

For Bitcoin this means we want/need but might never reach an infinite amount of addresses for an infinite amount of transactions. (but we can reuse addresses; I dont want to get into that) But each addresses is mapped into a space. The space is a certain size (however long addresses are). So by the principle above N = number of transactions/needed addresses = trending to infinity (if bitcoin goes on forever) and M = the size of the address space.

Well, fitting infinity into a finite space means, there would be two of the same addresses. But our finite space is so large that it will take us a long time to fill it up, and the possibility of filling a space of M twice is so small in this case, it's for all intents and purposes zero.

Murch
  • 75,206
  • 34
  • 186
  • 622
KDecker
  • 487
  • 2
  • 8
  • 13
  • 4
    The pidgeon hole principle is a bad fit here, because N is not anywhere close to the size of M, let alone actually larger. The only part of the answer that actually addresses the question is the last sentence which remains vague. – Murch Aug 24 '16 at 22:41
-1

The chance for someone to steal your money

In Numbers

There are 2^160 possible Bitcoin addresses

2^160 is

1 quindecillion 461 quattuordecillion 501 tredecillion 637 duodecillion 330 undecillion 902 decillion 918 nonillion 203 octillion 684 septillion 832 sextillion 716 quintillion 283 quadrillion 19 trillion 655 billion 932 million 542 thousand 976

or

1 461 501 637 330 902 918 203 684 832 716 283 019 655 932 542 976

possible Bitcoin addresses

In Grains of sand

In truth it is impossible for the human brain to properly and completely visualize an astronomical number like this

There are an estimated 2^63 (or about 7 Quintilian) grains of sand on planet Earth

If you divide 2^160 / 2^63 you get 1.5845633e+29 or

158 456 330 000 000 000 000 000 000 000

Thats 1 grain of sand in 30 digit number of Earths

or 1 grain of sand in 158 456 330 000 000 000 000 billion Earths

In Years

If you generate 100 000 private keys per second and check if each one has positive balance to steal it will take you

463 439 120 000 000 000 000 000 000 000 000 000

years to guess the private key of some of the addresses of Satoshi Nakamoto for example

In Game

We have a tool called Coin Hunter which you can use to try different insecure private keys

Here is with the letters from the alphabet and you can see how this addresses had some balance at one point

alphabet private keys