question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues verifying contract on etherscan

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gnidancommented, Jun 5, 2019

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

(Can we close this yet? Thanks all.)

1reaction
vittominacoricommented, May 5, 2019

@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',
      },
    },
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to verify my contract on etherscan!
I'm guessing the issue might be when you are trying to verify the contracts on etherscan you are not updating the import line...
Read more >
How To Verify a Smart Contract on Etherscan | Chainlink Blog
A step-by-step tutorial showing Web3 developers how to verify their smart contract on Etherscan using multiple different methods.
Read more >
Verifying contracts on Etherscan - Medium
1. Verify and Publish ... Under the contract address, next to the “Transaction” tab, you will be able to find the “Code” tab....
Read more >
Contract Troubleshooting - Unable to Verify Contract Source
To do this : Go to the online Remix/Browser solidity site at https://remix.ethereum.org/.
Read more >
Urgent, can't verify contract on Etherscan - OpenZeppelin Forum
I built my contract entirely in Remix, and used import statement like: import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found