Contract Verification
Contract verification is an essential step in enabling Debugger, Simulator, Web3 Actions, and other Tenderly features and ensuring they work seamlessly with your Smart Contracts. Tenderly offers several methods of verification, bringing different levels of control, visibility, and flexibility.
In the building phase, your Smart Contract can undergo private verification, so it’s visible only within your Tenderly project. When you’re ready to share your work, you can do a public verification, which makes the verified contract available to anybody who might interact or integrate with your Smart Contract.
Tenderly automatically detects whether a contract is verified on Etherscan. In this case, verification in Tenderly is not needed, you just need to add the contract to your project.
However, after performing verification in Tenderly, you will have to verify it manually on Etherscan.

What is contract verification?

When you deploy a Smart Contract on a network, you’re essentially deploying the bytecode produced by the Solidity compiler. No information about the originating Solidity code is preserved.
To verify a contract means to check if the Smart Contract source code compiles into the on-chain bytecode. If it does, we can say we verified that the bytecode comes from the provided source code, hence the name – verification.
After verifying Smart Contracts, it’s possible to link their execution back to the instructions in the original source code, enabling step-by-step debugging, decoding of Events, and the use of other Tenderly features.

How are Smart Contracts verified in Tenderly?

In the verification process, Tenderly compares the deployed bytecode to the Solidity source code of a Smart Contract. The algorithm compiles the provided source code again and compares the generated bytecode to the deployed one. If the two sides match in every way, the contract is verified.
Code verification requires three arguments:
  • The source code, including the source of all imports
  • The version of the compiler used to produce the deployed bytecode
  • Information about the number of compiler optimizations (if any)
If any of these pieces of information is wrong, the process of verification fails.

Methods of verification

Tenderly offers different ways to verify Smart Contracts, with each one bringing different levels of configuration flexibility and control.
The first way entails verifying Smart Contracts using the Tenderly Dashboard.
The second approach is code-oriented and entails verifying Smart Contracts using the Hardhat plugin. This approach offers automatic (no-code) verification, as well as manual verification through code.

Modes of verification

Depending on whether your contract is deployed on a network or a Tenderly Fork, there are three modes of contract verification:
  • Public: Every Tenderly user will be able to see the verified source code and use Tenderly tooling with that contract.
  • Private: The contract is verified and thus valid within a single project in Tenderly, available to you and anybody with access to the project.
  • On a Tenderly Fork: The contract is verified and thus valid within the Fork you deployed it to.
When doing verification with Hardhat, contracts are verified as public by default. To verify a contract privately, you have to configure this explicitly,