Skip to main content

API Documentation

Table of Contents and resources

Basic usage

Verification

The main Sourcify API for verification is /v2/verify/{chainId}/{address}, it either returns a verificationId or an error. The status of the verification process can be tracked by /v2/verify/${verificationId}. For additional details, please check the documentation below.

verification_result=$(
curl -sS -X POST \
'https://sourcify.dev/server/v2/verify/11155111/0x2738d13E81e30bC615766A0410e7cF199FD59A83' \
-H 'Content-Type: application/json' \
--data-raw '{"stdJsonInput":{"language":"Solidity","sources":{"contracts/Storage.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract Storage {\n uint256 number;\n\n function setNumber(uint256 newNumber) public {\n number = newNumber;\n }\n\n function getNumber() public view returns (uint256) {\n return number;\n }\n}\n"}},"settings":{"optimizer":{"enabled":false,"runs":200}}},"compilerVersion":"0.8.7+commit.e28d00a7","contractIdentifier":"contracts/Storage.sol:Storage","creationTransactionHash":"0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206"}'
)

verification_id=$(echo "$verification_result" | jq -r '.verificationId // empty')

if [ -n "$verification_id" ]; then
curl -sS \
"https://sourcify.dev/server/v2/verify/${verification_id}"
else
echo "$verification_result"
fi

Contract Lookup

Verified contracts data can be fetched using the /v2/contract/{chainId}/{address}?fields=all API. For the full list of fields and additional parameters please check the documentation below.

curl -sS \
'https://sourcify.dev/server/v2/contract/11155111/0x2738d13E81e30bC615766A0410e7cF199FD59A83?fields=all'

Server API Documentation

Loading Swagger UI...

4byte (Signature) Service API Documentation

Loading Swagger UI...