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

# zks_estimateGasL1ToL2 | zkSync Era

> The zks_estimateGasL1ToL2 API method estimates the gas required to execute a transaction from Layer 1 (Ethereum) to Layer 2 (zkSync).

The `zks_estimateGasL1ToL2` API method estimates the gas required to execute a transaction from Layer 1 (Ethereum) to Layer 2 (zkSync). This estimation is crucial for users and applications that optimize their transactions by accurately forecasting the gas needed for bridging assets or executing operations from L1 to L2 in the zkSync network.

## Parameters

The transaction request object for which the L1 to L2 gas estimation is made. It encapsulates details about the transaction, including:

* `from` — a string representing the Ethereum address from which the transaction is initiated.
* `to` — a string indicating the target address on zkSync Layer 2. This could be a wallet address or a smart contract within the zkSync ecosystem.
* `data` — (Optional) a string of the hashed method signature and encoded parameters intended for smart contract interactions. This aligns with the Ethereum Contract ABI, facilitating seamless operations across layers.

## Response

The response to the `zks_estimateGasL1ToL2` request provides the estimated gas requirement for the transaction, enabling precise budgeting for gas expenses:

* `result` — the estimated gas required for the transaction, represented as a hex string.

## Use case

A practical application of `zks_estimateGasL1ToL2` is for a DApp that bridges assets from Ethereum to zkSync, offering users lower transaction costs and faster processing. By estimating the required gas before initiating the bridge, the DApp ensures users have sufficient funds for the transaction, enhancing transparency and efficiency in cross-layer operations.


## OpenAPI

````yaml openapi/zksync_node_api/zks_estimateGasL1ToL2.json POST /afb8312f3710a5bc469f4c87cad3a2e4
openapi: 3.0.0
info:
  title: JSON-RPC API
  version: 1.0.0
servers:
  - url: https://nd-995-911-243.p2pify.com
security: []
paths:
  /afb8312f3710a5bc469f4c87cad3a2e4:
    post:
      summary: zks_estimateGasL1ToL2 | zkSync Era
      operationId: zks_estimateGasL1ToL2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JsonRpcRequestGasL1ToL2'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponseGasL1ToL2'
components:
  schemas:
    JsonRpcRequestGasL1ToL2:
      type: object
      required:
        - jsonrpc
        - id
        - method
        - params
      properties:
        jsonrpc:
          type: string
          example: '2.0'
          default: '2.0'
        id:
          type: integer
          example: 2
          default: 2
        method:
          type: string
          example: zks_estimateGasL1ToL2
          default: zks_estimateGasL1ToL2
        params:
          type: array
          default:
            - from: '0x7AeD074cA56F5050D5A2E512eCc5bf7103937d76'
              to: '0x6B7f71BB1f5B74fB0Ff82cf4EA20A5F90d43E509'
              data: 0x
          items:
            type: object
            properties:
              from:
                type: string
                example: '0x7AeD074cA56F5050D5A2E512eCc5bf7103937d76'
                default: '0x7AeD074cA56F5050D5A2E512eCc5bf7103937d76'
              to:
                type: string
                example: '0x6B7f71BB1f5B74fB0Ff82cf4EA20A5F90d43E509'
                default: '0x6B7f71BB1f5B74fB0Ff82cf4EA20A5F90d43E509'
              data:
                type: string
                example: 0x
                default: 0x
    JsonRpcResponseGasL1ToL2:
      type: object
      required:
        - jsonrpc
        - id
        - result
      properties:
        jsonrpc:
          type: string
          example: '2.0'
          default: '2.0'
        id:
          type: integer
          default: 2
        result:
          type: object
          additionalProperties: true

````