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

# Estimate a contract deployment

> Estimate the network fee for deploying a smart contract on a specified blockchain, given the contract bytecode.



## OpenAPI

````yaml openapi/smart-contract-platform.yaml post /v1/w3s/contracts/deploy/estimateFee
openapi: 3.0.3
info:
  description: This is the Circle Contracts API documentation.
  title: Circle Contracts
  version: '1.0'
servers:
  - url: https://api.circle.com
security:
  - BearerAuth: []
tags:
  - name: Templates
  - name: View / Update
  - name: Interact
  - name: Deploy / Import
  - name: Event Monitors
paths:
  /v1/w3s/contracts/deploy/estimateFee:
    post:
      tags:
        - Deploy / Import
      summary: Estimate a contract deployment
      description: >-
        Estimate the network fee for deploying a smart contract on a specified
        blockchain, given the contract bytecode.
      operationId: estimateContractDeploy
      parameters:
        - $ref: '#/components/parameters/XRequestId'
      requestBody:
        $ref: '#/components/requestBodies/ContractDeploymentEstimateFee'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeeEstimation'
          description: Estimate is successful.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error response for the request.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
      security:
        - BearerAuth: []
components:
  parameters:
    XRequestId:
      name: X-Request-Id
      in: header
      description: >
        Developer-provided identifier for this request, used for tracing
        requests in Wallets API logs and the Developer Console, and when
        communicating with Circle Support.

        **Must be a UUID to appear in logs.** Non-UUID values are accepted by
        the API but are ignored by logging and tracing systems.
      schema:
        $ref: '#/components/schemas/XRequestId'
  requestBodies:
    ContractDeploymentEstimateFee:
      content:
        application/json:
          schema:
            title: ContractDeploymentEstimateFeeRequest
            type: object
            required:
              - bytecode
            properties:
              abiJson:
                $ref: '#/components/schemas/AbiJson'
              blockchain:
                $ref: '#/components/schemas/Blockchain'
              bytecode:
                $ref: '#/components/schemas/Bytecode'
              constructorSignature:
                $ref: '#/components/schemas/ConstructorSignature'
              constructorParameters:
                $ref: '#/components/schemas/ConstructorParameters'
              sourceAddress:
                $ref: '#/components/schemas/SourceAddress'
              walletId:
                $ref: '#/components/schemas/WalletId'
          examples:
            Wallet ID:
              value:
                walletId: 004735f6-d9fc-44f8-933c-672cdf3d240d
                bytecode: 0x60806040523480156200001157600080fd5b50604051806040...
                constructorSignature: constructor(string, uint256)
                constructorParameters:
                  - TICK
                  - 10000
            Source Address:
              value:
                sourceAddress: '0x1bf9ad0cc2ad298c69a2995aa806ee832788218c'
                blockchain: MATIC-AMOY
                bytecode: 0x60806040523480156200001157600080fd5b50604051806040...
                constructorSignature: constructor(string ticker, uint256 totalSupply)
                constructorParameters:
                  - TICK
                  - 10000
      description: Estimate a transaction fee for deploying a smart contract
      required: true
  schemas:
    FeeEstimation:
      title: FeeEstimationResponse
      type: object
      required:
        - data
      properties:
        data:
          type: object
          properties:
            high:
              $ref: '#/components/schemas/TransactionFee'
            low:
              $ref: '#/components/schemas/TransactionFee'
            medium:
              $ref: '#/components/schemas/TransactionFee'
    Error:
      title: Error
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: Code that corresponds to the error.
        message:
          type: string
          description: Message that describes the error.
    XRequestId:
      type: string
      format: uuid
      description: >-
        A unique identifier, which can be helpful for identifying a request when
        communicating with Circle support.
      example: 2adba88e-9d63-44bc-b975-9b6ae3440dde
    AbiJson:
      type: string
      description: The contract's ABI in a JSON stringified format.
      example: >-
        [{"inputs": [],"stateMutability": "nonpayable","type":
        "constructor"},...
    Blockchain:
      type: string
      description: >
        The blockchain network that the resource is to be created on or is
        currently on. 

        Required along with `sourceAddress` if you don't provide `walletId`. The
        `blockchain` and `walletId` fields are mutually exclusive.
      enum:
        - ETH
        - ETH-SEPOLIA
        - MATIC
        - MATIC-AMOY
        - ARB
        - ARB-SEPOLIA
        - UNI
        - UNI-SEPOLIA
        - BASE
        - BASE-SEPOLIA
        - OP
        - OP-SEPOLIA
        - AVAX
        - AVAX-FUJI
        - ARC-TESTNET
        - MONAD
        - MONAD-TESTNET
      example: MATIC-AMOY
    Bytecode:
      type: string
      description: Bytecode of the contract being deployed.
      minLength: 1
      writeOnly: true
      example: 0x60806040523480156200001157600080fd5b50604051806040...
    ConstructorSignature:
      title: ConstructorSignature
      type: string
      description: >-
        Signature of the constructor if the contract has one. constructor() by
        default.
      maxLength: 1000
      minLength: 1
      example: constructor(string ticker, uint256 totalSupply)
    ConstructorParameters:
      title: ConstructorParameters
      type: array
      description: >-
        A list of arguments to pass to the contract's constructor function. Must
        be an empty array if there are no constructor parameters.
      items:
        $ref: '#/components/schemas/AnyValue'
      example:
        - TICK
        - 10000
    SourceAddress:
      type: string
      description: >
        Source address of the transaction. Required along with `blockchain` if
        `walletId` is not provided. 

        The `sourceAddress` and `walletId` fields are mutually exclusive.
      example: '0x1bf9ad0cc2ad298c69a2995aa806ee832788218c'
    WalletId:
      title: WalletId
      type: string
      format: uuid
      description: |
        Unique system generated identifier of the wallet.
        For contract deploys this wallet ID will be used as the source.
      example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
    TransactionFee:
      type: object
      properties:
        gasLimit:
          $ref: '#/components/schemas/GasLimit'
        gasPrice:
          $ref: '#/components/schemas/GasPrice'
        maxFee:
          $ref: '#/components/schemas/MaxFee'
        priorityFee:
          $ref: '#/components/schemas/PriorityFee'
        baseFee:
          $ref: '#/components/schemas/BaseFee'
        networkFee:
          $ref: '#/components/schemas/NetworkFee'
        networkFeeRaw:
          $ref: '#/components/schemas/NetworkFeeRaw'
        l1Fee:
          $ref: '#/components/schemas/L1Fee'
    AnyValue:
      description: Can be any value - string, number, boolean, array or object.
    GasLimit:
      type: string
      description: >
        The maximum units of gas to use for the transaction. Required if
        `feeLevel` is not provided.

        Estimates for this limit can be obtained through the [`POST
        /transactions/transfer/estimateFee`](/api-reference/w3s/developer-controlled-wallets/create-transfer-estimate-fee)
        API.

        An insufficient gas limit may cause the transaction to fail on-chain.
        Use this field with care when manually providing values.

        GasLimit override (only supported for EOA wallets): Using `gasLimit`
        together with `feeLevel`, the provided `gasLimit` will override the
        estimation's gasLimit.
      example: '21000'
    GasPrice:
      type: string
      description: >
        For blockchains without EIP-1559 support, the maximum price of gas, in
        gwei, to use per each unit of gas (see `gasLimit`). Requires `gasLimit`.
        Cannot be used with `feeLevel`, `priorityFee`, or `maxFee`.

        Estimates for this fee can be obtained through the [`POST
        /transactions/transfer/estimateFee`](/api-reference/w3s/developer-controlled-wallets/create-transfer-estimate-fee)
        API.

        The wallet service enforces a dynamic minimum `gasPrice` based on
        current network conditions. Requests specifying a `gasPrice` below this
        minimum will be rejected
    MaxFee:
      type: string
      example: '5.935224468'
      description: >
        For blockchains with EIP-1559 support, the maximum price per unit of gas
        (see `gasLimit`), in gwei. Requires `priorityFee`, and `gasLimit` to be
        present. Cannot be used with `feeLevel` or `gasPrice`.

        Estimates for this fee can be obtained through the [`POST
        /transactions/transfer/estimateFee`](/api-reference/w3s/developer-controlled-wallets/create-transfer-estimate-fee)
        API.
    PriorityFee:
      type: string
      example: '1.022783914'
      description: >
        For blockchains with EIP-1559 support, the “tip”, in gwei, to add to the
        base fee as an incentive for validators.

        Please note that the `maxFee` and `gasLimit` parameters are required
        alongside the `priorityFee`. The `feeLevel` and `gasPrice` parameters
        cannot be used with the `priorityFee`. 

        Estimations for this fee can be obtained through the [`POST
        /transactions/transfer/estimateFee`](/api-reference/w3s/developer-controlled-wallets/create-transfer-estimate-fee)
        API.

        The wallet service enforces a dynamic minimum `priorityFee` based on
        current network conditions. Requests specifying a `priorityFee` below
        this minimum will be rejected
    BaseFee:
      type: string
      example: '1.022783914'
      description: >
        For blockchains with EIP-1559 support, the estimated base fee represents
        the minimum fee required for a transaction to be included in a block on
        the blockchain. 

        It is measured in gwei and compensates for the computational resources
        validators consume to process the transaction. 

        The base fee is supplemented by a separate "tip" called the priority
        fee, which acts as an extra incentive for validators to prioritize the
        transaction. 

        The priority fee is added to the base fee to calculate the final
        transaction fee.
    NetworkFee:
      type: string
      example: '0.0001246397138'
      description: >
        The estimated network fee is the maximum amount of cryptocurrency (such
        as ETH, ARB, or SOL) that you will pay for your transaction. This fee
        depends on the parameters you set, including Gas Limit, Priority Fee,
        and Max Fee.

        It compensates for the computational resources that validators consume
        to process the transaction. It is measured in native token such as ETH,
        SOL.

        For blockchains with L1 data fees such as OP/BASE, the network fee is a
        combination of the Execution Gas Fee and the L1 Data Fee.

        Each blockchain might use different formula for network fee. Refer to
        each specific blockchain's documentation to understand how `networkFee`
        is calculated.
    NetworkFeeRaw:
      type: string
      example: '0.0001246397138'
      description: >
        Similar to `networkFee`, `networkFeeRaw` is an estimation with lower
        buffer and thus should be closer to the actual on-chain expense. 

        This field will only be returned in the estimation response.
    L1Fee:
      type: string
      example: '0.000000000000140021'
      description: >
        This fee represents the Layer 1 (L1) rollup charge associated with
        transactions on Layer 2 blockchains. The amount is expressed in the
        native currency, such as ETH. This field is relevant for Layer 2
        blockchains utilizing a rollup mechanism and for specific account types,
        such as externally owned accounts (EOAs) on the Optimism (OP)
        blockchain.
  headers:
    XRequestId:
      description: >
        Developer-provided header parameter or Circle-generated universally
        unique identifier (UUID v4). Useful for identifying a specific request
        when communicating with Circle Support.
      schema:
        $ref: '#/components/schemas/XRequestId'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: PREFIX:ID:SECRET
      description: >-
        Circle's API Keys are formatted in the following structure
        "PREFIX:ID:SECRET". All three parts are required to make a successful
        request.

````