Contracts verification in explorers
How to enable automatic contract verification feature in bridge contracts deployment script
The instructions below show how to configure the variables to enable the automatic contract verification in block explorers when using the bridge contracts deployment script. This feature only supports Blockscout and Etherscan block explorers.
It is worth to mention that the home and foreign side of the bridge are not limited to a specific explorer and they can be used in any of the sides. For example, in this case, we could also use the Kovan Blockscout version to verify the contracts in Kovan.
While Blockscout does not require authentication, Etherscan requires to create an user and an API-KEY.
Sign in into your etherscan account
3. Select the
API-KEYsoption from the menu
4. Click on the button
Create a new API-KEY token
Button to create a new API-KEY token
5. Add an optional name to the
API-KEYand click on the button
Add a name and click on continue
6. The created
API-KEYwill be displayed in the list.
List of API-KEYs
At the moment of setting the variable for the configuration of the bridge deployment the following should be completed:
- HOME_EXPLORER_URL: The api url of Blockscout explorer to verify all the deployed contracts in Home network.
- HOME_EXPLORER_API_KEY: The api key of the explorer api, if required, used to verify all the deployed contracts in Home network. In this case it is not needed because Blockscout does not require an api key.
- FOREIGN_EXPLORER_URL: The api url of Etherscan explorer to verify all the deployed contracts in Foreign network.
- FOREIGN_EXPLORER_API_KEY: The api key of Etherscan explorer api, used to verify all the deployed contracts in Foreign network that we generated in the previous step.
This is how the configuration should look like:
After running the deployment script, if we search for the bridge addresses on the explorers, they should be verified showing the compilation data and the source code of the contracts.
Here is an example of how a verified contract looks in Blockscout
Verified contract in Blockscout
Here is an example of how a verified contract looks in Etherscan
Verified contract in Etherscan