2

I'd like to maintain ownership of a set of contracts for a period of time to build them out, but eventually I'd like to relinquish ownership so that the users don't have to trust me to not steal their ethers. My idea is to just set the owner to address 0x1111111111111111111111111111111111111111 like so:

function relinquishOwnership() onlyOwner {
    owner = 0x1111111111111111111111111111111111111111;
}

Is it safe to assume that nobody owns this address? And is this a safe way of ensuring that nobody has ownership of the contract? Is there a better way to do this?

1

You cannot know if an address is owned or not, or will be owned in the future. So I think this approach will not lead to what you want.

Instead I would suggest to introduce a way to turn the ownership feature off.

  • Add a new variable, bool ownershipEnabledfor example, to your contract.
  • Add a modifier that allows execution of a function if ownershipEnabledis set to true and use it with your functions that can be carried out by the owner only. Alternatively you could modify your onlyOwnermodifier accordingly.
  • Once you want to relinquish ownership, you call a function that setsownershipEnabled to false.

If you don't include a function to set ownershipEnabled to true, your ownership feature can never again be turned on.

| improve this answer | |
  • Ah good idea, I didn't think of that! I would imagine the probability of somebody owning an address of such low entropy would be very low, but yours is still a better/safer solution. – Jonah Apr 29 '18 at 7:24

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.