Documentation/Smart Contracts/Contract Verification
Smart Contracts • Verification Guide

Contract Verification

Verify your smart contracts on Tetreum Testnet Explorer to enable public interaction and build trust.

Why Verify Your Contract?

Contract verification provides transparency and trust for your users:

For Users

  • • Read contract source code publicly
  • • Interact with contract through explorer
  • • Verify contract functionality
  • • Check for security vulnerabilities
  • • Build confidence in the project

For Developers

  • • Enhanced debugging capabilities
  • • Better integration with tools
  • • Professional credibility
  • • Community contribution
  • • Ecosystem participation
Verification Process

Follow these steps to verify your contract on Tetreum Explorer:

  1. 1

    Navigate to Your Contract

    Go to your contract page on Tetreum Explorer using the contract address.

  2. 2

    Click "Verify Contract"

    Look for the verification link in the contract details section.

  3. 3

    Fill Contract Details

    Provide contract name, compiler version, and optimization settings.

  4. 4

    Upload Source Code

    Paste or upload your complete Solidity source code.

  5. 5

    Submit for Verification

    Submit the form and wait for the verification process to complete.

Required Information

Gather this information before starting the verification process:

Contract Metadata

Contract Address

The deployed contract address on Tetreum

Contract Name

Exact name as defined in your Solidity file

Compiler Version

Solidity compiler version used (e.g., 0.8.19)

Optimization

Whether optimization was enabled and runs count

Source Code Requirements

  • • Complete Solidity source code (.sol files)
  • • All imported contracts and libraries
  • • Constructor parameters (if any)
  • • Library addresses (if used)
  • • ABI-encoded constructor arguments
Common Verification Issues

Troubleshoot common problems that can prevent successful verification:

Compiler Version Mismatch

Error: Compiled bytecode doesn't match deployed bytecode

  • • Check exact Solidity version used during deployment
  • • Verify optimization settings match deployment configuration
  • • Ensure pragma solidity version is correct

Missing Constructor Parameters

Error: Constructor parameters required for verification

  • • Include ABI-encoded constructor arguments
  • • Check deployment transaction for parameter values
  • • Use online ABI encoder tools if needed

Import Path Issues

Error: Cannot resolve import statements

  • • Flatten contract to single file before submission
  • • Use tools like Hardhat flatten or Truffle flattener
  • • Ensure all dependencies are included
Automated Verification

Automate contract verification using Hardhat or Foundry:

Hardhat Verification

// Install hardhat-etherscan plugin
npm install --save-dev @nomiclabs/hardhat-etherscan

// hardhat.config.js
require("@nomiclabs/hardhat-etherscan");

module.exports = {
  etherscan: {
    apiKey: "YOUR_TETSCAN_API_KEY"
  },
  networks: {
    tetreum: {
      url: "https://testrpc.tetreum.com",
      accounts: [privateKey]
    }
  }
};

// Verify contract
npx hardhat verify --network tetreum CONTRACT_ADDRESS "Constructor Arg 1" "Constructor Arg 2"

Foundry Verification

# Set environment variables
export ETHERSCAN_API_KEY=your_tetscan_api_key

# Verify contract
forge verify-contract \
  --chain-id 5005 \
  --etherscan-api-key $ETHERSCAN_API_KEY \
  CONTRACT_ADDRESS \
  src/Contract.sol:ContractName \
  --constructor-args $(cast abi-encode "constructor(string,string)" "Name" "Symbol")

Verify Your Contracts

Build trust and transparency by verifying your smart contracts on Tetreum Testnet Explorer.