> ## Documentation Index
> Fetch the complete documentation index at: https://hedera-0c6e0218-mintlify-bc559771.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify a Smart Contract on HashScan

> Verify a deployed Hedera smart contract on Sourcify so HashScan automatically displays the matched source code, ABI, and metadata for users.

Verifying smart contracts proves that the deployed bytecode matches the source files you publish. On Hedera, verification is handled by [Sourcify](https://sourcify.dev), which natively supports Hedera Mainnet (chain ID `295`) and Testnet (chain ID `296`). Once a contract is verified on Sourcify, [HashScan](https://hashscan.io/) automatically picks up the verified status and displays the source code on the contract page.

<Warning>
  The in-app HashScan verification form is temporarily disabled. Verify your contracts directly at [sourcify.dev](https://sourcify.dev) using the steps below, or use the Foundry / Hardhat tutorials linked at the bottom of this page.
</Warning>

***

## Prerequisites

* Solidity [source code file](/evm/development/verifying#smart-contract-source-code) of the deployed smart contract.
* Solidity [JSON (metadata) file](/evm/development/verifying#the-metadata-file) of the deployed smart contract.
* EVM address of the smart contract deployed on the Hedera network.

***

## Table of Contents

1. [Verify on Sourcify](#step-1%3A-verify-on-sourcify)
2. [Confirm on HashScan](#step-2%3A-confirm-on-hashscan)
3. [Bundled Metadata for Complex Contracts](#bundled-metadata-for-complex-contracts)
4. [Recommended: Programmatic Verification](#recommended%3A-programmatic-verification)
5. [Additional Resources](#additional-resources)

***

## Step 1: Verify on Sourcify

1. Open [sourcify.dev](https://sourcify.dev) in your browser.
2. Choose the network that matches your deployment: **Hedera Mainnet** (chain ID `295`) or **Hedera Testnet** (chain ID `296`).
3. Paste the deployed contract's EVM address.
4. Upload your Solidity source files (`.sol`) and the metadata file (`.json`). The metadata file is generated when you compile the contract; for example, with Hardhat it lives under `artifacts/build-info/`, and with Foundry the metadata is included in the per-contract JSON under `out/`.
5. Submit the verification request. Sourcify will recompile your sources and compare them against the deployed bytecode.

If the comparison succeeds, Sourcify returns either a [Full Match](https://docs.sourcify.dev/docs/full-vs-partial-match/#full-perfect-matches) or a [Partial Match](https://docs.sourcify.dev/docs/full-vs-partial-match/#partial-matches):

* **Full Match**: the bytecode and metadata are an exact match. Source code, comments, and variable names line up with the deployed contract.
* **Partial Match**: the bytecode mostly matches, but the metadata hash differs (typically due to comments or variable names). This is sufficient for most verification purposes.

<Accordion title="📣 Different compiling tools require specific source files. Here's a brief outline of what's needed for popular tools:">
  1. **Remix**:
     * **Required for Full Match Verification**: Both the metadata file found in the `contracts/artifacts/` folder and the smart contract's Solidity file. More details [here](/evm/development/verifying#remix-ide-beginner).
  2. **Hardhat**:
     * **Required for Full Match Verification**: Only the output of the compilation JSON file found in the `/artifacts/build-info/` folder. More details [here](/evm/development/verifying#hardhat-intermediate).
  3. **Solidity Compiler (solc)**:
     * **Required for Full Match Verification**: Both the metadata file (generated by `solc --metadata`) and the smart contract's Solidity file. More details [here](/evm/development/verifying#solidity-compiler-advanced).
  4. **Foundry**:
     * **Required for Full Match Verification**: Both the metadata file (generated by `forge build`) and the smart contract's Solidity file.

  ***Note: Uploading only the Solidity file without the metadata file will result in a Partial Match.***
</Accordion>

***

## Step 2: Confirm on HashScan

Open the contract on [HashScan](https://hashscan.io/), making sure you're on the same network you verified against. The contract's source code, ABI, and verification badge will appear on the **Contract** tab once HashScan picks up the verified status from Sourcify.

To learn more about each verification match status, head over to the official Sourcify documentation [here](https://docs.sourcify.dev/docs/full-vs-partial-match/).

**Congratulations! 🎉 You have successfully verified a smart contract on Hedera. Feel free to reach out on** [**Discord**](https://hedera.com/discord) **if you have any questions!**

***

## Bundled Metadata for Complex Contracts

For projects with multiple dependencies (such as OpenZeppelin libraries) or upgradeable proxy contracts, manually uploading individual source files can be **extremely difficult and error-prone**. Each dependency must be uploaded separately, and ensuring all imports resolve correctly is challenging.

A more robust manual approach is to generate a single, self-contained `metadata.json` file that includes all source code dependencies inline. This single file can then be uploaded to Sourcify in place of dozens of individual files.

### Why Use This Approach?

When a contract imports many external libraries and files, the standard manual upload requires you to provide:

* The main contract `.sol` file
* The metadata `.json` file
* **Every** imported dependency file

The bundled approach packages everything into one file.

### Generating the Single Metadata File

Both Hardhat and Foundry projects can be configured to generate this single file using community-developed scripts that leverage the Sourcify standard.

1. **Download the metadata generation script** from [Generate Hedera SC Metadata Repo](https://gist.github.com/kpachhai/972d63c5f5ecd9bbc718ab4dd34d5f29):

   ```bash theme={null}
    curl -O https://gist.githubusercontent.com/kpachhai/972d63c5f5ecd9bbc718ab4dd34d5f29/raw/generate_hedera_sc_metadata.sh
    chmod +x generate_hedera_sc_metadata.sh
   ```

2. **Run the script** to generate the bundles:

   ```bash theme={null}
   # USAGE:
   #   ./generate_hedera_sc_metadata.sh [ContractName] [ContractName=0xAddress] ...

   # EXAMPLES:
   #   ./generate_hedera_sc_metadata.sh MyToken
   #   ./generate_hedera_sc_metadata.sh MyToken=0x1234567890abcdef...
   #   ./generate_hedera_sc_metadata.sh src/MyContract.sol:MyContract=0x9876...

   # For example, for a contract "MyToken":
   ./generate_hedera_sc_metadata.sh MyToken
   ```

3. This produces a directory (e.g., `verify-bundles/`) containing a single `metadata.json` file for each contract.

   ```bash theme={null}
   >> tree verify-bundles/
   verify-bundles/
   ├── MANIFEST.txt
   └── MyToken
       └── metadata.json
   ```

4. On [sourcify.dev](https://sourcify.dev), select the Hedera network, enter the contract address, and upload the corresponding single `metadata.json` file.

***

## Recommended: Programmatic Verification

While the bundled metadata approach above is more robust than uploading individual files, programmatic verification through Foundry or Hardhat is even more reliable and integrates cleanly into a deployment pipeline. See the standalone guides for fully automated workflows:

<Card title="Deploy and Verify a Smart Contract with Foundry" href="/evm/quickstart/deploy-with-foundry" />

<Card title="Deploy and Verify a Smart Contract with Hardhat" href="/evm/quickstart/deploy-with-hardhat" />

***

## Additional Resources

**➡** [**Smart Contract Verification API**](/reference/verification-api)

**➡** [**HashScan Network Explorer**](https://hashscan.io/)

**➡** [**Sourcify Verification UI**](https://sourcify.dev)

**➡** [**Sourcify v2 API Docs**](https://docs.sourcify.dev/docs/api/)

**➡** [**Sourcify Documentation**](https://docs.sourcify.dev/docs/intro)

**➡** [**Smart Contract Documentation**](/evm/development/verifying)

<Columns cols={2}>
  <Card title="Writer: Krystal, Senior DX Engineer">
    [GitHub](https://github.com/theekrystallee) |
    [X](https://X.com/theekrystallee)
  </Card>

  <Card title="Editor: Luke, DevRel Engineer">
    [GitHub](https://github.com/LukeForrest-Hashgraph) |
    [X](https://x.com/_LukeForrest)
  </Card>

  <Card title="Editor: Nana, Sr. Software Manager">
    [GitHub](https://github.com/Nana-EC) |
    [LinkedIn](https://www.linkedin.com/in/nconduah/)
  </Card>

  <Card title="Editor: Ed, DevRel Engineer">
    [GitHub](https://github.com/ed-marquez) |
    [LinkedIn](https://www.linkedin.com/in/ed-marquez/)
  </Card>

  <Card title="Editor: Logan, Senior Software Engineer">
    [GitHub](https://github.com/quiet-node) |
    [LinkedIn](https://www.linkedin.com/in/logann131/)
  </Card>
</Columns>
