Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Issues verifying contract on etherscan #1984

Closed
Amxx opened this issue May 3, 2019 · 8 comments
Closed

Issues verifying contract on etherscan #1984

Amxx opened this issue May 3, 2019 · 8 comments

Comments

@Amxx
Copy link

Amxx commented May 3, 2019

I know this issue was discussed in #456 and #475, but it is still a pain to verify deployment on etherscan. Works out of the box with remix, it should work with truffle to!

Issue

After a migration using truffle migrate (which is a pain, but that is not the point here), my contract are deployed and visible on etherscan. I'm trying to verify the code so my users can trust the deployment and use the read/write features of etherscan.

when I past my contract code, and give the compiler version and optimization options, it tells me the bytecode is not the correct one. If I deploy using remix, the verification happens well ... which makes me wonder, why isn't the same source, with the same compiler not giving the same result?

For the THESE contracts (flatten version here) the deployed addresses are (for example)

0x6FDcfA51758205E9D717dce7B8F416447D612174 AppRegistry (empty constructor)
0x22e0b72EA21D4DfF26F075c291cECc00cb01e978 IexecODBLibOrders (library, so no constructor)

using:

compilers: {
	solc: {
		version: "0.5.7",
		settings: {
			optimizer: {
				enabled: true,
				runs: 200
			}
		}
	}
},
  • Operating System: Archlinux
  • Truffle version (truffle version): 5.0.13
  • node version (node --version): 11.12.0
  • npm version (npm --version): 6.9.0

EDIT:
I've tried with evmVersion "petersburg" and "byzantium", none of these give me the same bytecode as remix (with same compiler version and optimisation)

@Amxx
Copy link
Author

Amxx commented May 3, 2019

@mtbitcoin

@mtbitcoin
Copy link

mtbitcoin commented May 3, 2019

We are working on some new updates which should address most of these issues and will be released shortly. I suspect this might have some thing to do with your evmversion (i.e. non default).

Do you know which evmversion was the contract compiled with on truffle ?

You can also open a ticket via our help desk for additional assistance and most of times we should be able to narrow down the issue.

In general though, if it compiles on remix and the code matches what is on the blockchain then the contract will verify

@vittominacori
Copy link
Contributor

@Amxx you should add evmVersion: 'petersburg', in your truffle-config.js like below.

Default is "byzantium" and Etherscan fails to verify your code.

compilers: {
    solc: {
      version: '0.5.8',
      settings: {
        optimizer: {
          enabled: true,
          runs: 200,
        },
        evmVersion: 'petersburg',
      },
    },
  },

@mtbitcoin
Copy link

@Amxx We've just released an updated contractverifier for all the testnets .i.e https://ropsten.etherscan.io/verifyContract

You can now specifically "configure" the EvmVersion , if left blank it defaults to compiler default.

In addition to that we also now support standard-json-input format.

@mtbitcoin
Copy link

Just pushed the latest updates to mainnet https://etherscan.io/verifycontract for custom evmVersions among others

@fainashalts
Copy link
Contributor

Hi @Amxx, do you still need help with this? Thanks!

@gnidan
Copy link
Contributor

gnidan commented Jun 5, 2019

Just including this for reference: https://github.com/rkalis/truffle-plugin-verify

(Can we close this yet? Thanks all.)

@gnidan
Copy link
Contributor

gnidan commented Jun 12, 2019

Going once
Going twice
Closed!

Thanks for playing. (But seriously, let us know and we can re-open :)

@gnidan gnidan closed this as completed Jun 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants