🟒Verifying Using Remix Ethereum

Verifying a Smart Contract on Avenium Using Remix Ethereum

Step-by-Step Guide

1. Deploy Your Smart Contract

First, let's assume you have already deployed your smart contract using Remix Ethereum. For the purpose of this guide, we'll use a simple ERC-20 token contract as an example.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract AveToken is ERC20, Ownable {
    constructor() ERC20("Ave Token", "AVE") {
        _mint(msg.sender, 1000000 * 10 ** decimals());
    }

    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }

    function burn(address from, uint256 amount) external onlyOwner {
        _burn(from, amount);
    }
}

2. Get Deployment Details

After deploying the contract, you'll need the following details:

  • The address of the deployed contract.

  • The compiler version and settings used for deployment.

3. Navigate to the Block Explorer

  1. Go to the Avenium block explorer for the appropriate network:

4. Verify the Contract

  1. Search for Your Contract: Enter the contract address in the search bar on the explorer to navigate to your contract’s page.

  2. Verify & Publish: Click on the "Verify & Publish" button.

5. Fill in Verification Details

  1. Contract Address: Ensure the correct contract address is entered.

  2. Compiler Type: Select Solidity (Single file) or Solidity (Multi-Part files) depending on your setup.

  3. Compiler Version: Select the same compiler version used in Remix. You can find this version in the Solidity Compiler tab in Remix (e.g., v0.8.0).

  4. Optimization: Choose the optimization settings used during compilation. If you enabled optimization in Remix, ensure this is set to Yes and provide the optimization runs (usually 200).

  5. Enter Solidity Contract Code: Paste your entire Solidity contract code into the provided field. Ensure it includes any necessary imports and pragma statements.

6. Enter Constructor Arguments

If your contract constructor requires arguments, you need to encode these arguments in ABI-encoded format.

  • Constructor Arguments: Encode the constructor parameters using ABI encoding. You can do this with tools like the Remix console or an online ABI encoder.

For example, if your constructor requires a string name and string symbol:

  • Constructor arguments for AveToken("Ave Token", "AVE") are ["Ave Token", "AVE"].

7. Submit Verification

After filling out the required information and pasting your contract code:

  1. Click the Verify button.

  2. Wait for the explorer to process and verify your contract. This may take a few moments.

Example: Step-by-Step Verification in Remix

Step 1: Deploy Contract Using Remix

  1. Write your contract in Remix and compile it.

  2. Deploy the contract using MetaMask connected to the Avenium testnet or mainnet.

Step 2: Copy Contract Code and ABI

  1. Copy the entire source code of your contract.

  2. If constructor arguments are required, use Remix's deployment logs or the Remix console to get the ABI-encoded constructor arguments.

Step 3: Access the Block Explorer

  1. Go to testnet.avescan.net for testnet verification.

  2. Search for your deployed contract address.

Step 4: Verify & Publish

  1. Click on Verify & Publish.

  2. Fill out the form with your contract details:

    • Compiler Type: Solidity (Single file) or Solidity (Multi-Part files).

    • Compiler Version: Select the same version you used in Remix.

    • Optimization: Match the setting from Remix.

  3. Paste the entire contract source code.

  4. Add any necessary constructor arguments in ABI-encoded format.

  5. Submit the form to verify.

By following these steps, you can successfully verify your smart contract deployed using Remix Ethereum on the Avenium blockchain explorer. This process ensures transparency and allows users to view your contract's source code and interactions, enhancing trust and security. Always double-check your compiler settings and constructor arguments to ensure successful verification.

4o

Last updated