2.7.3. ChainIDE Scan Verifier

ChainIDE offers contract verification plug-ins that can scan and verify smart contracts on Ethereum, Polygon, BNB Chain, Conflux and Astar.

1. Why verify a smart contract?

Verifying a smart contract on Blockchain Scan is important for several reasons:
  1. 1.
    Ensuring accuracy: Verifying a smart contract on scan ensures that the contract code that is published on the blockchain is the same as the original code that was used to create the contract. This helps prevent errors or malicious code from being introduced into the contract.
  2. 2.
    Building trust: By verifying a smart contract on scan, developers and users can be confident that the contract is legitimate and not a scam. This builds trust and confidence in the contract and the parties involved.
  3. 3.
    Facilitating audits: Verifying a smart contract on scan also facilitates audits by third-party security experts who can review the code and provide feedback on any vulnerabilities or issues that need to be addressed.
  4. 4.
    Improving transparency: Verifying a smart contract on scan increases transparency by making the contract code visible to anyone who wants to see it. This helps ensure that the contract operates as intended and provides the expected outcomes.
  5. 5.
    Interaction through scan: Once a smart contract is verified on scan, users can interact with it directly through the scan website. This allows users to view and interact with the smart contract's functions and data without the need for a separate user interface or application.
The above-mentioned are some of the reasons why we need to verify a smart contract. Let's move on forward and see how to verify a smart contract.

2. How to verify a smart contract?

Once a smart contract is deployed, its source code can be uploaded and authenticated using a scan verifier. The procedure is divided into three steps:
  1. 1.
    Enter ChainIDE and select the verification plug-in panel.
  2. 2.
    Go to scan to register an account and obtain an API key. (Optional)
  3. 3.
    Fill in the necessary parameters for the contract verification.

1. Enter ChainIDE and Choose the Verification Panel

Go to ChainIDE. Choose a smart contract that you want to get verified, compile , connect wallet and deploy the smart contract. After deployment, open the "Scan Verifier" and fill in all the required information.

2.Go to scan to register an account and obtain an API key (Conflux Scan and Astar EVM Scan can skip this step).

Click on the icon to navigate to the corresponding scan, and create an account if you don't have one already.
After creating an account, log in to your account, and go to the "API Keys" section under the "OTHERS". Click the "+Add" button in front of the "My API Keys" and a new panel will be popped up;
Write down your project name there and press the "Create New API Key" button;
Now you'll get a new API Key Token.

3. Fill in the necessary parameters for the contract verification.

The details of each required field are given below:
  1. 2.
    API End Point: The API URL provided by scan will be automatically filled in when connecting to a specific network. For example, the link in the figure is the Sepolia Testnet of Ethereum.
  2. 3.
    API Key: The API Key obtained in the previous step; you need to bring this address to access the URL of scan.
  3. 4.
    Remember the API Key: this will record the API in local storage.
  4. 5.
    Compiled Contract: Select among the compiled contracts the one that needs to be verified.
  5. 6.
    Contract Address: Fill in the address of the deployed smart contract.
  6. 7.
    Constructor Parameters: Fill in the deployment parameters.
After filling in all the above information, click the "Verify" button.
After clicking the "Verify" button, if everything is correct, your contract will be verified, and a link to view your verified smart contract on the scan will be given.
If you need it, please refer to how to verify contracts in Astar WASM.