> For the complete documentation index, see [llms.txt](https://docs.lumia.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lumia.org/build-on-lumia/smart-contracts/verify-a-contract-with-hardhat.md).

# Verify a contract with Hardhat

**Who this is for:** developers who've deployed a contract with Hardhat and want its source code visible and callable on the explorer.

**Prerequisites:** a contract already deployed. See [Deploy a contract with Hardhat](broken://pages/f176929e0032d6e7897dd25c5f662a1adae28160).

**Time:** a couple of minutes.

{% stepper %}
{% step %}

#### 1. Confirm the verify plugin is installed

`@nomicfoundation/hardhat-toolbox` (which bundles `hardhat-verify`); if you scaffolded via [Quickstart](file:///5838283/Quickstart-your-first-contract-on-Lumia.md), it already is.
{% endstep %}

{% step %}

#### 2. Add the verifier config to `hardhat.config.js`

{% hint style="warning" %}
The exact verifier backend Lumia's explorer expects (a Blockscout-style verification endpoint versus an Etherscan-style API key flow) is {{TODO: confirm with protocol eng: not confirmed in material available 2026-09-09}}. Once confirmed, add the corresponding block to `hardhat.config.js`, for example:
{% endhint %}

{% code title="hardhat.config.js" %}

```js
module.exports = {
  // ...existing config
  etherscan: {
    apiKey: {
      lumiaBeam: process.env.LUMIA_EXPLORER_API_KEY, // {{TODO: confirm whether an API key is required at all}}
    },
    customChains: [
      {
        network: "lumiaBeam",
        chainId: 2030232745,
        urls: {
          apiURL: "{{TODO: confirm: explorer API URL for Beam}}",
          browserURL: "{{TODO: see /reference/explorers for the browser URL}}",
        },
      },
    ],
  },
};
```

{% endcode %}
{% endstep %}

{% step %}

#### 3. Run verification against your deployed address

```bash
npx hardhat verify --network lumiaBeam <DEPLOYED_CONTRACT_ADDRESS> <constructor arg 1> <constructor arg 2>
```

List constructor arguments in the same order your contract's constructor takes them; omit this if your contract has none.
{% endstep %}
{% endstepper %}

## Verify it worked

Open the contract's address on the Beam explorer (see [Block explorers](file:///5838283/environment/Block-explorers.md)). The **Contract** tab shows your source code and a **Read/Write Contract** panel once verification succeeds.

## Troubleshooting

<details>

<summary><code>hardhat verify</code> fails with an API/network error</summary>

The explorer API URL or key requirement isn't confirmed yet for Lumia. See the TODO above. Check whether Lumia's explorer (Blockscout-based, per [`/reference/explorers`](file:///reference/Block-explorers-reference.md)) needs a key at all before assuming your key is wrong.

</details>

<details>

<summary>"Already verified" but the explorer shows no source</summary>

This usually means a prior partial verification attempt; try again with the exact same compiler version and settings used to deploy.

</details>

<details>

<summary>Constructor argument mismatch error</summary>

The arguments passed to `hardhat verify` must exactly match, in order and type, what was passed to `deploy()`.

</details>
