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.

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?

  • 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. – user3223162 Dec 12 '17 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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