Skip to main content
Version: Endpoint V2

Message Packet

Because cross-chain messaging allows for a variety of operations, such as transferring data and assets or performing external calls, the LayerZero protocol requires a generic data type for passing raw data from one chain to another.

The Message Packet standardizes the format and size of messages that are sent between different blockchains:

struct Packet {
uint64 nonce; // the nonce of the message in the pathway
uint32 srcEid; // the source endpoint ID
address sender; // the sender address
uint32 dstEid; // the destination endpoint ID
bytes32 receiver; // the receiving address
bytes32 guid; // a global unique identifier
bytes message; // the message payload
}

This standardized packet structure is compatible with different blockchains that utilize different underlying execution environments (e.g., EVM vs non-EVM).

Packet Structure

  • Ordering and Routing Checks: The packet includes several fields that help ensure the security of cross-chain communication:

    • nonce: Prevents replay attacks and censorship by defining a strong gapless ordering between all nonces in each channel.

    • guid: Acts as a globally unique identifier to track the message across chains and systems.

    • srcEid and dstEid: Identifiers for the source and destination chains that prevent message misrouting.

  • Traceability: The inclusion of a nonce, source and destination information, and a unique identifier (guid) makes it possible to track the message through its journey across chains. This is important for debugging, auditing, and for building trust in the system.

  • Payload Integrity: The message field carries the actual information or command that needs to be communicated to the destination chain. The configured Security Stack ensures that the message has not been altered during transit by ensuring multiple DVNs comparing multiple payload hashes against one another.