I've been reading as much around this as possible, but cannot verify a contract which relies on openzeppelin imports, because the compiled bytecode differs from the deployed bytecode.

I deployed an ERC721 contract using REMIX, I didn't verify it immediately on Etherscan, I only tried to verify it after a few weeks. Meantime, the Remix on my browser was updated once after the deployment. Not sure will this has an effect on the bytecode.

I didn't change any of the code in the contract. I compile with

compiler: v0.8.12+commit.f00d7308
optimisation: no

The methods that I've tried to verify the contract:

  1. Directly on Etherscan (flattened contract)
  2. Using Hardhat (flattened and unflattened contract)
  3. Using Remix with a plugin called "ETHERSCAN - CONTRACT VERIFICATION"

Deploying a new contract is not an option for me, I was wondering is there anyone or company providing services of reversing the bytecode to see what went wrong (I will provide the source code), so that it can be rectified and get the contract verified?

or what other options do I have?

Thanks everyone!

  • probably the openzeppelin contracts have been changed and when you deployed it , you used the latest contacts and not a specified release (tag)
    – Majd TL
    May 3, 2022 at 7:30
  • how did you import the openzeppelin contracts in remix?
    – Majd TL
    May 3, 2022 at 7:32
  • remix takes care of that, I just need to specify the import statement. example: import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
    – Shawn N
    May 3, 2022 at 9:37
  • "remix takes care of that" yes this what i think the problem is, you need to find the version that was used from remix at that time of the deployment. and then try to get the same contracts . I think currently remix use v4.5.0 of openzeppelin contracts. when did you deploy yours?
    – Majd TL
    May 3, 2022 at 12:16
  • mine deployed on 22nd March 2022
    – Shawn N
    May 3, 2022 at 13:57

1 Answer 1



Like what @MajdTL mentioned, it's due to the version of openzeppelin, after I deployed the contract Remix updated its version thus I believe it also updated to the latest version of openzeppelin libraries. Thus it makes a difference with the version I deployed and the version I'm trying to verify.

So based on @MajdTL suggestions and moved backwards on openzeppelin's libraries

I tried v4.5.0 > v4.5.0-rc.0 > v4.4.2

and boom, it verified.

I used an online text tool (https://countwordsfree.com/comparetexts) to compare the deployed bytecode and my compiled bytecode, just to compare the number of differences between the 2 so that I know if I've made any progress, after I tried v4.5.0 I realised the differences got lesser, so I just keep moving backwards till V4.4.2 and finally it just matches 100%.

Hope this helps anyone that deployed using Remix.

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.