> 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-truffle.md).

# Verify a contract with Truffle

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

**Prerequisites:** a contract already deployed. See [Deploy a contract with Truffle](broken://pages/8a741ad4416d5f627db68dd169bc2af5dfdfed5d).

**Time:** a couple of minutes.

{% stepper %}
{% step %}

#### 1. Install the verification plugin

```bash
npm install --save-dev truffle-plugin-verify
```

{% endstep %}

{% step %}

#### 2. Add it to `truffle-config.js`

{% code title="truffle-config.js" %}

```js
module.exports = {
  // ...existing config
  plugins: ["truffle-plugin-verify"],
  api_keys: {
    lumiaBeam: process.env.LUMIA_EXPLORER_API_KEY, // {{TODO: confirm whether an API key is required at all}}
  },
};
```

{% endcode %}
{% endstep %}

{% step %}

#### 3. Confirm the verifier backend

{% hint style="warning" %}
The exact verifier backend Lumia's explorer expects (a Blockscout-style flow versus an Etherscan-style API key flow) is {{TODO: confirm with protocol eng: not confirmed in material available 2026-09-09}}; the plugin config above may need Lumia-specific endpoint settings once that's resolved.
{% endhint %}
{% endstep %}

{% step %}

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

```bash
npx truffle run verify YourContract@<DEPLOYED_CONTRACT_ADDRESS> --network lumiaBeam
```

{% 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>truffle run verify</code> fails with an API/network error</summary>

The explorer API endpoint or key requirement isn't confirmed yet for Lumia. See the TODO above.

</details>

<details>

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

Try again with the exact compiler version and optimizer settings used at deploy time; a mismatch here is the most common cause.

</details>

<details>

<summary>Constructor argument encoding errors</summary>

Confirm the contract name after `@` in the command matches the artifact name exactly, including case.

</details>
