API for contract verification
Base URL
https://{explorer endpoint}/api
Endpoints
Verify Contract
Etherscan style API for verifying contract source code.
POST /api
Request Parameters
Parameter | Type | Description |
---|---|---|
module | string | The API module. Must be set to "contract". |
action | string | The API action. Must be set to "verifysourcecode". |
contractaddress | string | The address of the contract to verify. |
sourceCode | string | The source code of the contract. |
codeformat | string | The format of the source code. Must be set to "solidity-standard-json-input". |
contractname | string | The name of the contract. |
compilerversion | string | The version of the Solidity compiler used to compile the contract. |
constructorArguements | string | The arguments passed to the contract constructor. |
Response Parameters
Parameter | Type | Description |
---|---|---|
message | string | A message indicating the result of the verification. |
result | string | The result of the verification. |
status | string | The status of the verification. "1" indicates success, "0" indicates failure. |
Example Request
POST /api HTTP/1.1
Host: localhost:3000
Content-Type: application/json
{
"module": "contract",
"action": "verifysourcecode",
"contractaddress": "0x1234567890123456789012345678901234567890",
"sourceCode": "contract MyContract { ... }",
"codeformat": "solidity-standard-json-input",
"contractname": "MyContract",
"compilerversion": "v0.8.0",
"constructorArguements": "arg1,arg2,arg3"
}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "OK",
"result": "Contract source code has been verified",
"status": "1"
}
Check Verification Status
Etherscan style API for checking the status of contract verification.
GET /api
Request Parameters
Parameter | Type | Description |
---|---|---|
module | string | The API module. Must be set to "contract". |
action | string | The API action. Must be set to "checkverifystatus". |
guid | string | The GUID of the verification request. |
Response Parameters
Parameter | Type | Description |
---|---|---|
message | string | A message indicating the result of the verification. |
result | string | The result of the verification. |
status | string | The status of the verification. "1" indicates success, "0" indicates failure. |
Example Request
GET /api?module=contract&action=checkverifystatus&guid=1234567890 HTTP/1.1
Host: localhost:3000
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "OK",
"result": "Contract source code has been verified",
"status": "1"
}