1

I am unable to verify the contract below on Etherscan. No errors in Remix. I tried all of the solutions recommended in answers to similar questions, which were:

  • Remove the ^ in pragma
  • Compile contract with and without optimization turned on

enter image description here

The contract is currently deployed on address 0x113b1D84A5D25b9A921434F8131b71aDa45dAeac

// Version of Solidity compiler this program was written for
pragma solidity ^0.5.14;

// Game contract
contract HoT {
  ...program code...
}

Any ideas why this happens? Thanks!

3

Those are predeployment suggestions to reduce ambiguity at this step.

The issue is there no way to be certain how the bytecode was generated because the pragma allows flexibility.

If possible, examine the tools you used to compile, e.g. solc, Remix or truffle-config.js to work out the compiler version that must have been used.

If you cannot do that, then it's trial and error. There are no constructor arguments, so the search area is solidity 0.5.14 and higher, with and without optimization. Try them all. Start with just the official releases because no one should be using the nightly builds for production.

Etherscan will confirm the contract when it compiles the provided source code with the parameters given and it produces a bit-wise exact copy of the bytecode that is on the blockchain. In other words, it will reproduce the compilation process and compare the code you say is at that address to what is actually there.

Hope it helps.

3
  • 1
    0.5.14 is the latest official release at the time of writing, thus couldn't try any later version. I succeeded with version 0.5.11 though. Thanks for your help! – René K Dec 13 '19 at 15:55
  • 1
    Glad it worked. The result implies the code was modified or is not exactly as shown here, because it should refuse to compile with < 0.5.14. Very weird. Glad you found success. – Rob Hitchens Dec 13 '19 at 16:36
  • 1
    Yeah, I changed to pragma solidity ^0.5.11; – René K Dec 13 '19 at 17:28

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.