Smart Contract Verification API

Overview

The Sourcify API enables programmatic access to smart contract verification services, allowing developers to verify contract source code, check verification status, and retrieve verified contract files. This decentralized verification service is essential for developers and auditors who need to ensure smart contract transparency and verify that deployed bytecode matches the provided source code across multiple blockchain networks.

Key Features

  • Contract Verification: Submit smart contract source code and metadata for verification against deployed bytecode on various blockchain networks.

  • Multiple Verification Methods: Support for direct file upload, Etherscan-verified contract import, and solc-json compilation artifact verification.

  • Verification Status Checking: Query the verification status of contracts by address and chain ID, with support for both full and partial matches.

  • File Retrieval: Access verified contract source code, metadata, and compilation artifacts for any verified contract.

  • Multi-Chain Support: Compatible with Ethereum mainnet, testnets, and other EVM-compatible networks including Hedera.

  • Repository Access: Browse and download verified contract files with organized file tree structures.

Base URL

https://server-verify.hashscan.io

Endpoints

Stateless Verification

Method
Endpoint
Description

POST

/verify

verify contracts by uploading source files and metadata

POST

/verify/etherscan

verify contracts already verified on etherscan

POST

/verify/solc-json

verify contracts using solc-json compilation artifacts

Repository Access

Method
Endpoint
Description

GET

/check-all-by-addresses

check verification status (full or partial match) for multiple contracts

GET

/check-by-addresses

check verification status (full match only) for multiple contracts

GET

/files/any/{chain}/{address}

retrieve all files for a contract (full and partial match)

GET

/files/{chain}/{address}

retrieve all files for a contract (full match only)

GET

/files/contracts/{chain}

get all verified contract addresses on a specific chain

GET

/files/tree/any/{chain}/{address}

get file tree structure (full and partial match)

GET

/files/tree/{chain}/{address}

get file tree structure (full match only)

GET

/repository/contracts/{match_type}/{chain}/{address}/{filePath}

download specific files from verified contracts

Session Management

Method
Endpoint
Description

GET

/session/data

retrieve current session verification data

POST

/session/clear

clear session data

POST

/session/input-files

add files to verification session

POST

/session/input-contract

import deployed contract from ipfs

POST

/session/verify-checked

verify contracts in current session

POST

/session/input-solc-json

add solc-json to session for verification

POST

/session/verify/etherscan

verify etherscan contracts in session

Administration

Method
Endpoint
Description

POST

/change-log-level

modify application logging level (requires authentication)

post

Sends provided files for verification

Body
addressstring · addressRequiredExample: 0x00000000219ab540356cBB839Cbe05303d7705Fa
chainstring · supported-chainIdRequiredExample: 1
filesobjectRequiredExample: {"metadata.json":"{...}","SimpleStorage.sol":"// file"}
creatorTxHashstringOptional
chosenContractstringOptional
Responses
200
The contract has been successfully checked or sourcified
application/json
post
POST /verify HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 179

{
  "address": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
  "chain": "1",
  "files": {
    "metadata.json": "{...}",
    "SimpleStorage.sol": "// file"
  },
  "creatorTxHash": "text",
  "chosenContract": "text"
}
{
  "result": [
    {
      "address": "0x123f681646d4a755815f9cb19e1acc8565a0c2ac",
      "chainId": "1",
      "status": "perfect",
      "libraryMap": {
        "lib1": "0x3f681646d4a755815f9cb19e1acc8565a0c2ac",
        "lib2": "0x4f681646d4a755815f9cb19e1acc8565a0c2ac"
      }
    }
  ]
}

Verify an Etherscan verified contract

post
Body
addressstring · addressRequiredExample: 0x07880D44b0f7b75464ad18fc2b980049c40A8bc3
chainIdstring · supported-chainIdRequiredExample: 1
apiKeystringOptionalExample: *********************************
Responses
200
The contract has been successfully checked or sourcified
application/json
post
POST /verify/etherscan HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 115

{
  "address": "0x07880D44b0f7b75464ad18fc2b980049c40A8bc3",
  "chainId": "1",
  "apiKey": "*********************************"
}
{
  "result": [
    {
      "address": "0x123f681646d4a755815f9cb19e1acc8565a0c2ac",
      "chainId": "1",
      "status": "perfect",
      "libraryMap": {
        "lib1": "0x3f681646d4a755815f9cb19e1acc8565a0c2ac",
        "lib2": "0x4f681646d4a755815f9cb19e1acc8565a0c2ac"
      }
    }
  ]
}

Verify solc-json

post
Body
addressstring · addressRequired

Contract address

Example: 0x07880D44b0f7b75464ad18fc2b980049c40A8bc3
chainstring · supported-chainIdRequired

Chain to check

Example: 1
compilerVersionstringRequired

Compiler version

Example: 0.8.4+commit.c7e474f2
contractNamestringRequired

Name of the contract

Example: Storage
creatorTxHashstringOptional

Creator transaction hash

Example: 0xb7efb33c736b1e8ea97e356467f99d99221343f077ce31a3e3ac1d2e0636df1d
Responses
200
The contract has been successfully checked or sourcified
application/json
post
POST /verify/solc-json HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 269

