---
description: "Verify smart contracts on Etherscan and Sourcify"
---

_Generated from `forge verify-contract --help`; see [CLI reference versions](/reference/versions). Regenerate this page instead of editing it directly._

## forge verify-contract

Verify smart contracts on Etherscan and Sourcify

:::terminal

```bash
$ forge verify-contract --help
```

```txt
Usage: forge verify-contract [OPTIONS] <ADDRESS> [CONTRACT]

Arguments:
  <ADDRESS>
          The address of the contract to verify

  [CONTRACT]
          The contract identifier in the form `<path>:<contractname>`

Options:
      --constructor-args <ARGS>
          The ABI-encoded constructor arguments. Only for Etherscan
          
          [alias: --encoded-constructor-args]

      --constructor-args-path <PATH>
          The path to a file containing the constructor arguments

      --guess-constructor-args
          Try to extract constructor arguments from on-chain creation code

      --creation-transaction-hash <CREATION_TRANSACTION_HASH>
          The hash of the transaction which created the contract. Optional for
          Sourcify

      --compiler-version <VERSION>
          The `solc` version to use to build the smart contract

      --compilation-profile <PROFILE_NAME>
          The compilation profile to use to build the smart contract

      --num-of-optimizations <NUM>
          The number of optimization runs used to build the smart contract
          
          [alias: --optimizer-runs]

      --flatten
          Flatten the source code before verifying

  -f, --force
          Do not compile the flattened smart contract before verifying (if
          --flatten is passed)

      --skip-is-verified-check
          Do not check if the contract is already verified before verifying

      --watch
          Wait for verification result after submission

      --root <PATH>
          The project's root path.
          
          By default root of the Git repository, if in one, or the current
          working directory.

      --show-standard-json-input
          Prints the standard json compiler input.
          
          The standard json compiler input can be used to manually submit
          contract verification in the browser.

      --via-ir
          Use the Yul intermediate representation compilation pipeline

      --evm-version <EVM_VERSION>
          The EVM version to use.
          
          Overrides the version specified in the config.

  -e, --etherscan-api-key <KEY>
          The Etherscan (or equivalent) API key
          
          [env: ETHERSCAN_API_KEY=]

  -c, --chain <CHAIN>
          The chain name or EIP-155 chain ID
          
          [env: CHAIN=]

  -h, --help
          Print help (see a summary with '-h')

  -j, --threads <THREADS>
          Number of threads to use. Specifying 0 defaults to the number of
          logical cores
          
          [alias: --jobs]

      --profile <PROFILE>
          The configuration profile to use

Linker options:
      --libraries <LIBRARIES>
          Set pre-linked libraries
          
          [env: DAPP_LIBRARIES=]

Verifier options:
      --license-type <LICENSE>
          The Etherscan license type code or SPDX identifier to include with the
          verification request.
          
          Accepts either an Etherscan numeric license code (see
          [https://etherscan.io/contract-license-types](https://etherscan.io/contract-license-types)) or a common SPDX
          identifier such as `MIT`, `Apache-2.0`, `GPL-3.0-or-later`, or
          `AGPL-3.0-or-later`. Only used for Etherscan-style verifiers.

      --verifier <VERIFIER>
          The contract verification provider to use

          Possible values:
          - etherscan
          - sourcify
          - blockscout
          - oklink
          - custom:     Custom verification provider, requires compatibility
            with the Etherscan API

      --verifier-api-key <VERIFIER_API_KEY>
          The verifier API KEY, if using a custom provider
          
          [env: VERIFIER_API_KEY=]

      --verifier-url <VERIFIER_URL>
          The verifier URL, if using a custom provider
          
          [env: VERIFIER_URL=]

Compiler options:
      --no-auto-detect
          Do not auto-detect the `solc` version

      --use <SOLC_VERSION>
          Specify the solc version, or a path to a local solc, to build with.
          
          Valid values are in the format `x.y.z`, `solc:x.y.z` or
          `path/to/solc`.

Rpc options:
  -r, --rpc-url <URL>
          The RPC endpoint
          
          [alias: --fork-url]

  -k, --insecure
          Allow insecure RPC connections (accept invalid HTTPS certificates).
          
          When the provider's inner runtime transport variant is HTTP, this
          configures the reqwest client to accept invalid certificates.

      --rpc-timeout <RPC_TIMEOUT>
          Timeout for the RPC request in seconds.
          
          The specified timeout will be used to override the default timeout for
          RPC requests.
          
          Default value: 45
          
          [env: ETH_RPC_TIMEOUT=]

      --no-proxy
          Disable automatic proxy detection.
          
          Use this in sandboxed environments (e.g., Cursor IDE sandbox, macOS
          App Sandbox) where system proxy detection causes crashes. When
          enabled, HTTP_PROXY/HTTPS_PROXY environment variables and system proxy
          settings will be ignored.

      --compute-units-per-second <CUPS>
          Sets the number of assumed available compute units per second for this
          provider.
          
          default value: 330
          
          See also
          [https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second](https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second)

      --no-rpc-rate-limit
          Disables rate limiting for this node's provider.
          
          See also
          [https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second](https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second)
          
          [alias: --no-rate-limit]

      --flashbots
          Use the Flashbots RPC URL with fast mode
          ([https://rpc.flashbots.net/fast](https://rpc.flashbots.net/fast)).
          
          This shares the transaction privately with all registered builders.
          
          See:
          [https://docs.flashbots.net/flashbots-protect/quick-start#faster-transactions](https://docs.flashbots.net/flashbots-protect/quick-start#faster-transactions)

      --jwt-secret <JWT_SECRET>
          JWT Secret for the RPC endpoint.
          
          The JWT secret will be used to create a JWT for an RPC. For example,
          the following can be used to simulate a CL `engine_forkchoiceUpdated`
          call:
          
          cast rpc --jwt-secret <JWT_SECRET> engine_forkchoiceUpdatedV2
          '["0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc",
          "0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc",
          "0x6bb38c26db65749ab6e472080a3d20a2f35776494e72016d1e339593f21c59bc"]'
          
          [env: ETH_RPC_JWT_SECRET=]

      --rpc-headers <RPC_HEADERS>
          Specify custom headers for RPC requests
          
          [env: ETH_RPC_HEADERS=]

      --curl
          Print the equivalent curl command instead of making the RPC request

      --retries <RETRIES>
          Number of attempts for retrying verification
          
          [default: 5]

      --delay <DELAY>
          Optional delay to apply in between verification attempts, in seconds
          
          [default: 5]

      --language <LANGUAGE>
          The contract language (`solidity` or `vyper`).
          
          Defaults to `solidity` if none provided.

          Possible values:
          - solidity: Solidity programming language
          - vyper:    Vyper programming language

Display options:
      --color <COLOR>
          The color of the log messages

          Possible values:
          - auto:   Intelligently guess whether to use color output (default)
          - always: Force color output
          - never:  Force disable color output

      --json
          Format log messages as JSON

      --md
          Format log messages as Markdown

  -q, --quiet
          Do not print log messages

  -v, --verbosity...
          Verbosity level of the log messages.
          
          Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv).
          
          Depending on the context the verbosity levels have different meanings.
          
          For example, the verbosity levels of the EVM are:
          - 2 (-vv): Print logs for all tests.
          - 3 (-vvv): Print execution traces for failing tests.
          - 4 (-vvvv): Print execution traces for all tests, and setup traces
          for failing tests.
          - 5 (-vvvvv): Print execution and setup traces for all tests,
          including storage changes and
            backtraces with line numbers.
```

:::