When I deploy a contract with Truffle that has an import statement, and try to verify it on etherscan, my understanding is that I need to paste in the contents of the imported file.

I get an error on etherscan that the bytecodes of the concatenated and deployed files are not the same. The strange thing is that if I deploy the contract (with imports) on remix then the bytecode matches with the concatenated source file.


Here is a minimal example of contracts that exhibit this behaviour.

Combined.sol is the concatenated file, and Outer.sol contains the contract that is deployed.

Here is what I am doing that gets an error:

  1. Deploy Outer.sol with truffle
  2. Go to deployed contract address on etherscan
  3. Input the Concatenated.sol source code and hit verify

Error, bytecodes do not match.

More info

  • Using compiler 0.4.11 in remix and truffle.
  • Ubuntu 16.04.
  • On Kovan, not that it should matter.
  • Deployed contract
  • 1
    For me verification of concatenated contracts used to work like a charm. Can you provide the address of the deployed minimal example on the Kovan network so I can investigate the case? Commented Jul 5, 2017 at 13:04
  • @JakubWojciechowski Updated answer with address of deployed contract Commented Jul 5, 2017 at 13:52
  • When verifying the code on Etherscan, have you tried both with and without optimizations enabled? Commented Jul 8, 2017 at 5:35

3 Answers 3


Currently etherscan does not support verification of multifile contracts. But there is discussion on etherscan's reddit about this issue.

Concatenating files into one worked some time ago, but since version 0.4.7 Solidity includes hash of contract's metadata at the end of compiled contract. As this metadata contains file names and hashes, you may get the same bytecode after concatenating and compiling but this hash will be different.

I think motivation behind adding hash of this metadata to deployed contract is to make source verification automatic as each deployed contract contains swarm-link to sources, compiler version and compilation options.

  • So basically the verification feature is pretty much useless since solidity 0.4.7 ?
    – n1cK
    Commented Nov 7, 2017 at 10:17

I built a CLI that may help you, called multisol. You can install it via Homebrew if you're on Mac, or download one of the executables I provide if you're on Windows or Linux:

$ brew tap paulrberg/multisol
$ brew install multisol

Then you can use it like this:

$ multisol path/to/YourContract.sol

This will generate a folder named "multisol-yourcontract" that can be used to verify the source code on Etherscan for a deployed instance of YourContract.sol. Note that the type of verification is "Solidity (Multi-Part files)".


I created truffle-plugin-verify to automate Truffle contract verification on Etherscan.

  1. Install the plugin with npm
npm install truffle-plugin-verify
  1. Add the plugin to your truffle.js or truffle-config.js file
module.exports = {
  /* ... rest of truffle-config */

  plugins: [
  1. Generate an API Key on your Etherscan account (see the Etherscan website)
  2. Add your Etherscan API key to your truffle config
module.exports = {
  /* ... rest of truffle-config */

  api_keys: {
    etherscan: 'MY_API_KEY'

After migrating your Outer contract to Kovan, you are able to verify it on Etherscan by running:

truffle run verify Outer --network kovan

More information can be found on the repository or in my article Automatically verify Truffle smart contracts on Etherscan.


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.