Overview

As a developer using ADAPT, you will spend a considerable amount of time crafting and debugging MUFL code. During this process, you will frequently encounter system logs that contain protocol messages. While it is not necessary to manually interact with the ADAPT messaging protocol on a regular basis, having a deep understanding of its structure and operation is valuable. Understanding the protocol’s components, the different types of messages, and their significance will help your debugging efforts.

The ADAPT messaging protocol is used for communication between nodes in the ADAPT network. Messages defined by the protocol can request data, invoke transactions, respond to requests, and more.

For example, an ADAPT packet in a web browser might, in response to a user clicking a Submit button, use the messaging protocol to initiate a message to an ADAPT packet in a different ADAPT node to process the submission.

Message Structure

Every message in the ADAPT messaging protocol follows this specific structure:

(
    $msg_type_id -> str,
    $protocol_version -> [int, int],
    $body_wrapper -> (
        $from -> global_id+,
        $to -> global_id+,
        $message_hash -> hash_code+,
        $ip_document -> identity_proof_document::type+,
        $body -> any
    )
)

This code serves as a general template, applicable to all messages. Specific messages add message-specific information in the form of a message sub-type.

The variation between messages primarily lies in the body_wrapper field. This field houses numerous nullable fields and a body field of type any, defined by each specific message. In addition, certain messages within the protocol make some body_wrapper fields non-nullable. For instance, a transaction request message (w2b_transaction) necessitates the presence of both from and to fields, as the sender and recipient packets are known. Conversely, when an ADAPT wrapper interacts with the backup storage component, the recipient container remains undefined because the recipient is not an ADAPT node.

For information about all messages defined by the protocol, refer to the message reference.