# How to Verify Contract on Etherscan Using Github Imports Via Remix

**URL:** <https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897>\
**Category:** Contracts\
**Tags:** erc721\
**Created:** [February 20, 2021, 6:45pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897 "2021-02-20T18:45:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 20, 2021, 6:45pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/1 "2021-02-20T18:45:22Z")

</div>

Hello Community just read through another post about converting imports and verifying when using Github. I made the mistake of not compiling now I need to get this sorted.

I tried what was in here however could not get it to verify:

> [@How to verify a contract deployed using Remix importing OpenZeppelin via GitHub?](https://forum.openzeppelin.com/t/how-to-verify-a-contract-deployed-using-remix-importing-openzeppelin-via-github/2413/2):
>
> I have compiled and deployed the contract on remix with the flattener plug-in enabled, Then I have flattened the code for verification on etherscan which gives us these errors As suggested by you to flatten the contract when you have imports (even importa from GitHub of zeplin). Then we did that but seems etherscan doesn’t know which contract bytes to compare to when you have a single file and many contracts defined in it… So you can reproduce this if you make a simple token erc721 or erc20…

Any help would be greatly appreciated.

**💻 Environment**  
Deployed using remix and 0.6.12 & OpenZepplin v3.2.0

**📝Details**  
Trying to flatten using truffle like in the post but threw Multiple SPX errors after removing got this:

```auto
myc:2103:1: DeclarationError: Identifier already declared.
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
^ (Relevant source part starts here and spans across multiple lines).
myc:1628:1: The previous declaration is here:
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
^ (Relevant source part starts here and spans across multiple lines).
myc:2271:25: TypeError: Cannot call function via contract type name.
        address owner = ERC721.ownerOf(tokenId)
                        ^---------------------^

```

**🔢 Code to reproduce**

> <https://github.com/wizard-deVv/mythic-finance/blob/main/creepsv2.sol>

I converted imports to these :

```auto
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";

```

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 21, 2021, 1:14am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/2 "2021-02-21T01:14:26Z")

</div>

So you want to verify this contract: [wizard-deVv/mythic-finance/blob/main/creepsv2.sol](https://github.com/wizard-deVv/mythic-finance/blob/main/creepsv2.sol), right?  
What is your contract address?

---

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 21, 2021, 1:44pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/3 "2021-02-21T13:44:21Z")

</div>

Hey there, I am currently interacting using web 3 but would like it to be publicly verified but struggling to get it, will never use github imports again now that see how easy truffle is…

> **[Mythic Creeps v2 (CREEPSv2) Token Tracker | BscScan](https://bscscan.com/token/0x8798d6f732e9bc80bdd89e86b66c9fe956ae0843)**
>
> Mythic Creeps v2 (CREEPSv2) Token Tracker on BscScan shows the price of the Token $0.0000, total supply 661, number of holders 98 and updated information of the token. The token tracker page also shows the analytics and historical data.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [February 22, 2021, 1:09am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/4 "2021-02-22T01:09:06Z")

</div>

Hi @wizard-deVv,

Welcome to the community 👋

When converting to npm imports, you need to install the same version of OpenZeppelin Contracts.

In your case you were importing OpenZeppelin Contracts 3.2 via GitHub so need to install `npm install @openzepplin/contracts@3.2.0`

Using Binance Smart Chain I am not sure if Hardhat verify supports bscscan, so flattening is likely to be the easiest way to do this. You would need to remove the duplicate SPDX-License-Idetifier’s, though as you are using MIT, this is fairly straight forward.

---

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 22, 2021, 2:47am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/5 "2021-02-22T02:47:39Z")

</div>

Thanks!

Yes i did install the 3.2 Version, BSC is the exact same as ETH from my experience so far. Not sure why like i stated above after flattening and removing duplicate License I got a really weird error.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [February 23, 2021, 1:06am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/6 "2021-02-23T01:06:57Z")

</div>

Split this topic on February 23, 2021, 1:06am UTC

2 posts were split to a new topic: [Verify contract on Etherscan deployed via Remix](https://forum.openzeppelin.com/t/verify-contract-on-etherscan-deployed-via-remix/5933)

---

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 22, 2021, 2:04pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/8 "2021-02-22T14:04:04Z")

</div>

Bro make a new post why did you hijack mine?

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [February 24, 2021, 5:47am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/9 "2021-02-24T05:47:18Z")

</div>

Hi @wizard-deVv,

Just wanted to check if you were able to verify?

---

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 24, 2021, 2:13pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/10 "2021-02-24T14:13:28Z")

</div>

No not yet, I tried all those things and unfortunately still getting the same errors

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [February 25, 2021, 5:01am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/11 "2021-02-25T05:01:22Z")

</div>

Hi @wizard-deVv,

I verified your contract doing the followng:

- Create a simple Truffle project, installed OpenZeppelin Contracts 3.2 and Truffle Flattener.
- Converted GitHub imports to npm imports on the contract
- Ran Truffle Flattener

```auto
$ npx truffle-flattener ./contracts/creepsv2.sol > ./contracts/FlatCreepsV2.sol

```

- Manually removed duplicate SPDX License Identifiers
- Encoded your constructor arguments using [https://abi.hashex.org/](https://abi.hashex.org/)

```auto
0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000104d7974686963204372656570732076320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084352454550537632000000000000000000000000000000000000000000000000

```

- Verified on BSCScan with Optimization enabled and runs 200, with compiler set to 0.6.12

> **[Contract Address 0x8798d6f732e9bc80bdd89e86b66c9fe956ae0843 | BscScan](https://bscscan.com/address/0x8798d6f732e9bc80bdd89e86b66c9fe956ae0843#code)**
>
> The Contract Address 0x8798d6f732e9bc80bdd89e86b66c9fe956ae0843 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...

---

<div class="post-metadata">

**Author:** ![wizard-deVv](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/wizard-devv/32/4353_2.png) [@wizard-deVv](https://forum.openzeppelin.com/u/wizard-deVv)\
**Post date:** [February 25, 2021, 1:06pm UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/12 "2021-02-25T13:06:31Z")

</div>

> [@abcoathup](#):
>
> Encoded your constructor arguments using [https://abi.hashex.org/](https://abi.hashex.org/)

Looks like this was the step i was missing here 🙂

- Encoded your constructor arguments using [https://abi.hashex.org/](https://abi.hashex.org/)

You are a legend thank you for all you do here!

---

<div class="post-metadata">

**Author:** ![Yoshiko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/yoshiko/32/6858_2.png) [@Yoshiko](https://forum.openzeppelin.com/u/Yoshiko)\
**Post date:** [May 14, 2021, 10:21am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/13 "2021-05-14T10:21:56Z")

</div>

Split this topic on May 14, 2021, 10:21am UTC

A post was split to a new topic: [How do I verify my contract?](https://forum.openzeppelin.com/t/how-do-i-verify-my-contract/8373)

---

<div class="post-metadata">

**Author:** ![guiltygators](https://avatars.discourse-cdn.com/v4/letter/g/c4cdca/32.png) [@guiltygators](https://forum.openzeppelin.com/u/guiltygators)\
**Post date:** [September 29, 2021, 3:45am UTC](https://forum.openzeppelin.com/t/how-to-verify-contract-on-etherscan-using-github-imports-via-remix/5897/14 "2021-09-29T03:45:24Z")

</div>

@abcoathup Hello! I am also having troubles trying to verify my smart contract for an ERC721 token. I deployed it on Remix and this is the error im getting,  
"Error! Unable to generate Contract ByteCode and ABI **(General Exception, unable to get compiled [bytecode])**"

Do you know how this can be solved?
