Skip to content

About Contracts Verification

Miao ZhiCheng edited this page Jun 15, 2022 · 6 revisions

Contracts verification is an important step for the deployment of EVMv1 smart contracts. The goals of the production pipeline of the contracts verification are:

  1. Automated verification after each smart contracts deployment.
  2. Reproducible verification process locally as a developer.
  3. Support major block explorer solutions.
  4. Keep the pipeline lean.

Production Pipeline

Security Considerations

Verifiability

The Solidity compiler generates contract metadata which contains the contract ABI, compiler version and settings, hashes of source files, natspec docs and more - see related Solidity docs.
A hash of this metadata and the compiler version are CBOR encoded and appended to the bytecode deployed on chain, such that the compile-time metadata is cryptographically verifiable.
Check out the sourcify playground for an intuitive and interactive explanation.

Availability

Making metadata (most importantly - the underlying sourcecode) available is a process independent of the actual contract deployment.
The currently most popular method is to upload the data to etherscan-like exporers via an API they provide. After verification of a contract, this explorers provide a UI interface which not only shows the contract source code, but also provides forms which allow to query and modify (if a wallet is connected) the contract state based on its ABI. As an example, see the Polygon Superfluid Host contract.
Etherscan-like explorers also provide API endpoints for querying data (ABI, source code) of verified contracts, see API docs.

Metadata should ideally also be stored on decentralized storage systems like IPFS and Swarm in order to make its availability independent of centralized entities.
The sourcify project is dedicated to help make that the norm by building tooling and documentation for a decentralized repository of contract metadata.

Bugs & Future Work

Clone this wiki locally