1

I wonder whether for each private/public key there correspond a unique public/private key?

Of course, it must be computationally infeasible to compute the private key from the public key, but does this hold for the other direction?

Could someone answer whether two users on the Ethereum blockchain could share the same private key, although they could not share the same public key (address of the EOA)?

In particular, what randomness goes into key generation such that two users does not end up with the same public key?

1 Answer 1

3

An ethereum private key is simply a number randomly chosen from the range 0 to about 2^256. This is an enormous range; the chance that two people independently the same private key is incredibly small (1 in 2^128).

The public key is determinsitically generated from the private key, such that the private key uniquely determines a public key.

Two different public keys could theoretically result in the same address, as the address is a truncated hash of the pubkey. Again, the chances of this are astronomically small- in this case 1 in 2^80, or 0.000000000000000000000082%

Edit for more details:

The public key in it's raw form is 65 bytes, (it's an x,y pair on an elliptic curve). It can be compressed to 33 bytes, though (take just the x and a parity byte)

The randomness source isn't specified, but most implementations will use their OS randomness source (/dev/urandom)

Again, while there is a chance of two peoples addresses colliding, there's a higher chance of being stuck by lightning while simultaneously winning the lottery about a trillion times.

2
  • Awesome answer. So, both the public and private key is 32 bytes? The address is obtained by hashing the public key in a deterministic way (and use only the first 20 bytes)? What (pseudo) randomness is employed to generate the private key (any fixed scheme)? If two public keys resulted in the same address, the new user could use the original users ether balance (how can users live with this risk)? Could you answer these questions? :-) +1
    – Shuzheng
    Commented Nov 8, 2017 at 7:14
  • There's a good step by step guide to manually generating an address here kobl.one/blog/create-full-ethereum-keypair-and-address Commented Nov 8, 2017 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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