Skip to content

Contract Verification on XOS

After successfully deploying your smart contract to the XOS network, verifying your contract's source code is a crucial next step. Verification makes your contract's source code publicly visible on the block explorer, enhancing transparency and allowing users to interact with your contract directly through the explorer interface.

This guide outlines the verification process using both Remix IDE and Hardhat, with emphasis on the recommended Standard JSON Input method for reliable verification results.


Step 1: Navigate to the XOS Explorer

  1. Open your web browser and go to the XOS Explorer
  2. Enter your contract's address in the search field
  3. On the contract page, locate and select the Code tab
  4. Click the Verify & Publish button to begin the verification process

Step 2: Choose a Verification Method

The XOS Explorer supports multiple verification approaches. For the most reliable results, we strongly recommend using the Standard JSON Input method.

Benefits of Standard JSON Input

  • Captures all compiler settings exactly as used during deployment
  • Includes all necessary metadata and dependencies
  • Minimizes verification failures due to configuration mismatches

Step 3: Verification Using Remix IDE

Generating the Standard JSON Input

  1. Open your project in Remix IDE at remix.ethereum.org

  2. Navigate to the Solidity Compiler panel

  3. Ensure your compiler settings match those used during deployment:

    • Select the exact compiler version
    • Set optimization settings to match deployment configuration
    • Click the Compile button
  4. Access the JSON data:

    • Expand the Compilation Details section
    • Locate and copy the Standard JSON Input data
    • Save this data to a local file with a .json extension

Submitting for Verification

  1. Return to the XOS Explorer verification page
  2. Select Standard JSON Input as your verification method
  3. Upload the JSON file you saved from Remix
  4. Select the appropriate license type for your contract
  5. Click Verify & Publish to submit

The explorer will process your submission and display a success message when verification is complete.


Step 4: Verification Using Hardhat

Generating Standard JSON Input with Hardhat

  1. Navigate to your Hardhat project directory in the terminal
  2. Run the compilation command:
    bash
    npx hardhat compile
  3. Locate the artifacts folder in your project directory
  4. Find the build-info subfolder which contains compilation artifacts
  5. Inside this folder, you'll find JSON files containing the Standard Input format

Submitting for Verification

  1. Go to the XOS Explorer verification page
  2. Select Standard JSON Input as your verification method
  3. Upload the JSON file from your Hardhat artifacts
  4. Select the appropriate license type
  5. Submit the verification request

Verification Troubleshooting

Common Issues

  1. Compiler Version Mismatch

    • Ensure the compiler version in your verification matches exactly what was used for deployment
    • Even minor version differences can cause verification to fail
  2. Optimization Settings

    • If you enabled optimization during compilation, the same settings must be used for verification
    • Check both the optimization flag and the number of optimization runs
  3. Constructor Arguments

    • For contracts with constructor parameters, ensure these are correctly provided during verification
    • ABI-encoded constructor arguments may be required for some verification methods

Importance of Contract Verification

  1. User Trust: Verified contracts allow users to review the code before interacting with it
  2. Transparency: Makes your contract's functionality publicly visible and auditable
  3. Usability: Enables direct interaction with your contract through the explorer interface
  4. Discoverability: Improves your contract's visibility in the ecosystem

By completing the verification process, you've taken an important step toward building a transparent and trustworthy application on the XOS network. Your verified contract is now ready for users to interact with confidently.