# Source Code Verification

## 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="/files/cXyRfEykqQyT6druJPNr" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/RlSWoHdIAzdaClZr0tCz" 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="/files/fC7fhP7HmaIjW4VWEXAl" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/XjwdHYcF9vA96mQY7HCJ" 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="/files/rCbSHSt8GR00qlvsIzhe" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/fFDdhBMUrOKHMj1cC1j1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/NhrqXPyiC0jEAcErYtTw" alt=""><figcaption></figcaption></figure>


---

# 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.chainlens.com/features/source-code-verification.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.
