> ## 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_getL2ToL1LogProof | zkSync Era

> Reference docs for the zks_getL2ToL1LogProof JSON-RPC method on the zkSync Era blockchain, available via Chainstack JSON-RPC nodes.

The `zks_getL2ToL1LogProof` API method facilitates the retrieval of proofs for logs generated from Layer 2 (L2) to Layer 1 (L1) transactions within the zkSync network. It's especially valuable for developers and applications that require verifiable cross-layer communication for operations like withdrawals or contract interactions.

## Parameters

* `tx_hash` — a `bytes32` hash of the L2 transaction within which the L2 to L1 log was produced. This hash uniquely identifies the transaction across the network.
* `l2_to_l1_log_index` — (optional) a numeric index specifying the position of the L2 to L1 log within the transaction. This optional parameter is used to pinpoint the exact log for which the proof is requested.

## Response

The response includes the proof for the specified L2 to L1 log, if available:

* `id` — the position of the log's leaf in the Merkle tree of L2 to L1 messages for the associated block, providing a unique identifier for the log within the tree.
* `proof` — an array of hexadecimal strings representing the Merkle proof for the log. This proof is essential for verifying the log's presence and integrity within the block's Merkle tree.
* `root` — the root hash of the Merkle tree of L2 to L1 messages for the block, serving as the cryptographic summary of all L2 to L1 logs within the block. The Merkle tree uses SHA-256, ensuring robust and secure hashing.

## Use case

The `zks_getL2ToL1LogProof` method can be used to verify the legitimacy of withdrawal transactions from Layer 2 (zkSync) to Layer 1 (Ethereum). By obtaining and validating the Merkle proofs for these transactions, they ensure that each withdrawal is accurately recorded and immutable, reinforcing regulatory compliance and enhancing trust among exchange users in the security of cross-layer transactions.


## OpenAPI

````yaml openapi/zksync_node_api/zks_getL2ToL1LogProof.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_getL2ToL1LogProof | zkSync Era
      operationId: zks_getL2ToL1LogProof
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JsonRpcRequestForL2ToL1LogProof'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponseForL2ToL1LogProof'
components:
  schemas:
    JsonRpcRequestForL2ToL1LogProof:
      type: object
      required:
        - jsonrpc
        - id
        - method
        - params
      properties:
        jsonrpc:
          type: string
          example: '2.0'
          default: '2.0'
        id:
          type: integer
          example: 1
          default: 1
        method:
          type: string
          example: zks_getL2ToL1LogProof
          default: zks_getL2ToL1LogProof
        params:
          type: array
          default:
            - '0xf8a7e5649718e84649a4caa93f5e537704a6a0e8769a7dbbe4de967ba14fc748'
          items:
            type: string
            example: '0xf8a7e5649718e84649a4caa93f5e537704a6a0e8769a7dbbe4de967ba14fc748'
            default: '0xf8a7e5649718e84649a4caa93f5e537704a6a0e8769a7dbbe4de967ba14fc748'
    JsonRpcResponseForL2ToL1LogProof:
      type: object
      required:
        - jsonrpc
        - id
        - result
      properties:
        jsonrpc:
          type: string
          example: '2.0'
          default: '2.0'
        id:
          type: integer
          default: 1
        result:
          type: object
          properties:
            logProof:
              type: object
              description: The log proof information.
              properties:
                blockNumber:
                  type: integer
                  description: The block number.
                logIndex:
                  type: integer
                  description: The log index within the block.
                transactionHash:
                  type: string
                  description: The transaction hash associated with the log.
                logEntries:
                  type: array
                  items:
                    type: string
                    description: Log entry data.

````