{
  "address": "0x07880D44b0f7b75464ad18fc2b980049c40A8bc3",
  "chain": "1",
  "files": {
    "value": {
      "SolcJsonInput.json": "{...}"
    }
  },
  "compilerVersion": "0.8.4+commit.c7e474f2",
  "contractName": "Storage",
  "creatorTxHash": "0xb7efb33c736b1e8ea97e356467f99d99221343f077ce31a3e3ac1d2e0636df1d"
}
{
  "result": [
    {
      "address": "0x123f681646d4a755815f9cb19e1acc8565a0c2ac",
      "chainId": "1",
      "status": "perfect",
      "libraryMap": {
        "lib1": "0x3f681646d4a755815f9cb19e1acc8565a0c2ac",
        "lib2": "0x4f681646d4a755815f9cb19e1acc8565a0c2ac"
      }
    }
  ]
}

Check if contracts are verified (full or partial match) by addresses and chain IDs

get

Checks if contract with the desired chain and address is verified and in the repository. It will search for both perfect and partial matches.

Query parameters
addressesstring · comma-separated-addressesRequired

Comma seperated string of addresses to check for.

chainIdsstring · comma-separated-sourcify-chainIdsRequired

Comma separated string of chain IDs.

Responses
200
OK. Also returns `200` with status `false` when not found
application/json
get
GET /check-all-by-addresses?addresses=text&chainIds=text HTTP/1.1
Host: 
Accept: */*
200

OK. Also returns 200 with status false when not found

[
  {
    "address": "0x6F1D75a53a8805DcA5347aE5F3eDE035CAE3CBC1",
    "chainIds": [
      {
        "chainId": "5",
        "status": "perfect"
      },
      {
        "chainId": "10",
        "status": "partial"
      },
      {
        "chainId": "11155111",
        "status": "perfect"
      }
    ]
  },
  {
    "address": "0x751D7C0Cf91a9b7704541b44E5fF7BeC3D2caA6F",
    "chainIds": [
      {
        "chainId": "5",
        "status": "partial"
      },
      {
        "chainId": "10",
        "status": "perfect"
      }
    ]
  },
  {
    "address": "0x8D2548A5f641b00Cf0f5B693d4A72D8c0aE24d31",
    "chainIds": [
      {
        "chainId": "5",
        "status": "perfect"
      }
    ]
  },
  {
    "address": "0x1f9cA631AE0C4890F99b38634C969b7E4f8719F0",
    "status": "false"
  }
]

Check if contracts are verified (full match) by addresses and chain IDs

get

Checks if contract with the desired chain and address is verified and in the repository. It will search only the perfect matches.

Query parameters
addressesstring · comma-separated-addressesRequired

The addresses of the contracts.

chainIdsstring · comma-separated-sourcify-chainIdsRequired

The IDs of the chains.

Responses
200
OK
application/json
get
GET /check-by-addresses?addresses=text&chainIds=text HTTP/1.1
Host: 
Accept: */*
200

OK

[
  {
    "address": "0xEb30853fc616Bbb8f1444451A3c202cbcd08Fb47",
    "status": "perfect",
    "chainIds": [
      "43114",
      "137"
    ]
  }
]

Get all files of a contract (full and partial match)

get

Returns all files for the desired contract with the address and chain. Searches both full and partial matches.

Path parameters
chainstring · sourcify-chainIdRequired
addressstring · addressRequired
Responses
200
Contract is available
application/json
get
GET /files/any/{chain}/{address} HTTP/1.1
Host: 
Accept: */*
{
  "status": "full",
  "files": [
    {
      "name": "metadata.json",
      "path": "/home/data/repository/contracts/full_match/3/0x0000A906D248Cc99FB8CB296C8Ad8C6Df05431c9/metadata.json",
      "content": "text"
    }
  ]
}

Get all files of a contract (full match)

get

Returns all files for the desired contract with the address and chain. Searches only for full matches.

Path parameters
chainstring · sourcify-chainIdRequired
addressstring · addressRequired
Responses
200
Contract is available in the repository
application/json
get
GET /files/{chain}/{address} HTTP/1.1
Host: 
Accept: */*
[
  {
    "name": "metadata.json",
    "path": "/home/data/repository/contracts/full_match/3/0x0000A906D248Cc99FB8CB296C8Ad8C6Df05431c9/metadata.json",
    "content": "text"
  }
]

Get a specific file from the repository with the file path (static serving)

get

Retrieve statically served files over the server.

Path parameters
Match type `full_match` or `partial_match`string · match-typeRequired
chainstring · sourcify-chainIdRequired
addressstring · addressRequired
filePathstringRequired
Responses
200
The file is found at the path
text/plain
get
GET /repository/contracts/{full_match | partial_match}/{chain}/{address}/{filePath} HTTP/1.1
Host: 
Accept: */*

No content

Get all contract addresses verified on a chain (full or partial match)

get

Returns all verified contracts from the repository for the desired chain. Searches for full and partial matches.

Path parameters
chainstring · sourcify-chainIdRequired
Responses
200
Chain is available as a full match or partial match in the repository
application/json
get
GET /files/contracts/{chain} HTTP/1.1
Host: 
Accept: */*
{
  "full": [
    "0x1fE5d745beABA808AAdF52057Dd7AAA47b42cFD0",
    "0xE9c31091868d68598Ac881738D159A63532d12f9"
  ],
  "partial": [
    "0x0000A906D248Cc99FB8CB296C8Ad8C6Df05431c9",
    "0xE9c31091868d68598Ac881738D159A63532d12f9"
  ]
}

