What is the easiest way to get the address of the deployer from a contract (assuming I have the contract addresses of course)? It's possible to see on etherscan, but I was wondering if there was a way to get it programmatically. Do I need to scan the transactions in the block of the contract creation to find it?
1 Answer
It is nearly impossible to do this easily without monitoring all transactions (and internal transactions). Since Etherscan is doing this, they can provide this information.
When you monitor all transactions you will most likely find most of the contract creations (transactions without a to
). But quite some contracts are created by using the create
and create2
opcodes. These are internal transactions and can not be detected by purely monitoring the transactions in each block.
This is also the reason why Blockscout (which does not trace internal transaction) does not display deployment information (and neither code) for some contracts.
-
oh I see. Unfortunately etherscan doesn't provide this info in their API, only on their GUI. I guess the easiest way to get this info then is to monitor the transactions. Do you have any tips for how to find the ones that are created with the create and create2 opcodes?– lapuritaCommented Jan 7, 2022 at 13:24
-
I think that I have found a way to do this with the etherscan API. I just retrieve all the transactions for the contract address and the first one will always be the contract creation? And then the "from address" on that transaction will be the contract deployer– lapuritaCommented Jan 7, 2022 at 13:41