Verifying Contracts Programmatically
Last updated
Last updated
If you'd like to verify contracts via our website, you may do so using the page.
Source code verification provides a way for projects to open source their smart contract code for end users to inspect and verify that it does what it claims to do.
By uploading source code, Arbiscan will match the compiled contract bytecode with that on the blockchain and display it under the tab.
For repeated or multiple verification of contracts, it may be more productive to programmatically verify your contracts through an .
The tools needed to follow along with this guide is , an API development application and a valid
Point your API request URL to https://api.arbiscan.io/api
and set your request method to POST.
If you'd like to deploy this to any other testnet, replace the request URL to your specific
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
.
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.
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.
Upon sending your request, you should receive a GUID ( 50 characters ) as your submission receipt.
Examples of Solidity flatteners that can be used are by or by
Parameter | Field | Description |
---|
The final body sample request using in Postman will resemble this.
You may check the status of your source code verification using the "" endpoint. The average processing time is between 30 - 60 seconds.
Upon successful verification , users will be able to interact with your contract on Arbiscan and it will be listed under the page.
contractaddress | Required | contract address, eg. |
codeformat | Required |
|
contractname | Required | contract name, eg |
compilerversion | Required | compiler version used, eg. |
optimizationUsed | Required | use |
runs | Optional | the no. of runs if optimization was used, eg. |
constructorArguements | Optional |
evmversion | Optional | leave blank for default compiler, specify if others such as |
licenseType | Optional | default value of |
libraryname | Optional | library used in contract, eg. supports up to 10 different libraries |
libraryaddress | Optional | library address eg. a matching pair of |
see Arbiscan's
for contracts that were created with constructor parameters, using .
an integer
between 1 - 14, see for all options