I have a smart contract that outputs a different bytecode when compiled with truffle, and with remix, even though both seem to use the same compiler version: 0.5.7+commit.6da8b019 Is that a known issue ? Is that normal ?

This causes issues to verify my smart contract on etherscan, and thus to be trusted by my users, which is kind of a big deal.

Thanks for your help.


Alright, I've found the answer after digging a little bit more into remix's compilation option. It seems that right now, the default setting on remix is:

evmVersion: "petersburg"

Whereas on Truffle it is set to

evmVersion: "byzantium"

Setting explicitely byzantium in truffle-config fixed the bytecode, and it's now exactly the same as remix's bytecode.


By default Truffle compiles with enabled optimizations, and Remix with disabled.

  • It shouldn't optimize, in my truffle's compilation result, it says "optimizer":{"enabled":false,"runs":200} I wonder why the "runs" is here though, if optimizer is disabled – Cryptoss Shogun Apr 5 '19 at 11:43

The 64 bytes (128 hex-characters) which appear right before the last 2 bytes (4 hex-characters), are metadata.

Truffle generates this metadata based on things like the absolute path of the contract in your file system, the current time and so on.

I'm not sure how Remix generates it, but if the two bytecodes differ only by this part, then you have nothing to worry about.

That said, under a given configuration on Etherscan-verification page, both should be verified or both should be not verified.

If you are getting different results, then the two bytecodes are most likely different from each other not only in the metadata part.

  • Well, I might have found the issue. Default truffle compiles with the evmVersion to "byzantine" whereas remix compiles with "petersburg". The bytecode matches exactly when applying. However, I don't really understand what's implied by all that – Cryptoss Shogun Apr 5 '19 at 13:11
  • @CryptossShogun: If the bytecode now matches, then what exactly is your issue or question? – goodvibration Apr 5 '19 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.