# 2.2 Message Layout

This section describes the Message Layout, its syntactical validation and additional metadata that may be stored by a node for a message.

## 2.2.1 Parameters​

• MAX_MESSAGE_SIZE The maximum allowed message size.
• MIN_STRONG_PARENTS The minimum amount of strong parents a message must reference.

### 2.2.1.1 Parameter Default Values​

The following values shall be set as the default for the above parameters on initiation of the node application:

• MAX_MESSAGE_SIZE = 64KB
• MIN_STRONG_PARENTS = 1

## 2.2.2 Message Structure​

The structure of a Tangle message is defined in Table 2.2-1 below.

NameTypeDescription
Versionuint8The message version. The schema specified in this specification is for version 1 only.
Parents countuint8The amount of parents preceding the current message.
Parents typeuint8Bitwise encoding of parent type matching the order of preceding parents starting at least significant bit. 1 indicates a strong parent, while 0 signals a weak parent. At least MIN_STRONG_PARENTS parent type must be strong.
Parents between(1,8)
Parents, ordered by hash ASC
NameTypeDescription
ParentByteArray[32]The Message ID of the parent Message.
Issuer public key (Ed25519)ByteArray[32]The public key of the node issuing the message.
Issuing timestamptimeA value that shall represent the issuance time of the message.
Payload lengthuint32The length of the Payload in bytes. Since its type may be unknown to the node, it must be declared in advance. 0 length means no payload will be attached.
An outline of a general payload
NameTypeDescription
Payload Typeuint32The type of the payload. It will instruct the node how to parse the fields that follow. Types in the range of 0-127 are "core types", that all nodes are expected to know.
Data FieldsANYA sequence of fields, where the structure depends on Payload Type.
Nonceuint64The nonce which lets this message fulfill the Rate Control requirement.
Signature (Ed25519)ByteArray[64]Signature of the issuing node's private key signing the BLAKE2b-256 hash of the entire message bytes.

Table 2.2.1: Message Structure.

## 2.2.3 Message ID​

BLAKE2b-256 hash of the byte contents of the message. It shall be used by the nodes to index the messages and by external APIs.

## 2.2.4 Syntactical Validation​

Messages that do not pass the Syntactical Validation shall be discarded. Only syntactically valid messages continue in the data flow, i.e., shall be allowed to pass to the Semantic Validation step.

A message is syntactically valid if:

1. The message length does not exceed MAX_MESSAGE_SIZE bytes.
2. When the message parsing is complete, there are not any trailing bytes left that were not parsed.
3. At least 1 and at most 8 distinct parents are given, ordered ASC and at least MIN_STRONG_PARENTS are strong parents.

## 2.2.5 Semantic Validation​

Messages that do not pass the Semantic Validation shall be discarded. Only semantically valid messages shall be allowed to continue in the data flow.

A message is semantically valid if:

1. The Message PoW Hash contains at least the number of leading 0 defined as required by the Rate Control module (see Section 4.5 - Rate Control.
2. The signature of the issuing node is valid.
3. It passes the parents age checks (see Section 4.2 - Timestamps).

In addition to a message itself, a node may store additional data that describes its local perception of a message which is not part of the Tangle ('Message metadata'). Where such metadata is defined, the metadata element names and types defined in Table 2.2-2 below shall be used.

NameTypeDescription