How to verify thirdweb prebuilt contracts

Learn how to verify your thirdweb contract on any EVM chain

Which block explorers does verification work with?

 

Currently, contract verification works with any Etherscan-built block explorer. As a general rule of thumb, if the site ends in “scan” then it is compatible with this form of contract verification.

Unsure if your block explorer was built by Etherscan?

Here is a full list of compatible explorers https://etherscan.io/eaas

Step 1: Create an account

Once you have reached the explorer that services your chain, you will need to create an account in order to register an apiKey

Notion image
 

Step 2: Create an API Key

In order to use the thirdweb SDK contract verifier, you will need to have an API Key for the specific block explorer you are wanting to verify on. On your account profile (or account dropdown tab) click the API Keys tab, from there, we will add a new apiKey.

Notion image
Notion image

Give your apiKey a name and click continue


Step 3: Explorer API Url

Once we have our API key, we need an endpoint to send the request to. On the left-hand side of the dashboard, click the API Service link. Note this will be different for each explorer, so make sure you use the link from the dashboard for your chain.

Notion image

In this example, we are using Cronoscan, but your URL should be similar, when in doubt, ensure the endpoint begins and ends with API as pictured below:

Notion image
 

Step 4: Setup our project

Once we have our explorer API Url and our API Key, we need to add those to our script below. In addition to this, we now need to declare our contract type (If you are unsure of your contract type you can visit our docs here for more details)

import { ThirdwebSDK } from "@thirdweb-dev/sdk";
import { CronosBeta } from "@thirdweb-dev/chains"

const sdk = new ThirdwebSDK(CronosBeta)
const explorerAPIUrl = "https://api.cronoscan.com/api"; // e.g. https://api.etherscan.io/api
const explorerAPIKey = "MY_API_KEY"; // Generate API key on the explorer

await sdk.verifier.verifyThirdwebContract(
  "DropERC721",
  // "DropERC1155",
  // "DropERC20",
  // "SignatureDrop",
  // "Marketplace",
  // "MarketplaceV3",
  // "Multiwrap",
  // "Pack",
  // "Split",
  // "TokenERC721",
  // "TokenERC1155",
  // "TokenERC20",
  // "VoteERC20",
  // "AirdropERC721",
  // "AirdropERC1155",
  // "AirdropERC20",
  // "NFTStake",
  // "EditionStake",
  // "TokenStake",
  explorerAPIUrl,
  explorerAPIKey,
);
 

Step 5: Verify the contract

Once completed run:

node verify.mjs

If successful, you will receive a similar response as pictured below

Notion image
 

 

Can’t get this working? If you’ve followed the above and are still having issues, contact our support team for help.

 
Did this answer your question?
😞
😐
🤩