1. Home
  2. bloXroute Documentation
  3. The BLXR Protocol
  4. Message Structure

Message Structure

Messages shared between Gateways and Relays must be in the BLXR message format. The BLXR message format uses little-endian packed binary data. All messages consist of a header and a payload. The linear structure of the message is shown, all numbers in parentheses represent bytes.

Message Structure
Header (20 bytes) Payload (variable length)

As shown below, the Header includes a starting sequence of bytes, message type, and payload length. The starting sequence is a fixed sequence of 4 bytes (‘0xFFFEFDFC’). The starting sequence assures the message processing logic that it is reading the beginning of a message from the input buffer, and if it is not, permits the processing logic to scroll the input buffer to the beginning of the next message in the case of an error. The message type is a 12 character string. The payload length is 4 bytes.

Starting Sequence (4) Message Type (12) Payload length (4)

Each Payload includes the payload data (which varies based on message type) followed by control flags. The payload data may include blockchain information, such as blocks or transactions. The payload data for each type is described in the Message Type Details below.

Payload Data (variable length) Control Flags (1)

The control flags are a single byte at the end of the payload. The control flag byte is a set of flags that contain additional information about the message, set by the sending peer. In its current implementation, there is only one flag in the control flags. Specifically, the value of the control flags will be 0x1 if the message is identified as valid by the sending peer.

Because transactions and blocks are not validated by BDN, there are potential attacks where an attacker could try to send the BDN a properly formatted message with a very large length. This could potentially create issues when a Relay attempts to receive the full message, load it to the memory, and broadcast to its peers. Accordingly the BDN defines maximum message sizes per blockchain.