I have a contract, where I compiled it optimized in 200. When I go to publish in BSC Scan, it gives me some messages as attached. I'm informing in bsc scan the optimization in 200.

enter image description here

It points out something about libraries, but each and every library or interface being used is contained in the single file. In the comparison he makes of the bytecodes, he says it doesn't match. But I took the two bytecodes and compared them to an online comparator, and it's exactly the same. Compare the image with item 8.

enter image description here

What could be happening?

  • Try to use the library of hardhat to do that.
    – Majd TL
    Aug 4, 2021 at 20:01
  • is it an ide? Can I build for BSC? @MajdTL Aug 4, 2021 at 20:16

1 Answer 1


Bsscan is not very friendly when it comes to publishing contracts, it can go wrong for an extra step or even misplaced comments.

for a better verification, and if you are using Truffle for development or testing, you can download the verification plugin and use that to verify. For this, you will also need to have an account at bsscan and get an API key (which is free).

After installing truffle-plugin-verify, and in your truffle-config.js file add the following attributes :

plugins: [
    api_keys: {
        bscscan: "" // the API key you get from bsscan

then to verify the contract you simply run the following command

truffle run verify someTokenName --network=NameOfyourNetwork 

you can add --debug to see the inner steps taken.

more details in this article from openZepplin

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.