When we create an account in the Ethereum main network, how does the protocol guarantee the unique address of an account? Since even if we are not connected to the network we can create an account, is there a possibility of two accounts getting the same address? Is the account information kept in the blockchain ?

up vote 8 down vote accepted

Quoting Chris613 on ethereum forum about cpp ethereum :

  1. A 256-bit Private Key is initialized with random data

  2. The secret is tested for being an acceptable key, which just means non-zero and less than "the order of the curve" which I think is an upper range after which keys are weak (corrections welcome).

  3. A 512-bit Public Key is generated from that secret and tested by secp256k1_ecdsa_pubkey_verify. I don't fully understand this check without more research (key types), but my understanding is that any number can be a valid secret key, and generating a public key from it should always be reliable (corrections welcome).

  4. The Public Key is hashed with SHA-3 [Keccak-256] to produce a 256-bit output. The upper 96 bits are discarded, and the lower 160 bits become the Address.

So as the hashing algorithm used for the address has a very very big number of possibilities and a very very low rate of collisions, final addresses should be unique.

As you can't guess a PK from its address, creating a PK that matches the address would require to try a lot of PK combinations before finding a match. So this is not about brute-forcing addresses, but trying public keys and then private keys to finally match an address.

None is known to have succeed to do it today.

A quantum computer could probably do that but one able to do this sort of calculation still doesn't exist. Next generation of crypto money will have to take quantum computer in account for sure.

Edit: Private keys must be less than the order of the curve because otherwise they will 'loop back around' and be equal to other people's private keys, due to how EC groups work. Think of an analogue clock: at 13:00, the clock points to 1. What's happening here is similar, but using a much larger number (just under 2^256). On a clock this is fine because we know whether it's morning or afternoon, but here same private key => same public key => same address, meaning if two private keys are equivalent, the owners of both could access and form valid transactions originating from the same account.

The public key check is checking it's a valid, rational point of the curve. This is pretty much just checking that the two 256 bit numbers are whole numbers and satisfy a formula necessary for all the arithmetic to hold correctly.

Hash functions are actually not entirely broken under quantum cryptography, so the address -> public key stage could still be fairly robust. However, calculating people's private keys from their public keys would be trivial, and so next gen cryptocurrencies will have to take in quantum crypto indeed!

Ethereum addresses are 160 bit hashes, meaning there are 2^160 possible hashes. Per the birthday problem, the chance of a collision rises to 50% when there are about 2^80 accounts created.

To give you an idea of how unlikely that is, if every person on earth spent all their time doing nothing but generating Ethereum accounts, and they generated one a second, they'd only generate about 2^57 of them. To generate 2^80 and reach a 50% probability of finding a collision, they'd need to keep on generating one per second for about 8 million years.

In short, the way Ethereum guarantees account uniqueness is by having such a mindbogglingly large number of possible addresses that no conceivable random process could ever generate a duplicate. This is also how account security is ensured - if you can generate a duplicate key hash, you can also steal someone's ether!

  • 5
    Another interesting comparison: There's an estimated 2^63 grains of sand on Earth. Far less grains of sand than the total possible number of accounts – dbryson May 27 '16 at 3:56

This is a slight deviation from the question but, finding a colliding private key and attempting to withdraw the funds may be grounds for legal intervention.

There are distributed efforts like the LBC that attempt to find private keys and detail of how they are going about doing so is shown.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.