Submit your contract to explorer

This section guide you to submit (or verify) contract source code on blockchain explorer – u2uscan.xyz

Once verified, a smart contract or token contract's source code becomes publicly available and verifiable. This creates transparency and trust. Plus, it's easy to do!

There are two ways to verify source code:

In this tutorial we only focus on Hardhat.

Verify

In the last section, we have deployed Lock contract on Nebulas testnet:

Lock with 0.001U2U and unlock timestamp 1696615281 deployed to 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30

To verify the contract source code with Hardhat, below is the command:

npx hardhat verify --network NETWORK DEPLOYED_CONTRACT_ADDRESS [ARG_1 ARG_2 ...]
  • NETWORK: You need to provide which network you have used, eg. nebulas

  • DEPLOYED_CONTRACT_ADDRESS: Where the contract is deployed at, eg. 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30

  • [ARG_1 ARG_2 ...]: Arguments that passed to the contructor when the contract is deployed, eg. unlockTime

Let's verify it:

npx hardhat verify --network nebulas 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30 1696615281

It will result:

Successfully submitted source code for contract
contracts/Lock.sol:Lock at 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30
for verification on the block explorer. Waiting for verification result...

Successfully verified contract Lock on the block explorer.
https://testnet.u2uscan.xyz/address/0x8D51395C76C34d0e11178c1F7EE3219B4b958e30?tab=contract

Last updated