Verifying Smart Contracts

To verify smart contracts on the XDC Network

🧭 Table of contents

📰 Overview

Smart Contracts are a piece of code which when deployed on the blockchain, will always remain there and there is no way to change the logic of that smart contract until and unless it is specified in the smart contract. Also any such update to the code will result in an immutable change which is registered to the network for forever. Whenever we deploy a smart contract, we also have the option to Verify and Publish the smart contract so that others can check it out and see whether the logic is the same as popularised in the protocol advertisements. This also gives an option to find some malicious smart contracts over the blockchain.

What you will learn

This guide aims at teaching how to verify a smart contract on the XDC Apothem Testnet.

What you will do

  • Checking the deployed smart contract on Block Explorer

  • Verify the smart contract on a block explorer

  • Check the deployment status on

🔍 Viewing Deployed Contracts on the Block Explorer

We can deploy our smart contracts on the XDC Apothem Testnet or XinFin Mainnet according to our requirements.

First we would like to get the address of the deployed smart contract that we have to verify on the Block Explorer. For that we have to go to the XDCPay wallet and get the latest transaction hash that we performed to create the deployment.

If we are deploying the smart contract using Truffle or Hardhat, we would have to get the respective transaction hash from the terminal and get the respective deployed contract address from the block explorer or terminal itself.

Token Successfully Deployed!
Token address: 0xbC5bA2B6e2f74EC1e8e5A310a42F65D185691Af2

Next, navigate to the XDC Block explorer and paste the transaction hash there.

From there, we need to get the transaction details as well as the To Address where the contract is deployed.

🔍 Veryfing Contracts on the Block Explorer

Here we have a contract deployed on XDC Apothem Testnet, we can search for our newly deployed contract on XinFin Block Explorer:

And click in the Verify And Publish Option.

We will be redirected to the Contract verification page where we need to fill out:

  • Contract Name: Pizza

  • Compiler: Check your Solidity file for Compiler Version

  • Contract Code: Just paste everything from your Pizza.sol file

Once everything is filled out, press Submit!

If everything is correctly filled out, your contract page on the block explorer should display a new tab called Contract:

In this page you can Read from, Write to, or simply read the information tied to your Smart Contract on the blockchain:

In case, you are importing some external packages or libraries within your code, you would have to flatten out your smart contract first and then verify that flattened smart contract on the Block Explorer. You can check out our tutorials to flatten the smart contracts on Remix IDE, Truffle and Hardhat also.

For more information about Remix IDE, Please Visit Remix IDE Documentation. For more information about XDC Network, Please Visit XDC Network Documentation on GitBook.

Last updated