# Unable to verify contract importing OpenZeppelin Contracts docs branch via GitHub on Etherscan

**URL:** <https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665>\
**Category:** Contracts\
**Created:** [February 4, 2021, 8:09am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665 "2021-02-04T08:09:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![genesis24](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/genesis24/32/3381_2.png) [@genesis24](https://forum.openzeppelin.com/u/genesis24)\
**Post date:** [February 4, 2021, 8:09am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665/1 "2021-02-04T08:09:58Z")

</div>

Hello, I can’t verify my contract on etherscan, could you help me ?

**Here is the error message I get:**  
Error! Unable to generate Contract ByteCode and ABI **(General Exception, unable to get compiled [bytecode])**

**Here is my code:**

```auto
pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/docs-v2.x/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/docs-v2.x/contracts/token/ERC20/ERC20Detailed.sol";

/**
 * @title TRUST
 
 */
contract TRT is ERC20, ERC20Detailed {

    uint256 private _minimumSupply = 1000 * (10 ** 18);

    /**
     * @dev Constructor that gives msg.sender all of existing tokens.
     */
    constructor () public ERC20Detailed("TRUST", "TRT", 18) {
        _mint(msg.sender, 17000 * (10 ** uint256(decimals())));
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        return super.transfer(to, _partialBurn(amount));
    }

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        return super.transferFrom(from, to, _partialBurn(amount));
    }

    function _partialBurn(uint256 amount) internal returns (uint256) {
        uint256 burnAmount = _calculateBurnAmount(amount);

        if (burnAmount > 0) {
            _burn(msg.sender, burnAmount);
        }

        return amount.sub(burnAmount);
    }

    function _calculateBurnAmount(uint256 amount) internal view returns (uint256) {
        uint256 burnAmount = 0;

        // burn amount calculations
        if (totalSupply() > _minimumSupply) {
            burnAmount = amount.mul(25).div(1000);
            uint256 availableBurn = totalSupply().sub(_minimumSupply);
            if (burnAmount > availableBurn) {
                burnAmount = availableBurn;
            }
        }

        return burnAmount;
    }
}

```

**Here is the address of the contract:**  
0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd

Kind Regards.

---

<div class="post-metadata">

**Author:** ![Amxx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/amxx/32/668_2.png) [@Amxx](https://forum.openzeppelin.com/u/Amxx)\
**Post date:** [February 4, 2021, 10:11am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665/2 "2021-02-04T10:11:31Z")

</div>

Hello @genesis24,

In order to verify contract on etherscan, you have to make sure you know the exact version of the compiler used. Also, you have to verify which options you used (optimisations, …).

Some IDE, including remix tat you seem to be using, include modules that does the verification for you. You should have a look at their documentation.

---

<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 5, 2021, 3:31am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665/3 "2021-02-05T03:31:20Z")

</div>

Hi @genesis24,

In your contract you are importing OpenZeppelin Contracts from a documentation branch. You should only import via GitHub an official release. This will potentially cause you issues.

From your bytecode you used Solidity 0.5.17. You will need to specify whether you compiled with optimization.

You can try converting your GitHub imports to npm imports and verify via Hardhat, assuming that this code is the same as in OpenZeppelin Contracts 2.5.1.

I use the following process to verify: [Verify smart contract inheriting from OpenZeppelin Contracts](https://forum.openzeppelin.com/t/verify-smart-contract-inheriting-from-openzeppelin-contracts/4119)

---

<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 19, 2021, 5:39am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665/4 "2021-02-19T05:39:56Z")

</div>

Hi @genesis24,

I used the following process [Verify smart contract inheriting from OpenZeppelin Contracts](https://forum.openzeppelin.com/t/verify-smart-contract-inheriting-from-openzeppelin-contracts/4119)

I converted your GitHub imports to npm imports

```auto
pragma solidity ^0.5.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";

/**
 * @title TRUST
 
 */
contract TRT is ERC20, ERC20Detailed {

    uint256 private _minimumSupply = 1000 * (10 ** 18);

    /**
     * @dev Constructor that gives msg.sender all of existing tokens.
     */
    constructor () public ERC20Detailed("TRUST", "TRT", 18) {
        _mint(msg.sender, 17000 * (10 ** uint256(decimals())));
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        return super.transfer(to, _partialBurn(amount));
    }

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        return super.transferFrom(from, to, _partialBurn(amount));
    }

    function _partialBurn(uint256 amount) internal returns (uint256) {
        uint256 burnAmount = _calculateBurnAmount(amount);

        if (burnAmount > 0) {
            _burn(msg.sender, burnAmount);
        }

        return amount.sub(burnAmount);
    }

    function _calculateBurnAmount(uint256 amount) internal view returns (uint256) {
        uint256 burnAmount = 0;

        // burn amount calculations
        if (totalSupply() > _minimumSupply) {
            burnAmount = amount.mul(25).div(1000);
            uint256 availableBurn = totalSupply().sub(_minimumSupply);
            if (burnAmount > availableBurn) {
                burnAmount = availableBurn;
            }
        }

        return burnAmount;
    }
}

```

Then I verified using Hardhat

```auto
$ npx hardhat verify --network mainnet 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd
Compiling 6 files with 0.5.17
Compilation finished successfully
Compiling 1 file with 0.5.17
Successfully submitted source code for contract
contracts/TRT.sol:TRT at 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd
for verification on Etherscan. Waiting for verification result...

Successfully verified contract TRT on Etherscan.
https://etherscan.io/address/0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd#code

```

You can see your verified code on Etherscan:

> **[Contract Address 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd | Etherscan](https://etherscan.io/address/0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd#code)**
>
> The Contract Address 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd 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...

> **[Contract Address 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd | Etherscan](https://etherscan.io/address/0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd#code)**
>
> The Contract Address 0xadd42c3a88a347b7a7df7bb57a2a76ecb6ef39cd 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:** ![Alexoz](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@Alexoz](https://forum.openzeppelin.com/u/Alexoz)\
**Post date:** [June 11, 2021, 7:17am UTC](https://forum.openzeppelin.com/t/unable-to-verify-contract-importing-openzeppelin-contracts-docs-branch-via-github-on-etherscan/5665/5 "2021-06-11T07:17:17Z")

</div>

Hi @abcoathup

I’m having issues to verify my binance token on bscscan I read in several post your suggestion to use the process shown here [Verify smart contract inheriting from OpenZeppelin Contracts](https://forum.openzeppelin.com/t/verify-smart-contract-inheriting-from-openzeppelin-contracts/4119) but I just cannot make it work. Is there any other post where explains this process?

Many thanks in advance,
