How to verify your token’s contract on a Blockchain Explorer

Today, I thought I would write up a quick guide on how to verify your token contract's source code on a blockchain explorer, as I know some of you have asked how to do this following our guide on creating an ERC223 token on ETC.

You can find the guide for creating your token and launching your ICO on Ethereum Classic here:

How to create a token and ICO on Ethereum Classic Tutorial
How to create a token and ICO on Ethereum Classic. Full tutorial on how to create an ERC223 ETC token and ICO.

How to verify your token's contract on a blockchain explorer like Etherhub or Blockscout

Note that though we are going to focus on how to do this on Ethereum Classic, you can follow the same process with an Ethereum block explorer if your token has been deployed on Ethereum.

What will I need?

  • Your token's contract source code and all the source code of any files you imported.
  • Know the pragma version you used to compile your token contract.
  • Your favourite blockchain explorer.

Also note that once you do this, the block explorer will publish your token's contract to be visible for everyone to see & browse. This is important for an ICO as it does give your investors a way to check your token's contract and verify that it is set up exactly how you have announced it. It also allows people to make sure there are no functions included in your smart contract that could be used fraudulently.

Step 1: Your Token's source code

If you followed our guide to create your token, then you will have something that resembles the following:

pragma solidity ^0.4.24;

import "./ERC223.sol";
import "./SafeMath.sol";

// change contract name to your contract's name
// i.e. "contract Bitcoin is ERC223Token"
contract YourNewToken is ERC223Token {
  using SafeMath for uint256;

  // for example, "Bitcoin"
  string public name = "SamR Test Token";
  // for example, "BTC"
  string public symbol = "SRT";
  // set token's precision
  // pick any number from 0 to 18
  // for example, 4 decimal points means that
  // smallest token using will be 0.0001 TKN
  uint public decimals = 8;
  // total supply of the token
  // for example, for Bitcoin it would be 21000000
  uint public totalSupply = 25000000 * (10**decimals);

  // Treasure is where ICO funds (ETH/ETC) will be forwarded
  // replace this address with your wallet address!
  // it is recommended that you create a paper wallet for this purpose
  address private treasury = 0x763b7a79c28767af07d94435a501729491109962;
  // ICO price. You will need to do a little bit of math to figure it out
  // given 4 decimals, this setting means "1 ETC = 50,000 TKN"
  uint256 private priceDiv = 5000000;
  event Purchase(address indexed purchaser, uint256 amount);

  constructor() public {
    // This is how many tokens you want to allocate to yourself
    balances[msg.sender] = 10000000 * (10**decimals);
    // This is how many tokens you want to allocate for ICO
    balances[0x0] = 15000000 * (10**decimals);

  function () public payable {
    bytes memory empty;
    if (msg.value == 0) { revert(); }
    uint256 purchasedAmount = msg.value.div(priceDiv);
    if (purchasedAmount == 0) { revert(); } // not enough ETC sent
    if (purchasedAmount > balances[0x0]) { revert(); } // too much ETC sent

    balances[0x0] = balances[0x0].sub(purchasedAmount);
    balances[msg.sender] = balances[msg.sender].add(purchasedAmount);

    emit Transfer(0x0, msg.sender, purchasedAmount);
    emit ERC223Transfer(0x0, msg.sender, purchasedAmount, empty);
    emit Purchase(msg.sender, purchasedAmount);

However, when you paste your code into a block explorer to verify it, you cannot have:

import "./ERC223.sol";
import "./SafeMath.sol";

You need to include the full source code of everything together, so remove those two lines and paste the contents of ERC223.sol and SafeMath.sol also make sure that once you have put everything together you only have:

pragma solidity ^0.4.24;

At the top once & not 3 times.

Step 2: Open your token's contract on a blockchain explorer

In my video tutorial for creating an ERC223 token & ICO we created SamR Test Token together, which is the source code you can see above. So if you we open the contract in blockscout: 0xb21e0064be8699b5d2cf2058977bb58a69e9a996 then you will see the following:


It is the Code section that interests us, so open it up and it should look like the following:


And as you may have guessed we want to click on Verify & Publish


If you have done everything right so far, you should see your contract address come up correctly. In the next section we will learn what needs to go in each box.

Step 3: Uploading your token's contract to be verified

Fill in the details as per the blockchain explorer's request, if you are doing it on Blockscout like myself then:

  • Contract Name = This is not your token name, this is the contract name you have set in your token's source code. Checking my token's contract above, as it was a test token, I have not set a unique one. We can see it is set to YourNewToken of course for a real project it would be better to have a unique contract name as the blockchain explorer will display it.
  • Compiler = This is the version of pragma I used to compile my token with REMIX, this will depend for your case, I know that I used version 0.4.24+commit.e67f0147.
  • Optimization = Again depends what you did when you compiled your token, in my case I had optimizations enabled, so I will select Yes.
  • Enter the Solidity Contract Code below = Here you paste in your full token source code that you have prepared in Step 1.

So it should look something like this:


Once you have filled in everything correctly then you just need to click Verify & publish. And if everything checks out correctly you will be greeted with the following:


Note we now have a green tick next to code! Congratulations, you have successfully verified your token's contract code on blockscout.

Okay I lied, you can't just do it for your own favourite blockchain explorer, that would be too easy! Remember everyone has their own favourite explorer, so it is best practice to cover all your bases & verify your token's contract on each one.


Step 4: Repeat the process on each blockchain explorer!

So for Ethereum Classic, I believe you only have Etherhub & Blockscout that currently allow you to verify your token's contract. The feature does not look like it works at the moment on Gastracker, though do let us know if you were able to verify there.

  • Gastracker - Does not seem to work currently just get's stuck in processing:


  • Etherhub - First search for your token contract, and then click Verify And Publish Source Code.


Here you will find a section very similar to what we have just done on Blockscout together, I am sure you can figure it out!


Once you click Validate Code it will let you know if you have done it correctly or note:


What about if my token was deployed on Ethereum?

Then your best bet is to start of with Etherscan they are the most used Ethereum blockchain explorer, then maybe ask your community for some other explorers they tend to use.

  • Etherscan - Again simply open your token's contract address and search for the code box. Once you are in the verify and publish section, make sure your Contract Address comes up correctly. And then well again it all looks familiar doesn't it?


Congratulations! You now know how to verify an Ethereum or Ethereum Classic token's contract code.

What Next?