πŸ”¦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.

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.

Getting the Contract Metadata

  1. Using solc --metadata command as explained in the solidity documentation.

  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.

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

Contract Interaction

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

Last updated