curl --request POST \
--url https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "zks_getL2ToL1LogProof",
"params": [
"0xf8a7e5649718e84649a4caa93f5e537704a6a0e8769a7dbbe4de967ba14fc748"
]
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"logProof": {
"blockNumber": 123,
"logIndex": 123,
"transactionHash": "<string>",
"logEntries": [
"<string>"
]
}
}
}
curl --request POST \
--url https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "zks_getL2ToL1LogProof",
"params": [
"0xf8a7e5649718e84649a4caa93f5e537704a6a0e8769a7dbbe4de967ba14fc748"
]
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"logProof": {
"blockNumber": 123,
"logIndex": 123,
"transactionHash": "<string>",
"logEntries": [
"<string>"
]
}
}
}
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.
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.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.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.Successful response
The response is of type object
.