0

It is known that Ethereum addresses are generated by hashing the pubkey (ref. this post). However, I'm not certain that a single pubkey corresponds to a single address.

Use case

I would like to implement a schema of token exchanges where a user can send a single token only once (a kind of voting). The user generates a keypair and derives an address from the public key. The user then discards the keypair. I would like to be sure that a voter can't generate another address using the same keypair causing me to count his token twice.

2
  • 1
  • 1
    Could you clarify whether you're asking "Can the same address come from two different private keys?" (Yes, but it's hard to find such a collision.) or "Can the same private key produce two different addresses?" (No.) or maybe "Can the same public key produce two different addresses?" (No for the same reason.)
    – user19510
    Commented Dec 12, 2017 at 14:15

2 Answers 2

1

As pointed out in the comments:

Could you clarify whether you're asking "Can the same address come from two different private keys?" (Yes, but it's hard to find such a collision.) or "Can the same private key produce two different addresses?" (No.) or maybe "Can the same public key produce two different addresses?" (No for the same reason.) – smarx

answers my question perfectly. Thank you.

0

Why don't you solve the "double spending" problem simply by keeping balances, as with the balances variable in a standard contract?

1
  • The idea is as follows: there will be a contract that will mint the tokens. The number of voters is well known (n - the total number of voters). Any new user is able to withdraw a single token from the mint. The withdrawal history can be tracked by keeping track if an address has withdrawn it's token from the mint. If an address tries to withdraw a token from the mint twice, it will fail. However, this only makes sense if only a single address can be derived from a public key. A balance variable can't solve this issue if the opposite is true. Commented Dec 12, 2017 at 14:02

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.