> For the complete documentation index, see [llms.txt](https://docs.chainlens.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chainlens.com/features/source-code-verification.md).

# Source Code Verification

Chainlens block explorer provides a source code verification feature that allows deployed contracts on blockchain networks to be verified and interacted with via the Chainlens user interface.

## Video Walkthrough

The below video demonstrates how to upload smart contract source code and interact with the smart contracts from within Chainlens.

{% embed url="<https://www.youtube.com/watch?v=52CUs7aQB8Q>" %}
Overview of source code verification in Chainlens
{% endembed %}

## Prerequisites

1. You should have a smart contract written in Solidity, compiled, and deployed to your preferred EVM-compatible network. You should be able to locate the contract in Chainlens using the contract's address.
2. You have the compiled source code and metadata. [Read more about contract metadata. ](https://docs.soliditylang.org/en/v0.8.17/metadata.html)

## Getting the Contract Metadata

1. Using `solc --metadata` command as explained in the [solidity documentation](https://docs.soliditylang.org/en/v0.8.17/metadata.html).&#x20;
2. The contracts metadata can be found in the `artifacts/build-info/` directory as a .json file for hardhat projects.
3. Truffle adds the contract's compiled files in the `build/contracts/` folder.

## Source Code Verification

On the view of the contract in Chainlens click on the sources tab.

\
From the sources tab, upload the contract's solidity source code and the generated metadata.

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2F9SE52X630cbc5eXsfz8V%2FScreenshot%202024-01-15%20at%2011.31.16.png?alt=media&amp;token=8a51d7a2-e28e-4342-8733-26433cff770e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FNBnREPisDTloU9OG3RG5%2FScreenshot%202024-01-15%20at%2011.32.45.png?alt=media&amp;token=eb841c34-6165-4a40-8951-8074685b4e4e" alt=""><figcaption></figcaption></figure>

The source code verification status will be changed, and the contract's source codes and ABI will be visible after successful verification.

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FHaQbArmWxbkZeKO6Alo6%2Fimage.png?alt=media&amp;token=80bd93e1-b318-44e1-bac3-280913684d4e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FCOUye7pGvC4a2h2iTilE%2Fimage.png?alt=media&amp;token=705e1b68-ba18-4370-b121-6ca4679527d2" alt=""><figcaption></figcaption></figure>

## Contract Interaction

You can now interact directly with the contract in Chainlens via the read and write tabs in the UI.

<br>

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FIokeJCelLVcRsXY1kCKB%2Fimage.png?alt=media&amp;token=5d31886f-e984-4750-93f4-9b6b4c6cd591" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FroVTNowgtAwIOcnATkao%2Fimage.png?alt=media&amp;token=3bc15d7a-8087-4cfc-ba38-01f28c8a5962" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2423938688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMWRlbTNmEBrb7vCVmeRi%2Fuploads%2FBRxrONupdcy8Al6iewiz%2Fimage.png?alt=media&amp;token=49ae49c6-a115-4989-b41c-0e0d526e9754" alt=""><figcaption></figcaption></figure>
