There is a contract which source code tells that the contract address had been generated in advance (there is a comment there), before the contract was uploaded to the network.

The address beginning is quite unusual: 0x000000...

As you can see, it shows that address was specially generated to have these zeros. One can think that these zeros are the simple luck, but the contract uses two additional addresses to its purposes and they begin 0x100000... and 0x200000...

How is this possible to upload th contract to the specific address and do this mean that the author have a privat key for the contract as it have been generated in advance?

1 Answer 1


How is this possible to upload a contract to a specific address, and does this mean that the author has a private key for the contract as it has been generated in advance?

The address for a contract is computed from the address of its creator (sender) and how many transactions the creator has sent (nonce). The sender and nonce are RLP-encoded and then hashed with Keccak-256. See this answer for more details.

So to answer your question, it is indeed possible to upload a contract to a specific address by calculating that address in advance (as described above), but this fact does not imply that the author has a private key for the contract.

Note that the author of a contract doesn't really a private key for it, because they can simply implement and restrict specific functions to themselves.

  • So, as I understand to deploy a contract to the specific address X one have to use an address Y which gives (with a certain nonce) the desired contract address? So it's possible to set the nonce to a specific value and go over a pile of random addresses checking if one of them gives the desired contract address. One will have to check really many addresses to find that one. Is there an app to do it?
    – Jink
    Mar 1, 2020 at 2:49
  • I understand that authors can implement a specific function to themselves but as I know, such a function will be clearly visible through the source code and there is no way to hide it, am I right? Whilst the existence of the private key cannot be revealed by anyone.
    – Jink
    Mar 1, 2020 at 2:50
  • @Jink: For your first question - no. In my answer above, I did not suggest that you can choose any address that you want and be able to find a way to deploy your contract to that address. I just said that it is possible to upload a contract to a specific address. It doesn't mean that you can choose that address at will. It only means that you can know it in advance (i.e., before you deploy the contract). Mar 1, 2020 at 9:38
  • @Jink: For your second question - yes. Mar 1, 2020 at 9:38
  • So, if it impossible to choose the address to deploy a contract at will how it is possible that the contract was deployed to the address 0x000000...? It is obvious that the address was chosen, because, as I said, the author use two similar addresses 0x100000... and 0x200000....
    – Jink
    Mar 1, 2020 at 14:20

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.