zks_getL2ToL1MsgProof
Returns the proof for a message sent through the L1Messenger system contract, given a block, sender, message, and an optional message log index containing the L1 to L2 message.
Parameters
block
: (integer) [Required] Block where the message was emitted.sender
: (string) [Required] The sender (account) of the message.msg
: [Required] The keccak256 hash of the sent message.l2_log_position
: The index in the block of the event that was emitted by the L1Messenger when submitting this message. If it is omitted, the proof for the first message is returned.
Response
id
- The position of the leaf in the Merkle tree of L2 to L1 messages for the block.proof
- The Merkle proof for the message.root
- The root hash representing the Merkle tree root at the time the log was generated.
Example
Replace YOUR-API-KEY
with an API key from your Infura dashboard.
Request
- cURL
- WSS
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "zks_getL2ToL1MsgProof", "params": [5187, "0x87869cb87c4Fa78ca278dF358E890FF73B42a39E", "0x22de7debaa98758afdaee89f447ff43bab5da3de6acca7528b281cc2f1be2ee9"]}'
wscat -c wss://zksync-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "id": 1, "method": "zks_getL2ToL1MsgProof", "params": [5187, "0x87869cb87c4Fa78ca278dF358E890FF73B42a39E", "0x22de7debaa98758afdaee89f447ff43bab5da3de6acca7528b281cc2f1be2ee9"]}'
Response
- JSON
{
"jsonrpc": "2.0",
"result": "0x25f64db",
"id": 2
}