Skip to content
TAO$188.27
BTC0.002928
MCap$2.22B
Vol$86.25M

API reference / EVM

Submit an EVM contract for verification

POST/api/v2/evm/contracts/{address}/verify
Status
Beta
Auth
Account access token or OAuth access token or API key
Scope
data:read
Rate limit
contract_verification

Verify a deployed contract's source on Bittensor EVM (chain 964) from its Solidity standard-JSON input, through bittensor.ai's Sourcify.

Full description

Verify a deployed contract's source on Bittensor EVM (chain 964) from its Solidity standard-JSON input, through bittensor.ai's Sourcify. The body is {std_json_input, compiler_version, contract_identifier, creation_transaction_hash?} (compiler_version one of GET /evm/compiler-versions).

- 200 already_verified: the contract already has an exact match; nothing is submitted and no quota is used. match and verified_at describe the existing verification. - 202 pending: submitted. Poll GET /evm/verifications/{verification_id} every few seconds until status is verified_exact, verified_partial or failed. - 200 failed: the verification service refused the submission outright (e.g. duplicate_verification_request: one is already running for this contract). See error_code.

Auth: a user's credential carrying data:read: the user's own API key, the user's signed-in session on bittensor.ai (with its CSRF token pair: the csrftoken cookie and a matching X-CSRFToken header), or an OAuth access token the user granted to an application. An OAuth access token must also carry account:write: the user's consent for the application to submit verifications on the user's behalf (each counts against the account's daily allowance). A credential that does not belong to a user (an application's key on its own) is refused with 403 INSUFFICIENT_PERMISSIONS, as is a token without account:write. The per-address rate and the account's daily allowance are shared with every other way of submitting a verification, including the Etherscan-compatible /etherscan/api. Never cached (no-store). Not

Errors are application/problem+json: INVALID_ADDRESS (400, the path is not 0x + 40 hex), a 400 naming the body member that is wrong (UNKNOWN_PARAMETER for a member the body does not define, INVALID_PARAMETER otherwise, VALIDATION_ERROR for several), CSRF_FAILED (403, a session request without a valid CSRF token pair), PAYLOAD_TOO_LARGE (413, over 5 MB), RATE_LIMITED (429, too many submissions from this IP; Retry-After), CONTRACT_VERIFICATION_QUOTA_EXCEEDED (429, 20 submissions per account per rolling 24 h; Retry-After says when one frees), CONTRACT_VERIFICATION_BUSY (503, too many verifications in flight; retry in seconds), CONTRACT_VERIFICATION_UNAVAILABLE (503, the verification service failed; nothing is charged), CONTRACT_VERIFICATION_DISABLED (503, contract verification is off on this deployment).

Beta: this route may change with one release's notice in the v2 changelog; additive changes need none (x-stability: beta).

Path parameters

addresspath, required· string · up to 64 characters

The deployed contract's address: 0x + 40 hex characters, any case.

Request body

A JSON object with these fields:

std_json_inputobject

The solc standard-JSON input the contract was compiled from, as a JSON object (not a string): language (Solidity), sources (path -> {content}) and settings (optimizer, evmVersion, viaIR, remappings, ...), exactly as given to the compiler. Foundry: forge verify-contract --show-standard-json-input; Hardhat: the build-info file's input. The whole request body is limited to 5 MB.

compiler_versionstring

The solc long version the contract was compiled with, e.g. 0.8.17+commit.8df45f5f (one of GET /evm/compiler-versions).

Pattern: ^\d+\.\d+\.\d+\+commit\.[0-9a-f]{8}$
contract_identifierstring

The fully qualified name of the contract to verify, path:Name, where path is a key of std_json_input.sources, e.g. src/Token.sol:Token.

Pattern: ^[^:]+(:[^:]+)*:[A-Za-z_$][A-Za-z0-9_$]*$
creation_transaction_hashstring · can be null

The hash of the EVM transaction that created the contract (0x + 64 hex). Optional: it lets the verifier check the creation bytecode too (looked up from the index when absent). A wrong hash fails the verification.

Format: 32-byte hex: 0x and 64 hex digits

Response

data is an object with these fields. Amounts are integer strings in their base unit, and null means unknown, never zero (see Units and formats). meta.at names the block the answer was read at.

The verification job.

verification_idstring · can be null

The id to poll with GET /evm/verifications/{verification_id} (a UUID). Only the submitting account can read it. Null when nothing was submitted (already_verified) or the verification service refused the submission outright (failed straight away).

statusstring

already_verified: the contract already has an exact match, so nothing was submitted (no quota used). pending: submitted; poll until it changes. verified_exact / verified_partial: verified (exact match: byte for byte, metadata hash included; partial: all but the metadata hash). failed: see error_code. A finished state never changes. New values may be added; show an unknown value as is (or generically).

addressstring

The contract's address, 0x H160, lower case.

Format: EVM address: 0x and 40 hex digits
chain_idinteger · unit id

The EVM chain the verification is for: 964 (Bittensor EVM mainnet).

contract_identifierstring

The submitted path:Name, e.g. src/Token.sol:Token.

compiler_versionstring

The submitted solc version, e.g. 0.8.17+commit.8df45f5f.

error_codestring · can be null

Why it failed, as a stable code. Null unless status is failed. Codes: no_match (the recompiled bytecode differs from the deployed one), bytecode_length_mismatch (it differs in length: usually other compiler settings, e.g. optimizer runs, viaIR or EVM version), creation_bytecode_mismatch (the creation code or given creation transaction does not match), contract_not_deployed (no contract at the address), onchain_bytecode_unavailable (the chain's bytecode could not be read; retry), compilation_failed (the input does not compile; error_detail has the compiler's errors), compilation_resource_limit (the compiler timed out or ran out of memory), compiled_bytecode_empty (the named contract compiles to no code: abstract contract or interface), invalid_compiler_version, contract_not_found (contract_identifier is not in the compiler output), missing_sources, unsupported_language, invalid_request, already_verified (another verification made it verified meanwhile), duplicate_verification_request (a verification of this contract is already running; retry when it has finished), verification_interrupted (the verification service lost the job; resubmit), and verification_failed for anything else. The vocabulary is open: treat an unknown code as verification_failed.

error_detailstring · can be null

The verification service's own message for the failure (plain text, at most 4000 characters, may include compiler errors). For display; match on error_code, never on this. Null unless failed.

matchenum · can be null

The overall match once verified (or the existing one when already_verified). exact_match: the recompiled bytecode matches byte for byte, metadata hash included, so the sources are exactly the ones deployed. match: it matches except for the metadata hash (a partial match: same code, but comments or file layout may differ), and can later be upgraded to exact_match. Sourcify's own words. Null until verified.

One of: exact_match, match
creation_matchenum · can be null

The creation bytecode's match. Null until verified, or when it could not be checked.

One of: exact_match, match
runtime_matchenum · can be null

The runtime bytecode's match. Null until verified.

One of: exact_match, match
verified_atstring (date-time) · can be null

When the verification was recorded (RFC 3339 UTC). Null until verified.

Format: date and time, ISO 8601 in UTC
submitted_atstring (date-time) · can be null

When this account submitted it (RFC 3339 UTC). Null for already_verified (nothing submitted).

Format: date and time, ISO 8601 in UTC
completed_atstring (date-time) · can be null

When the verification finished, verified or failed (RFC 3339 UTC). Null while pending.

Format: date and time, ISO 8601 in UTC

Response headers

6 headers: Cache-Control, RateLimit-Policy, RateLimit, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
Cache-Control

One of three classes: settled public, max-age=3600, stale-while-revalidate=86400 (pinned to a block that cannot move), slow public, max-age=300, stale-while-revalidate=600 (state that moves in minutes or days) or tip public, max-age=6, stale-while-revalidate=12 (follows the chain head); the label routes are cached until the next nightly copy (public, max-age=<seconds>, stale-while-revalidate=60). Never immutable. no-store on an earlier answer served because the data source failed (X-BTAI-Stale).

RateLimit-Policy

The tier's request quota of the current window (IETF draft), e.g. "tier";q=600.

RateLimit

Requests left in the current window and the seconds until it resets (IETF draft), e.g. "tier";r=597;t=42.

X-RateLimit-Limit

The tier's request quota of the current window.

X-RateLimit-Remaining

Requests left in the current window.

X-RateLimit-Reset

When the current window resets, Unix seconds.

Status codes

200 · 202 · 400 · 401 · 402 · 403 · 404 · 413 · 429 · 500 · 502 · 503

Error codes

The codes this endpoint can return. Each links to what it means and what to do.

From the API's published specification, version 1.165.0.