> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skale.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Smart Contracts

> Guide to verifying ERC-20, ERC-721, and ERC-1155 contracts on SKALE block explorers

## Verify Smart Contracts

After deploying your smart contracts to SKALE, it's important to verify them on the block explorer. Verification makes your contract source code publicly available, allowing users to interact with your contract with confidence and enabling better transparency.

## Prerequisites

* A deployed smart contract on SKALE
* The source code and constructor arguments used for deployment
* Foundry or Hardhat installed (depending on your deployment method)

## Verification Methods

<Tabs>
  <Tab title="Using Foundry">
    Foundry provides a built-in verification command that works with Blockscout (the explorer used by SKALE).

    #### Basic Verification

    ```shell theme={null}
    forge verify-contract \
        --rpc-url skale_testnet \
        <CONTRACT_ADDRESS> \
        src/MyContract.sol:MyContract \
        --verifier blockscout \
        --verifier-url https://base-sepolia-testnet-explorer.skalenodes.com/api
    ```

    #### Verification with Constructor Arguments

    If your contract has constructor arguments:

    ```shell theme={null}
    forge verify-contract \
        --rpc-url skale_testnet \
        <CONTRACT_ADDRESS> \
        src/MyContract.sol:MyContract \
        --constructor-args $(cast abi-encode "constructor(string,uint256)" "MyToken" 1000000) \
        --verifier blockscout \
        --verifier-url https://base-sepolia-testnet-explorer.skalenodes.com/api
    ```

    #### Verification with Libraries

    If your contract uses libraries (like OpenZeppelin):

    ```shell theme={null}
    forge verify-contract \
        --rpc-url skale_testnet \
        <CONTRACT_ADDRESS> \
        src/MyERC20.sol:MyERC20 \
        --libraries @openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20:<LIBRARY_ADDRESS> \
        --verifier blockscout \
        --verifier-url https://base-sepolia-testnet-explorer.skalenodes.com/api
    ```
  </Tab>

  <Tab title="Using Hardhat">
    Hardhat also supports contract verification through the `@nomicfoundation/hardhat-verify` plugin.

    #### Configuration

    Ensure your `hardhat.config.js` includes the verify plugin configuration:

    ```javascript theme={null}
    require("@nomicfoundation/hardhat-verify");

    module.exports = {
      // ... other config
      etherscan: {
        apiKey: {
          skale_testnet: "your-api-key", // Not required for Blockscout
        },
        customChains: [
          {
            network: "skale_testnet",
            chainId: 324705682,
            urls: {
              apiURL: "https://base-sepolia-testnet-explorer.skalenodes.com/api",
              browserURL: "https://base-sepolia-testnet-explorer.skalenodes.com",
            },
          },
        ],
      },
    };
    ```

    #### Basic Verification

    ```shell theme={null}
    npx hardhat verify --network skale_testnet <CONTRACT_ADDRESS>
    ```

    #### Verification with Constructor Arguments

    ```shell theme={null}
    npx hardhat verify --network skale_testnet <CONTRACT_ADDRESS> "arg1" "arg2"
    ```
  </Tab>
</Tabs>

## Finding Your Block Explorer URL

Each SKALE Chain has its own block explorer. To find your chain's explorer URL:

1. Visit the [SKALE Portal](https://portal.skale.space)
2. Select your chain
3. Find the "Explorer" link or API endpoint

The API URL format is typically:

* Testnet: `https://<chain-name>.explorer.testnet.skalenodes.com/api`
* Mainnet: `https://<chain-name>.explorer.mainnet.skalenodes.com/api`

## Troubleshooting

### Contract Already Verified

If you see "Contract is already verified", the contract has been successfully verified previously.

### Verification Failed

Common issues and solutions:

1. **Wrong Constructor Arguments**: Double-check your constructor arguments
2. **Compiler Version Mismatch**: Ensure you're using the same Solidity version
3. **Optimization Settings**: Match your compiler optimization settings
4. **Library Addresses**: Verify all library addresses are correct

### Manual Verification

If automated verification fails, you can manually verify:

1. Go to your contract's page on the block explorer
2. Click "Verify and Publish"
3. Fill in the contract details manually
4. Paste your source code

## Best Practices

1. **Verify Immediately**: Verify contracts right after deployment
2. **Save Constructor Args**: Keep a record of constructor arguments
3. **Use Version Control**: Commit your source code for reference
4. **Test Verification**: Test verification on testnet before mainnet

## Related Topics

* [Deploy an ERC-20 Token](/cookbook/smart-contracts/deploy-erc20-token)
* [Setup Foundry](/cookbook/deployment/setup-foundry)
* [Setup Hardhat](/cookbook/deployment/setup-hardhat)
