0

I am testing my new token contract on Rinkeby. The contract was compiled and deployed using Brownie. I am deploying the token to Rinkeby and it is compiled and deployed correctly.

However, when I try and verify my contract on Etherscan, it keeps failing with the following error:

Error! Unable to generate Contract ByteCode and ABI

Found the following ContractName(s) in source code: Context.sol:Context, IERC20.sol:IERC20, Token.sol:Token

But we were unable to locate a matching bytecode (err_code_2)

My contract consists of multiple files (3 to be exact) and I am using Solidity compiler version 0.8.1.

I tried compiling and deploying with Byzantium, Constantinople and Istanbul EVMs. But I keep getting the same error.

I cannot use the publish_source parameter when deploying with Brownie as that requires an API key and to my knowledge there are no API keys for Etherscan Rinkeby.

Am I missing something? Or is verification not possible on Etherscan Rinkeby?

2

Short answer is: you have to create the API key at etherscan.io either for the mainnet and the rest of public testnets (Ropsten, Rinkeby, Goerli..).

(Bonus)

In addition, I had some issues when trying to verify a contract with interfaces located in subdirectories.

Perhaps it is not your case, but if you are using Truffle to manage the contracts deployment, there is an interesting plug-in to verify the contract automatically: truffle-plugin-verify.

I tried it and it worked perfectly. You essentially need to

  • Install the truffle & plugin via npm
  • Create an API key on Etherscan
  • Update the truffle configuration file
  • Use a wallet to sign the transaction to create the contract (e.g.: @truffle/hdwallet-provider)
  • Migrate, and finally, verify the contract
2
  • I'm using Brownie so not sure if a similar plugin exists. On the other hand I am not sure if there is a way to get an etherscan api key on Rinkeby... I tried registering for an etherscan rinkeby account but still did not receive a verification email. And rinkeby.etherscan.io/login gives an error. Ttied reaching out to etherscan but still no response. I will try deploying to ropsten and see if thats any difference – Zaid Amir Feb 12 at 11:12
  • Your Etherscan account (and API key) is the same across different networks, so you need to create an account on the mainnet Etherscan, then log in and create an API key. That key works for all different networks (incl Rinkeby). Even if you're not using Truffle, you can take a look at that article specifically for the part about generating an API key. – Rosco Kalis Feb 12 at 16:14
0

Seems the issue was indeed etherscan rinkeby. I deployed the contract on ropsten and went and verified it with etherscan and all went well and got verified with no issues.

Even when setting up brownie to use my etherscan API key. It constantly failed to connect to api.rinkeby.etherscan.io. But worked with no issues on ropsten.

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.