# Upgrades Plugins: Etherscan verification for proxies

**URL:** <https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251>\
**Category:** Announcements\
**Tags:** proxies, upgrades-plugins, etherscan-verify\
**Created:** [May 31, 2022, 7:45pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251 "2022-05-31T19:45:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [May 31, 2022, 7:45pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/1 "2022-05-31T19:45:35Z")

</div>

![etherscanverification](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/2X/b/b121dd2d400b1fca8f0f2012d92e3c68f58c05f8.png)

[**OpenZeppelin Upgrades Plugins**](https://docs.openzeppelin.com/upgrades-plugins/1.x/) are the recommended way to deploy and manage upgradeable contracts. They help you to make use of upgradeable proxy patterns that can involve a number of different contracts.

In the latest release of the Hardhat upgrades plugin, Etherscan verification for proxies is now available. This makes it easy to verify your upgradeable proxies and implementation contracts with a simple command.

This feature extends hardhat-etherscan’s `verify` task to completely verify a proxy. When you run `verify` with a proxy address, the Hardhat upgrades plugin will verify the proxy contract, the implementation contract and any proxy-related contracts. It will also link the proxy to the implementation's ABI on Etherscan.

To install the Hardhat upgrades plugin, see [Using with Hardhat](https://docs.openzeppelin.com/upgrades-plugins/1.x/hardhat-upgrades). If you already have the plugin installed, update to the latest version with: `npm install @openzeppelin/hardhat-upgrades@latest`

To verify a proxy that has been deployed by the plugin, see [documentation for `verify`](https://docs.openzeppelin.com/upgrades-plugins/1.x/api-hardhat-upgrades#verify).

For more information about Etherscan verification in general, see [How to verify a contract on Etherscan/BscScan/PolygonScan](https://forum.openzeppelin.com/t/how-to-verify-a-contract-on-etherscan-bscscan-polygonscan/14225).

---

<div class="post-metadata">

**Author:** ![MaD](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/mad/32/14325_2.png) [@MaD](https://forum.openzeppelin.com/u/MaD)\
**Post date:** [June 14, 2022, 3:56pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/2 "2022-06-14T15:56:50Z")

</div>

Is hardhat-etherscan’s `verify` task the reason why redeploying an instance of an already verified proxy or affiliated contracts fails, because the contract initial proxy already verified?

Is verification in this case not connected to the newly deployed contract address?

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [June 14, 2022, 7:18pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/3 "2022-06-14T19:18:51Z")

</div>

Verifying is separate from deploying. One should not affect the other.

If the same proxy contract or related proxy contract was already verified on the network, the hardhat-upgrades `verify` task may show that the contract is already verified and Etherscan would show "Similar Match Source Code". You can consider this as a verified proxy.

If you need your proxy to show as an exact match rather than similar match on mainnet, contact Etherscan [as described here](https://forum.openzeppelin.com/t/help-with-exact-match-verification-for-proxies/30521/4).

---

<div class="post-metadata">

**Author:** ![kargakis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/kargakis/32/20247_2.png) [@kargakis](https://forum.openzeppelin.com/u/kargakis)\
**Post date:** [July 21, 2022, 5:26pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/4 "2022-07-21T17:26:44Z")

</div>

@ericglau seems verification works fine when I use `npx hardhat verify $address` but fails when I execute the verification programmatically via `await hre.run('verify:verify', { address });` with

```auto
Error in plugin @nomiclabs/hardhat-etherscan: The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts.

```

Any thoughts on why would that happen?

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [July 21, 2022, 5:50pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/5 "2022-07-21T17:50:51Z")

</div>

@kargakis The task extends hardhat-etherscan's `verify`, not `verify:verify`. So to run it programmatically, use `await hre.run('verify', { address: <proxy contract address> })`

---

<div class="post-metadata">

**Author:** ![kargakis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/kargakis/32/20247_2.png) [@kargakis](https://forum.openzeppelin.com/u/kargakis)\
**Post date:** [July 21, 2022, 8:02pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/6 "2022-07-21T20:02:36Z")

</div>

Thanks @ericglau, did the trick!

---

<div class="post-metadata">

**Author:** ![Marcel\_Jackisch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/marcel_jackisch/32/14631_2.png) [@Marcel\_Jackisch](https://forum.openzeppelin.com/u/Marcel_Jackisch)\
**Post date:** [July 25, 2022, 2:07pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/7 "2022-07-25T14:07:25Z")

</div>

What about the Sourcify task of Hardhat? It seems this one definitely requires a pure implementation artifacts to work, as it would throw an error with the created artifacts (which contain both proxy and implementation ABIs).

```auto
verifying MyContract (0xabcd... on chain 44787) ...
{"error":"Contract name: MyContract. The deployed and recompiled bytecode don't match."}

```

---

<div class="post-metadata">

**Author:** ![ericglau](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ericglau/32/15149_2.png) [@ericglau](https://forum.openzeppelin.com/u/ericglau)\
**Post date:** [July 25, 2022, 5:20pm UTC](https://forum.openzeppelin.com/t/upgrades-plugins-etherscan-verification-for-proxies/29251/8 "2022-07-25T17:20:26Z")

</div>

@Marcel_Jackisch Sourcify verification isn't supported with the plugins at the moment. Can you open an issue on [https://github.com/OpenZeppelin/openzeppelin-upgrades/issues](https://github.com/OpenZeppelin/openzeppelin-upgrades/issues) to request this feature and provide details on your expected use case? Thanks.
