Verify with OpenZeppelin SDK

Verify with OpenZeppelin SDK

OpenZeppelin SDK supports verifying logic contracts with openzeppelin verify.
There is an open issue to support verifying proxy contracts:

The following guide walks through verifying a logic contract. (I used openzeppelin 2.5.2)

Note: Etherscan doesn’t currently support proxy contracts. EIP-1967 aims to create a standard that blockchain explorers could then implement.
Currently, if you verify the proxy contract, you will only see the ABI of the proxy (upgrade, admin, etc) and not that of the logic contract (which is the one you want to interact with). As proxies are transparent, they only answer to calls from the admin, so any calls from Etherscan to check info such as admin or implementation, will just return zero.


Based on SimpleToken example.

pragma solidity ^0.5.0;

import "@openzeppelin/upgrades/contracts/Initializable.sol";

// Import from OpenZeppelin contracts
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol";

contract Token is Initializable, ERC20, ERC20Detailed {

    function initialize() public initializer {
        ERC20Detailed.initialize("Token", "TKN", 18);
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));

Link @openzeppelin/contracts-ethereum-package

Link the OpenZeppelin Contracts Ethereum Package into the project running openzeppelin link @openzeppelin/contracts-ethereum-package

See Linking OpenZeppelin contracts in the documentation.

$ npx openzeppelin link @openzeppelin/contracts-ethereum-package
✓ Dependency @openzeppelin/contracts-ethereum-package installed
Dependency linked to the project. Run 'openzeppelin create' to deploy one of its contracts.


Compile the contract with npx openzeppelin compile --optimizer off
Due to an Issue explicitly specify the optimizer off

Note: If you install OpenZeppelin globally, you will also need to install @openzeppelin/upgrades: npm install @openzeppelin/upgrades.

$ npx openzeppelin compile --optimizer off
✓ Compiled contracts with solc 0.5.11 (commit.c082d0b4)


Create the contract on a public testnet such as Ropsten with openzeppelin create.
See Deploy to a public testnet using OpenZeppelin SDK for details on how to set this up.

$ npx openzeppelin create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate Token
? Pick a network ropsten
✓ Added contract Token
✓ Linked dependency @openzeppelin/contracts-ethereum-package 2.2.3
✓ Contract Token deployed
All contracts have been deployed
? Do you want to call a function on the instance after creating it? Yes
? Select which function initialize()
✓ Setting everything up to create contract instances
✓ Instance created at 0x7bD182A6883e25Fcb092D5837365AC989C292f9a


Verify the logic contract with openzeppelin verify.
You need to create an Etherscan API KEY to do this.
Note: The Etherscan API doesn’t include the EVM version.

$ npx openzeppelin verify
? Pick a contract Token
? Pick a network ropsten
? Was the optimizer enabled when you compiled your contracts? No
? Select an endpoint etherscan
✓ Contract source code of Token verified and published successfully. You can check it here:

Verified Logic contract:

Proxy contract:


16 posts were split to a new topic: Verify Standalone contracts