# How to verify smart contract

{% hint style="info" %}
If you'd like to verify contracts via our website, you may do so using the [**Verify Contract**](https://avascan.info/blockchain/c/contract/verify) page.
{% endhint %}

With the Etherscan Compatible Verify Contract API, verify smart contract on Avascan is now more easy than ever. There are few things you need to connect your favorite verify contract client with Etherscan compatibility:

1. Define the `networkId`: mainnet, testnet
2. Retrieve the `chainId` of the evm compatible blockchain. You can use the [**all blockchains page**](https://avascan.info/blockchains).
3. Compose the Etherscan Compatible API endpoint:  `https://api.avascan.info/v2/network/:networkId/evm/:chainId/etherscan`

The following endpoints are provided only as an example:

<table><thead><tr><th width="156">Blockchain</th><th>API Endpoint (https)</th></tr></thead><tbody><tr><td><p>C-Chain</p><p><em>mainnet</em></p></td><td><code>api.avascan.info/v2/network/mainnet/evm/43114/etherscan</code></td></tr><tr><td><p>Swimmer</p><p><em>mainnet</em></p></td><td><code>api.avascan.info/v2/network/mainnet/evm/73772/etherscan</code></td></tr><tr><td><p>C-Chain</p><p><em>testnet</em></p></td><td><code>api.avascan.info/v2/network/testnet/evm/43113/etherscan</code></td></tr><tr><td><p>WAGMI</p><p><em>testnet</em></p></td><td><code>api.avascan.info/v2/network/testnet/evm/11111/etherscan</code></td></tr></tbody></table>

### hardhat-etherscan

[**hardhat-etherscan**](https://hardhat.org/hardhat-runner/plugins/nomiclabs-hardhat-etherscan),  is an hardhat plugin, that simplify the smart contract verification process on Etherscan. With the Etherscan Compatible Verify Contract API, you can use this tool to verify your smart contract on Avascan as well.

Let's say you want to verify your smart contract on wagmi, this is an example of `hardhat.config.ts`:

```typescript
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-etherscan";

const config: HardhatUserConfig = {
  etherscan: {
    apiKey: {
      wagmi: "avascan", // apiKey is not required, just set a placeholder
    },
    customChains: [
      {
        network: "wagmi",
        chainId: 11111,
        urls: {
          apiURL: "https://api.avascan.info/v2/network/testnet/evm/11111/etherscan",
          browserURL: "https://testnet.avascan.info/blockchain/wagmi"
        }
      }
    ]

  },
  networks: {
    wagmi: {
      url: 'https://subnets.avax.network/wagmi/wagmi-chain-testnet/rpc',
      accounts: [process.env.PRIVATE_KEY]
    },
  },
};

export default config;
```

#### Deploy

```
npx hardhat run scripts/deploy.ts --network wagmi
```

#### Verify

```
export PRIVATE_KEY=...
npx hardhat verify --network wagmi 0x...
```

If you need any support just ask in our [Discord server](https://discord.com/invite/CQJGs5B) or our [Telegram group](https://t.me/AvascanExplorer).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avascan.info/tutorial/smart-contract-submission.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
