Skip to content

Latest commit

 

History

History
215 lines (195 loc) · 7.69 KB

2.2 Message Layout.md

File metadata and controls

215 lines (195 loc) · 7.69 KB
description image slug keywords
This section describes the message layout, its syntactical validation and additional metadata that may be stored by a node for a message.
/img/logo/Coordicide_Logo_Black.png
2.2MessageLayout
message
node
parent
strong
parent type

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.

Name Type Description
Version uint8 The message version. The schema specified in this specification is for version 1 only.
Parents count uint8 The amount of parents preceding the current message.
Parents type uint8 Bitwise 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
Name Type Description
Parent ByteArray[32] The Message ID of the parent Message.
Issuer public key (Ed25519) ByteArray[32] The public key of the node issuing the message.
Issuing timestamp time A value that shall represent the issuance time of the message.
Payload length uint32 The 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.
Payload
Generic Payload
An outline of a general payload
Name Type Description
Payload Type uint32 The 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 Fields ANY A sequence of fields, where the structure depends on Payload Type.
Nonce uint64 The 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).

2.2.6 Metadata

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.

Name Type Description
receivedTime time The local time the message was received by the node.
solid bool Denotes whether a message is solid, i.e., its past cone is known.
solidificationTime time The local time the message got solid.
branchID ByteArray[32] The branch ID of the message, i.e., the part of the Tangle where the message is located.
scheduled bool Denotes whether a message was scheduled by the scheduler.
booked bool Denotes whether a message was booked and therefore is part of the local Tangle.
eligible bool Denotes whether a message is eligible, i.e., it's timestamp is good.
invalid bool Denotes whether a message has been deemed invalid, i.e., it or its parents do not pass all checks from filters to message booker.
opinion Opinion Contains the node's opinion on the issuing timestamp of a message.

Table 2.2.2: Message Metadata.