Skip to main content

Automatic verification on external verifiers

Whenever Sourcify finds a match, it automatically forwards the contract for verification to external verification services like Blockscout, Routescan, and Etherscan. In practice, this lets Sourcify act as a single verification entry point, so a contract gets verified across all supported explorers in one go.

Keep in mind Etherscan API has a strict 200 verifications/day per API key. This limit gets filled quickly and we can't share all verifications with Etherscan.

Sourcify can trigger external verification through any of its API endpoints, but tracking the verification's status is only supported by the v2 APIs. Now the verification job endpoint (/v2/verify/{verificationId}) returns the external status URL you can poll. The response also includes a direct link to the contract’s page on the relevant explorer

{
...,
externalVerifications: {
blockscout: {
verificationId: "x3ryqcqr1zdknhfhkimqmizlcqpxncqc6nrvp3pgrcpfsqedqi",
statusUrl: "https://api.etherscan.io/v2/api?chainid=1&module=contract&action=checkverifystatus&guid=x3ryqcqr1zdknhfhkimqmizlcqpxncqc6nrvp3pgrcpfsqedqi",
explorerUrl: "https://etherscan.io/address/0x0D41E0B7bbdEBDBc684020dcb64ADe76C0338222#code",
}
}
...
}

Via the Sourcify UI users can keep track of the external verifications' status live.

Enabling external verification in Sourcify Server

If you are maintaining a Sourcify server instance you can enable external verification by using the appropriate Storage services. The appropriate storage service must be configured for each external verifier.

// services/server/src/config/local.js
{
...
storage: {
...
writeOrWarn: [
...
WStorageIdentifiers.EtherscanVerify,
WStorageIdentifiers.BlockscoutVerify,
WStorageIdentifiers.RoutescanVerify,
...
],
...
},
...
}

Remember also to specify the API keys.

# services/server/.env
BLOCKSCOUT_API_KEY=
ROUTESCAN_API_KEY=
# warn: Etherscan have a very strict rate limit of 200 verifications / day.
ETHERSCAN_API_KEY=