hardhat-zksync-verify-vyper
Guide on using the hardhat-zksync-verify-vyper plugin.
Description
The hardhat-zksync-verify-vyper plugin enables verification of Vyper smart contracts on the ZKsync Era network. Key features include:
- Support for verifying Vyper contracts on ZKsync Era networks
- Verification of contracts with constructor arguments
- Support for encoded constructor parameters
- Verification status checking capabilities
- Programmatic verification support
Resources:
Alpha Release Warning: Due to verification context limitations, this plugin is labeled as 
alpha and is not recommended for production use.Installation
Prerequisites
- Node.js version 18 or higher
- Hardhat version 2.16.0 or higher
Setup
Install the plugin using your preferred package manager:
yarn add -D @matterlabs/hardhat-zksync-verify-vyper
Import the package in your hardhat.config.ts file:
import "@matterlabs/hardhat-zksync-verify-vyper";
Configuration
Configuration Options
| Name | Type | Description | Required | Default | 
|---|---|---|---|---|
| url | string | ZKsync Era node URL | Yes | - | 
| ethNetwork | string | Ethereum network name or URL | Yes | - | 
| zksync | boolean | Enable ZKsync Era network | Yes | - | 
| verifyURL | string | Verification endpoint URL | No | Network-specific default | 
Example Configuration
const config: HardhatUserConfig = {
  networks: {
    zkTestnet: {
      url: "https://sepolia.era.zksync.dev",
      ethNetwork: "sepolia",
      zksync: true,
      verifyURL: 'https://explorer.sepolia.era.zksync.dev/contract_verification'
    },
    zkMainnet: {
      url: "https://mainnet.era.zksync.io",
      ethNetwork: "mainnet",
      zksync: true,
      verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification"
    }
  }
};
export default config;
Additions
Added Tasks
| Task Name | Description | 
|---|---|
| verify:vyper | Verifies a Vyper contract on ZKsync Era | 
| verify-status:vyper | Checks the status of a verification request | 
Added HRE Extensions
The plugin adds the following methods to the Hardhat Runtime Environment:
- verify:verify:vyper: Programmatic contract verification
- verify-status:vyper: Programmatic verification status check
Commands
Basic Verification
yarn hardhat verify:vyper --network <network> <contract address>
Verification with Contract Specification
yarn hardhat verify:vyper --network <network> <contract address> --contract <fully qualified name>
Verification with Constructor Arguments
yarn hardhat verify:vyper --network <network> <contract address> "arg1" "arg2"
Verification with Complex Constructor Arguments
yarn hardhat verify:vyper --network <network> <contract address> --constructor-args arguments.js
Check Verification Status
yarn hardhat verify-status:vyper --verification-id <your verification id>
Usage
Basic Contract Verification
- Deploy your Vyper contract
- Run the verification command:
yarn hardhat verify:vyper --network testnet <contract address>
Using Constructor Arguments
For simple arguments:
yarn hardhat verify:vyper --network testnet <contract address> "Hi there!"
For complex arguments, create an arguments.js:
module.exports = [
  "a string argument",
  "0xabcdef",
  "42",
  {
    property1: "one",
    property2: 2,
  }
];
Verify using the arguments file:
yarn hardhat verify:vyper --network testnet <contract address> --constructor-args arguments.js
Programmatic Verification
const verificationId = await hre.run("verify:verify:vyper", {
  address: contractAddress,
  contract: contractFullyQualifedName,
  constructorArguments: [...]
});
Troubleshooting
Known Limitations
- Verification Context: The plugin requires the exact same Vyper contracts list in your project's "contracts" folder as during deployment.
- Timing: It's strongly recommended to verify contracts immediately after deployment.
- Version Compatibility:
- For plugin version <1.0.0: Compatible with ethers v5
- For plugin version ≥1.0.0: Compatible with ethers v6 (recommended)
 
Common Issues
- "Bytecode doesn't match any of your local contracts":- Ensure all contracts present during deployment are still in your project
- Verify immediately after deployment
 
- "Unknown compiler version":- Use a supported compiler version
- Check the ZKsync Era documentation for compatible versions
 
For more help, please refer to the GitHub issues.