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.
Get your own node endpoint today
Start for free and elevate your app to production levels immediately. No credit card required.
Sign up with your GitHub, X, Google, or Microsoft account for immediate access.
Parameters
tx_hash
— abytes32
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.
Try the zks_getL2ToL1LogProof
RPC method yourself
zks_getL2ToL1LogProof
RPC method yourself