0

How to get the creator of a contract from the code of another contract? I tried to look at the functions coming with type address but no luck

edit: I know you can with tools like etherscan, however the question is how to do from code.

1
  • Is the "other contract" created by you? If so, you can catch the msg.sender and store it in a public variable.
    – pors
    Aug 29, 2018 at 13:12

1 Answer 1

2

Not all contracts need to declare an owner. Declaring an owner is only necessary in cases where there are actions that only an owner can do, or in the case of a contract you send funds to, in which case you can self destruct and send it to a specific address.

Edit: To find the creator of a contract, you can use something like etherscan.io, put in the contract address and look for the first transaction related to the contract. The sender of that transaction is the creator of the contract.

Edit 2: Misread that this was meant to be only within Solidity. I think this is impossible but I can't say for sure.

4
  • I wrote owner, actually I mean "creator". Is there any means to retrieve it?
    – Davide C
    Sep 21, 2017 at 14:51
  • Yes, check my edit for the answer.
    – wtk219
    Sep 21, 2017 at 15:03
  • the question is about how to do from solidity code. Etherscan is not an option here
    – Davide C
    Sep 21, 2017 at 15:10
  • 1
    My bad, I think that this is impossible but I'm not sure.
    – wtk219
    Sep 21, 2017 at 15:37

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.