Verifying your smart contracts on RWALayer is a crucial step to ensure transparency and trust. RWALayer supports verification through popular tools like Hardhat and Foundry. Below is a comprehensive guide to help you navigate the verification process using these tools.

Configuring Verification Endpoints

It’s crucial to direct your verification requests to the appropriate API endpoint. For Hardhat, this is configured in the apiUrl within your settings. For Foundry, you need to specify this via the --verifier-url in your forge command:

ExplorerTestnet Endpoint
https://explorer.rwalayer.comhttps://rpc.rwalayer.com/

Contract verification using Foundry

To verify your contracts during deployment or for an existing deployment using Foundry, follow these steps:

# Verification during deployment
forge script <deploy-script> \
    --verify --verifier-url <verification-endpoint> \
    --etherscan-api-key <api-key> --rpc-url <rpc-url> \
    --verify --broadcast -vvvv
# Verification of an existing contract
forge verify-contract <address> <contract> \
    --verifier-url <verification-endpoint> \
    --etherscan-api-key <api-key> --watch

Contract verification using Hardhat

For Hardhat users, successful contract verification involves proper configuration of your hardhat.config.ts or hardhat.config.js file. This includes setting up the networks and etherscan properties.


import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-ignition-ethers";
import { vars } from "hardhat/config";

const PRIVATE_KEY = vars.get("PRIVATE_KEY");

const config: HardhatUserConfig = {
  solidity: "0.8.24",
  networks: {
    "rwalayer-testnet": {
    url: "https://rpc.rwalayer.com/",
    accounts: [PRIVATE_KEY]
    }
  },
  etherscan: {
    apiKey: API_KEY,
    customChains: [
      {
        network: "rwalayer-testnet",
        chainId: 3549,
        urls: {
          apiURL: <verification-endpoint>,
          browserURL: <explorer-url>
        }
      }
    ],
    enabled: true
  }
};

export default config;