Message passing
zkBridge enables secure and efficient cross-chain message passing between different blockchain networks, leveraging zero-knowledge proof (ZKP) technology and a set of APIs designed to facilitate interoperable communication. This document provides an overview of the cross-chain message passing process using zkBridge. You can try out our cross-chain messaging function on zkBridge.
Overview
To pass messages across different chains, zkBridge uses the SendAPI and ReceiveAPI interfaces, along with the block header relay network. These components ensure secure and efficient cross-chain communication.
Cross-Chain Message Passing Process
The following steps outline the process of passing messages across chains using zkBridge:
1. Prepare the message payload
On the sender chain, prepare the message payload, which typically contains information such as the destination address, destination chain, and any other custom data that needs to be transmitted.
2. Send the message using zkBridge entrypoint
Utilize the zkBridge entrypoint interface to send the message to the destination chain. Call the send
function, providing the necessary parameters such as the destination chain ID, destination address, and message payload.
3. Generate and verify zkProof
The block header relay network generates a zkProof for the sender chain's block header, which is then verified by the updater contract on the receiver chain. This process ensures the integrity and security of the cross-chain communication.
4. Receive and process the message using zkBridge receiver API
On the destination chain, use the zkBridge receiver interface to receive and process the message. Call thezkReceive
function, providing the source chain ID, source block hash, and zkProof. These functions return the decoded payload, allowing you to process the cross-chain message according to your application's requirements.
Last updated