Skip to main content

Verify from Etherscan

  • The received address and chainId are used server side to call Etherscan API fetching the sources
  • If possible, runs the process of verification, as described in Verify.
note

Session-based API is only meant for the sourcify.dev UI. Because it makes use of session cookies and it is not possible have Access-Control-Allow-Origin: * with credentials: true, meaning these endpoints can only be used on explicitly set domains on the browser. (e.g. sourcify.dev). Please use the verification API if you want Sourcify on your frontend.

URL : /session/verify/etherscan

Method : POST

The body should provide:

  • address (the address of a verified contract on Etherscan)
  • chain
caution

/session/verify/etherscan triggers a server side request to Etherscan API, this could cause reaching the Etherscan API Limit Rate.

Responses

Assumptions for all example responses (except the last one) :

  • There is one pending contract with all source files, but no address or chainId.
  • Supplying the following minimum object (extra properties would be ignored):
{
"contracts": [
{
"address": "0x656d0062eC89c940213E3F3170EA8b2add1c0143",
"chainId": "100",
"compilerVersion": "0.6.6+commit.6c089d02",
"verificationId": "0x3f67e9f57515bb1e7195c7c5af1eff630091567c0bb65ba3dece57a56da766fe"
}
]
}

Condition : The provided contract perfectly matches the one at the provided chainId and address.

Code : 200 OK

Content :

{
"contracts": [
{
"verificationId": "0x3f67e9f57515bb1e7195c7c5af1eff630091567c0bb65ba3dece57a56da766fe",
"compiledPath": "browser/1_Storage.sol",
"name": "Storage",
"compilerVersion": "0.6.6+commit.6c089d02",
"address": "0x656d0062eC89c940213E3F3170EA8b2add1c0143",
"chainId": "100",
"files": {
"found": ["browser/1_Storage.sol"],
"missing": []
},
"status": "perfect"
}
],
"unused": []
}

Condition : The contract at the provided chainId and address has already been verified at 2021-01-12T15:41:56.502Z.

Code : 200 OK

Content :

{
"contracts": [
{
"verificationId": "0x3f67e9f57515bb1e7195c7c5af1eff630091567c0bb65ba3dece57a56da766fe",
"compiledPath": "browser/1_Storage.sol",
"name": "Storage",
"compilerVersion": "0.6.6+commit.6c089d02",
"address": "0x656d0062eC89c940213E3F3170EA8b2add1c0143",
"chainId": "100",
"files": {
"found": ["browser/1_Storage.sol"],
"missing": []
},
"status": "perfect",
"storageTimestamp": "2021-01-12T15:41:56.502Z"
}
],
"unused": []
}

Condition : Etherscan API Limit reached

Code : 400 Bad Request

Content :

{
"error": "Etherscan API rate limit reached, try later"
}

Condition : Contract not verified on Etherscan

Code : 400 Bad Request

Content :

{
"error": "This contract is not verified on Etherscan"
}