Get file tree (full and partial match)

get

Returns repository URLs for every file in the source tree for the desired chain and address. Searches for full and partial matches.

Path parameters
chainstring · sourcify-chainIdRequired
addressstring · addressRequired
Responses
200
Contract is available
application/json
get
GET /files/tree/any/{chain}/{address} HTTP/1.1
Host: 
Accept: */*
{
  "status": "full",
  "files": [
    "https://contractrepostaging.komputing.org/contracts/full_match/5/0x32a5d2240a60dcF7Af8EfAE6d886ec8BeD5f71bA/metadata.json"
  ]
}

Get file tree (full match)

get

Returns repository URLs for every file in the source tree for the desired chain and address. Searches only for full matches.

Path parameters
chainstring · sourcify-chainIdRequired
addressstring · addressRequired
Responses
200
Contract is available
application/json
Responsestring[]Example: ["https://repo.sourcify.dev/contracts/full_match/5/0x1fE5d745beABA808AAdF52057Dd7AAA47b42cFD0/metadata.json"]
get
GET /files/tree/{chain}/{address} HTTP/1.1
Host: 
Accept: */*
[
  "https://repo.sourcify.dev/contracts/full_match/5/0x1fE5d745beABA808AAdF52057Dd7AAA47b42cFD0/metadata.json"
]

Get session data

get
Responses
200
OK
application/json
get
GET /session/data HTTP/1.1
Host: 
Accept: */*
200

OK

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

Clear session data

post
Responses
200
OK
text/plain
ResponsestringExample: Session successfully cleared
post
POST /session/clear HTTP/1.1
Host: 
Accept: */*
Session successfully cleared

Add input files

post
Query parameters
urlstring · uriOptional

Remote file URL

dryrunbooleanOptional

Dry-run flag. When present and set to true, a successful verification result will not be stored in the repository.

Default: false
Body
filesobjectOptional
Responses
200
Response is sent when the upload is successful under different conditions.
application/json
post
POST /session/input-files HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 12

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

Import deployed contract trying to fetch metadata and files form IPFS

post
Body
addressstring · addressRequired
chainIdstring · supported-chainIdRequired
Responses
200
Response is sent when the upload is successful under different conditions.
application/json
post
POST /session/input-contract HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 35

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

Verify checked contract in session

post
Query parameters
dryrunbooleanOptional

Dry-run flag. When present and set to true, a successful verification result will not be stored in the repository.

Default: false
Body
Responses
200
OK
application/json
post
POST /session/verify-checked HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 197

{
  "contracts": [
    {
      "address": "0x656d0062eC89c940213E3F3170EA8b2add1c0143",
      "chainId": "100",
      "creatorTxHash": "text",
      "verificationId": "0x3f67e9f57515bb1e7195c7c5af1eff630091567c0bb65ba3dece57a56da766fe"
    }
  ]
}
{
  "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": [
          "text"
        ]
      },
      "status": "perfect",
      "storageTimestamp": "2021-01-12T15:41:56.502Z"
    }
  ],
  "unused": [
    "text"
  ]
}

Verify solc-json

post
Body
compilerVersionstringRequired

Compiler version

Responses
200
OK
application/json
post
POST /session/input-solc-json HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 69

{
  "files": {
    "ANY_ADDITIONAL_PROPERTY": "text"
  },
  "compilerVersion": "text"
}
{
  "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": [
          "text"
        ]
      },
      "status": "perfect",
      "storageTimestamp": "2021-01-12T15:41:56.502Z"
    }
  ],
  "unused": [
    "text"
  ]
}

Verify from Etherscan

post
Body
addressstring · addressRequired
chainIdstring · supported-chainIdRequired
apiKeystringOptionalExample: *********************************
Responses
200
OK
application/json
post
POST /session/verify/etherscan HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 80

{
  "address": "text",
  "chainId": "text",
  "apiKey": "*********************************"
}
{
  "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": [
          "text"
        ]
      },
      "status": "perfect",
      "storageTimestamp": "2021-01-12T15:41:56.502Z"
    }
  ],
  "unused": [
    "text"
  ]
}

Change the logging level of the application

post

Allows changing the logging level dynamically at runtime for the application. Requires Basic Authentication.

Authorizations
Body
levelstring · enumRequired

The new logging level to set.

Possible values:
Responses
200
The logging level was successfully changed.
text/plain
ResponsestringExample: Logging level changed to: debug
post
POST /change-log-level HTTP/1.1
Host: 
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "level": "debug"
}
Logging level changed to: debug

Last updated

Was this helpful?