Dashboard Contract Verification
Smart contracts can be verified from your browser using the Tenderly Dashboard. In case you’re not using an elaborate setup for contract deployment, such as Hardhat, a better approach is to use the code-based approach to verification.
Prerequisites
To verify a contract, you need to provide:
- The source code
- The exact compiler settings used to compile the deployed version
You can upload the source code in several ways through the Dashboard:
- By uploading a JSON file containing contract metadata generated by the compiler
- By pasting the source code directly
- By uploading the source file from your file system
- By uploading the entire directory with all your smart contracts. This makes it easy to verify contracts that have imports from other files.
Public and private verification
When verifying Smart Contracts, you have to choose between two modes: private and public.
- Public (within Tenderly): The verified contract and its source code are available to all Tenderly users. You’re comfortable with sharing your contract with users outside your project. You want to enable the callers of your contract to use the monitoring tools.
- Private (within Tenderly): The verified contract is visible only to the team/collaborators. Suitable during contract development.
The Verification column in the Contracts tab indicates if your contract is verified at all, privately or publicly.
Dashboard contract verification guide
After you’ve added an unverified contract to a Tenderly project, here are the steps to verify it using the Dashboard.
Find the unverified contract
In the Dashboard, find your unverified contract in the Contracts list and click the Verify button next to the verification status.
Choose the upload method
Choose between JSON Upload and Contract File Upload to verify the contract.
- Pick JSON Upload if you want to enter the JSON metadata generated by the Solidity compiler.
- Pick API Upload to paste the ABI of the contract.
- Pink Contract Source Upload if you want to paste the contract source code directly, upload a single source file, or upload a source directory when importing an entire project such as a Hardhat project. The latter works best for smart contracts that import other contracts within your local project.
Set the verification to private
Mark the target contract in the next window and select the Private option to go with private contract verification.
Select the contract file
If the file contains several contracts, pick the one you wish to verify (the deployed to the address shown in step 2) and repeat the process for others if needed.
If there are any missing contract files, a notification will show up and prompt you to add them to complete the contract verification process.
5. Set the compiler settings
Fill in the compiler parameters, including the compiler version, optimization used (true/false), optimization count, EVM version (the latest set by default), and library (one or more library name-address pairs, if required).
Complete the verification
Click the Finish button to complete the verification.
How to verify smart contracts in bulk
If you add several unverified contracts to your project, it’s possible to verify them in bulk. Follow these steps:
Find all unverified contracts
Click the Verify All Contracts in the Contract section. This will open a modal that lists all the unverified contracts in your project.
Add the contract source
Click the Add Source button for each contract you wish to verify and repeat steps 6-8 from the Verifying a Smart Contract section.
Set the verification to private
Click the Make Private switch if you want to go with private verification for any of the contracts.
Complete the verification
Click the Finish button after adding the required verification information and complete the process.
Once you upload and verify the smart contracts, choose whether to display them all in the transaction list.