Verifying Contracts Programmatically
If you'd like to verify contracts via our website, you may do so using the Verify and Publish Source Code page.
By uploading source code, Etherscan will match the compiled contract bytecode with that on the blockchain and display it under the Contract tab.
The tools needed to follow along with this guide is Postman, an API development application and a valid SnowScan API Key. ****
1. Pointing API Endpoints
Point your API request URL to https://api.snowscan.xyz/api
and set your request method to POST.
If you'd like to deploy this to any other testnet such as Fuji, replace the request URL with https://api-testnet.snowscan.xyz/api
2. Setting API Keys & Module
Under the Request Body, set the format to x-www-form-urlencoded
.
Include your API key under the apikey
field, set the module to contract
, and action to verifysourcecode
.
3. Attaching Source Code
Paste your contract source code under the sourceCode
parameter.
If your contract uses "imports", you will need to concatenate the code into one file ( otherwise known as "flattening" ) as we do not support "imports" in separate files.
Examples of Solidity flatteners that can be used are solidity-flattener by @BlockCatIO or SolidityFlattery by @DaveAppleton
4. Configuring Source Code Parameters
Configure the details of your deployed contract such as contractname
, compilerversion
, optimizationUsed
and so on.
You have to specify the fields marked as required, and optional fields if applicable to your contract.
The final body sample request using Bulk Edit in Postman will resemble this.
5. Contract Verification Results
Upon sending your request, you should receive a GUID ( 50 characters ) as your submission receipt.
You may check the status of your source code verification using the "Check Source Code Verification Status" endpoint. The average processing time is between 30 - 60 seconds.
Last updated