> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hedera.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Contract (Standard JSON)

> Submit a contract for verification via the [Solidity standard JSON input](https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description), [Vyper JSON input](https://docs.vyperlang.org/en/stable/compiling-a-contract.html#input-json-description), or Fe JSON input (a Sourcify-defined format — Fe has no official compiler JSON interface).

There are no "single file" or "multi-part" verification endpoints because those are essentially wrappers around the Solidity compiler's JSON interface. The verification frontend can provide files and settings options to resemble these.

You can optionally pass the `creationTransactionHash` to make Sourcify reliably fetching the creation bytecode. Otherwise, it will try to fetch it itself which is dependent on external services.

**Note**: The `outputSelection` field in the `stdJsonInput.settings` will be overridden during verification to ensure all necessary artifacts are generated.



## OpenAPI

````yaml /smart-contract-verification-api.yaml post /v2/verify/{chainId}/{address}
openapi: 3.1.0
info:
  version: 2.1.0
  title: Sourcify APIv2
  description: >-
    Welcome to the Sourcify's APIv2.


    Important differences between the deprecated legacy API and the new APIv2:

    - **Ticketing**: The verfication requests resolve into tickets/verification
    jobs. 
      - Previously the verification happened during the HTTP request, which resulted in timeouts if compilation took longer
    - **Standard JSON as default**: In the current design we take the standard
    JSON format as our main verification endpoint. Other methods such as
    "multi-file" or "single-file" should be handled by frontends or tooling to
    format into std-json. We still support verification with metadata at
    `/v2/verify/metadata`.

    - **Lean API**: We keep the number of endpoints minimal compared to v1. We
    won't have a session API. 

    - **Detailed contract response**: Prev. we only returned contract files of a
    contract. Now we can return details at `/contract/{chainId}/{address}`.


    By submitting source code for verification, you grant Sourcify (and the
    Argot Collective) a non-exclusive, worldwide, irrevocable, royalty-free
    licence to reproduce, store, and publicly display the submitted source code
    for the purposes of verification, archival, and public inspection.
  license:
    name: MIT
    url: https://github.com/argotorg/sourcify/blob/master/LICENSE
  contact:
    name: Sourcify
    url: https://sourcify.dev
    email: hello@sourcify.dev
servers:
  - url: https://sourcify.dev/server
    description: Production server
security: []
tags:
  - name: Contract Lookup
    description: API v2 - Tools and endpoints for looking up contract information
  - name: Verify Contracts
    description: API v2 - Submit a contract for verification
  - name: Verification Jobs
    description: API v2 - Check the status of a verification job
  - name: Other
    description: General server endpoints
paths:
  /v2/verify/{chainId}/{address}:
    post:
      tags:
        - Verify Contracts
      summary: Verify Contract (Standard JSON)
      description: >-
        Submit a contract for verification via the [Solidity standard JSON
        input](https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description),
        [Vyper JSON
        input](https://docs.vyperlang.org/en/stable/compiling-a-contract.html#input-json-description),
        or Fe JSON input (a Sourcify-defined format — Fe has no official
        compiler JSON interface).


        There are no "single file" or "multi-part" verification endpoints
        because those are essentially wrappers around the Solidity compiler's
        JSON interface. The verification frontend can provide files and settings
        options to resemble these.


        You can optionally pass the `creationTransactionHash` to make Sourcify
        reliably fetching the creation bytecode. Otherwise, it will try to fetch
        it itself which is dependent on external services.


        **Note**: The `outputSelection` field in the `stdJsonInput.settings`
        will be overridden during verification to ensure all necessary artifacts
        are generated.
      operationId: verify
      parameters:
        - name: chainId
          in: path
          description: The chainId number of the EVM chain
          required: true
          schema:
            type: string
            pattern: ^\d+$
            minLength: 1
            maxLength: 20
            example: '11155111'
        - name: address
          in: path
          description: >-
            Contract's 20 byte address in hex string with the 0x prefix. Case
            insensitive.
          required: true
          schema:
            type: string
            pattern: (\b0x[a-fA-F0-9]{40}\b)
            minLength: 42
            maxLength: 42
            example: '0x2738d13E81e30bC615766A0410e7cF199FD59A83'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                stdJsonInput:
                  type: object
                  description: >
                    Full [standard JSON
                    object](https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description)
                    to pass to the compiler. 


                    Must include the `language` field inside the stdJsonInput
                    object. Currently supports Solidity, Vyper, and Fe.
                compilerVersion:
                  type: string
                  title: CompilerVersion
                  pattern: ^v?\d+\.\d+\.\d+.*$
                  example: 0.8.7+commit.e28d00a7
                contractIdentifier:
                  type: string
                  description: >-
                    The fully qualified file path and contract name to indicate
                    which contract to verify, in the format
                    `path/to/file:ContractName`.
                  example: contracts/Storage.sol:Storage
                creationTransactionHash:
                  allOf:
                    - type: string
                      title: Keccak256
                      pattern: (\b0x[a-f0-9]{64}\b)
                      example: >-
                        0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206
                    - description: >-
                        The hash of the transaction that created this contract.
                        Optional.
              required:
                - stdJsonInput
                - compilerVersion
                - contractIdentifier
            examples:
              Solidity Contract:
                value:
                  stdJsonInput:
                    language: Solidity
                    sources:
                      contracts/Storage.sol:
                        content: |
                          // SPDX-License-Identifier: MIT
                          pragma solidity ^0.8.0;

                          contract Storage {
                              uint256 number;

                              function setNumber(uint256 newNumber) public {
                                  number = newNumber;
                              }

                              function getNumber() public view returns (uint256) {
                                  return number;
                              }
                          }
                    settings:
                      optimizer:
                        enabled: false
                        runs: 200
                  compilerVersion: 0.8.7+commit.e28d00a7
                  contractIdentifier: contracts/Storage.sol:Storage
                  creationTransactionHash: >-
                    0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206
              Vyper Contract:
                value:
                  stdJsonInput:
                    language: Vyper
                    sources:
                      MyVyperContract.vy:
                        content: |

                          number: public(uint256)

                          @external
                          def __init__():
                              self.number = 0

                          @external
                          def setNumber(newNumber: uint256):
                              self.number = newNumber

                          @view
                          @external
                          def getNumber() -> uint256:
                              return self.number
                    settings:
                      optimize: gas
                      evmVersion: cancun
                  compilerVersion: 0.3.10+commit.91361694
                  contractIdentifier: MyVyperContract.vy:MyVyperContract
                  creationTransactionHash: >-
                    0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206
              Vyper Contract with storage_layout_overrides:
                value:
                  stdJsonInput:
                    language: Vyper
                    sources:
                      test.vy:
                        content: |

                          a: public(uint256)
                          b: public(uint256)

                          @deploy
                          def __init__():
                              self.a = 1
                              self.b = 2
                    settings:
                      evmVersion: cancun
                    storage_layout_overrides:
                      test.vy:
                        a:
                          type: uint256
                          slot: 1
                          n_slots: 1
                        b:
                          type: uint256
                          slot: 0
                          n_slots: 1
                  compilerVersion: 0.4.1+commit.8a93dd27
                  contractIdentifier: test.vy:test
                  creationTransactionHash: >-
                    0xb6ee9d528b336942dd70d3b41e2811be10a473776352009fd73f85604f5ed206
              Yul Contract:
                value:
                  stdJsonInput:
                    language: Yul
                    sources:
                      cas-forwarder.yul:
                        content: |
                          // SPDX-License-Identifier: MIT
                          object "cas-forwarder" {
                              code {
                                  datacopy(0, dataoffset("runtime"), datasize("runtime"))
                                  return(0, datasize("runtime"))
                              }
                              object "runtime" {
                                  code {
                                      let targetAddress := shr(96, calldataload(0))
                                      let codeSize := extcodesize(targetAddress)
                                      extcodecopy(targetAddress, 0, 0, codeSize)

                                      let success := call(gas(), 0xcA11bde05977b3631167028862bE2a173976CA11, 0, 0, codeSize, 0, 0)

                                      let returnSize := returndatasize()
                                      returndatacopy(0, 0, returnSize)

                                      switch success
                                      case 0 {
                                          revert(0, returnSize)
                                      }
                                      default {
                                          return(0, returnSize)
                                      }
                                  }
                              }
                          }
                    settings:
                      optimizer:
                        details:
                          yul: true
                        enabled: true
                  compilerVersion: 0.8.26+commit.8a97fa7a
                  contractIdentifier: cas-forwarder.yul:cas-forwarder
              Fe Contract:
                value:
                  stdJsonInput:
                    language: Fe
                    sources:
                      src/lib.fe:
                        content: |
                          pub contract Counter {
                              mut count: u256

                              pub fn increment(mut self) {
                                  self.count += 1
                              }

                              pub fn get(self) -> u256 {
                                  return self.count
                              }
                          }
                  compilerVersion: 26.0.0-alpha.10
                  contractIdentifier: src/lib.fe:Counter
      responses:
        '202':
          description: >-
            Successfully submitted the verification. The server started to
            process the verification. 


            You can follow the verification status via the returned
            `verificationId` at `GET /v2/verify/{verificationId}`
          content:
            application/json:
              schema:
                type: object
                title: VerificationJob
                properties:
                  verificationId:
                    type: string
                    format: uuid
                required:
                  - verificationId
        '400':
          description: Bad request from the client
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
        '409':
          description: The contract is already verified
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: already_verified
                    message: >-
                      Contract 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 on
                      chain 31337 is already verified with runtimeMatch and
                      creationMatch both being exact matches.
                    errorId: 23aaf52e-168a-4cfa-8463-65ddfb792efc
        '429':
          description: You are sending too many requests to the server
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: too_many_requests
                    message: You are sending too many requests
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
        '500':
          description: ''
          content:
            application/json:
              schema:
                type: object
                title: GenericErrorResponse
                properties:
                  customCode:
                    type: string
                    description: A string token to indicate the reason of the error
                    example: unsupported_chain
                  message:
                    type: string
                    description: The reasoning of the error
                    example: >-
                      The chain with chainId 3153212 is not supported for
                      verification
                  errorId:
                    type: string
                    format: uuid
                required:
                  - customCode
                  - message
                  - errorId
                examples:
                  - customCode: unsupported_chain
                    message: The chain with chainId 9429413 is not supported
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192
              examples:
                Example 1:
                  value:
                    customCode: internal_error
                    message: Something went wrong
                    errorId: 1ac6b91a-0605-4459-93dc-18f210a70192

````