Proof of ownership of a contract

by Eth Dev   Last Updated January 14, 2018 06:28 AM

How would someone be able to prove they own an ethereum contract to another user in a simple way?

If we save a public key in the contract as belonging to the owner of the contract, and then outside the blockchain the user encrypts a specific message with that private key associated to it, and sends it to another person, they can verify the message was encrypted with that token. Is this a secure way to verify the ownership of a contract?

Tags : solidity

Answers 1

It sounds to me like there are two, separable, steps here:

  1. Store in a contract something that indicates its owner.
  2. Prove that you (a person) are the indicated owner.

For (1), I would recommend just storing an address in a public state variable in the contract.

If I understand correctly what you're doing, (2) is a bit subtle. It's easy to just sign a message with your private key and have someone else recover the corresponding address. But all that does is prove that the message was signed by the contract's owner. It doesn't prove that the person who handed you that message is the contract's owner. (Perhaps the owner signed the message and sent it to A, who then presented it to B. This would be a MITM attack.)

Perhaps the message can indicate the owner in another way. For example, the owner could sign a message with an email address, and now we know for sure that this is the email address of the owner.

There are also MITM-resistant protocols, like Diffie-Hellman key exchange.

Without knowing exactly what's happening in the step where someone proves they're the owner, it's hard to give a really concrete answer.


Another thought: generate a 256-bit secret (random number) and store the hash of it in the contract. Then show someone the preimage of the hash (the secret) to prove that you're the one who put that hash in there.

This is, again, subject to MITM attacks and only proves that someone is in possession of the secret (not necessarily that they're the originator).

January 14, 2018 05:56 AM

Related Questions

excluding msg.sender from list

Updated June 24, 2017 11:28 AM

How to convert an bytes to address in Solidity?

Updated June 24, 2017 11:28 AM

Making exceptions from a list

Updated June 25, 2017 10:28 AM

What does _ (underscore) do?

Updated June 30, 2017 22:28 PM