1

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 2

3

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.

1
  • @AnAllergyToAnalogyi think you are correct but not at 100%. It is possible to find the address. See my answer bellow.
    – Akall
    Feb 10, 2023 at 17:36
0

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.

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.