I have some bytecode and would like to find the contract address that it belongs to. Is there an easy way to do this?
2 Answers
No, the bytecode of a contract is generated by a compiler when your contract is compiled, not when it is deployed. When a contract is deployed, its address is deterministically computed based on the address of the creator. See this question for how contract addresses are computed.
-
@AnAllergyToAnalogyi think you are correct but not at 100%. It is possible to find the address. See my answer bellow.– AkallFeb 10 at 17:36
It is possible but quite difficult do to so.
If you have the opcodes, you need to compile then to runtime bytecode. Then, you have to manually loop through each transaction, and check every transaction that is being sent to address 0. If the msg.data contains the bytecode you have, that means this is the transaction that created your contract. From there you can find the address of the contract.