Protocol Definitions
Background
As we embark on building out the core of the protocol, it is necessary to have a shared understanding of the terminology and goals of the system. This is intended to be a high level document that we can reference and continually improve as we refine our understanding of what the protocol is.
Protocol Goals
The protocol governs the transmission of data between many different types of actors in XMTP. It defines the rules that clients, nodes, and smart contracts on external blockchains must follow. When designing the protocol, I propose we make decisions based on the following goals:
- Clients can reliably send/receive
messagesto/fromXMTP nodes - The
protocolwill reject messages that do not pass validation againstmessage acceptance criteria - The protocol will fairly allocate
network incentivestoXMTP nodeswho performincentivized actions - The protocol will accept valid
postage proofsforlimited network actions - The protocol will be resistant against
spam,DOSattacks, and malicious network actors - The protocol will ensure that any message asserting to be sent from a given
wallet addresswas sent from a client connected to that wallet. - The protocol will enforce that messages are encrypted and only readable by the holder of the private keys associated with a recipient wallet address.
Definition styleguide
- ✅ DO use lowercase unless
- it is at the beginning of a sentence
- it refers to a proper noun (e.g. XMTP)
- ✅ DO wrap terms contained within definitions with
inline code spans - ✅ DO link to other terms from within definitions
- e.g. This refers to
client
- e.g. This refers to
- 🛑 DO NOT wrap or link self-referential terms
- i.e. don't wrap or link any other instances a term from within its own definition
- 🛑 DO NOT wrap or link subsequent instances of a term within a definition beyond the first use
- except when the additional use of the term occurs in a subsequent bullet
Terms in use
application level
client
- Clients are software applications that interface with the
XMTP networkon behalf of theirusers. - A client MUST connect to one or more
nodesas a peer. Each client MUST be connected to awalletto be considered active on theXMTP network. A client MUST have akey bundleused for message encryption and authentication. A client is able to send and receive messages through the network, and MAY store those messages. - Clients MAY be capable of interacting with blockchain smart contracts to enable
limited network actionsby way of payingpostageor validating staked tokens.
conversation
- A conversation is an
application levelabstraction wheremessagessent between two or more parties appear to be displayed in a chat-like contiguous fashion.Clientsmay choose to display messages as conversations, or any other UX.
DOS
- A denial of service attack.
headers
- To be written
key bundle
- A key bundle is a set of private and public keys that are used to encrypt/decrypt messages from the
XMTP network. These keys are linked to a blockchainwallet addressthrough a validwallet signature.
limited network action
- A function executed by an
XMTP nodethat requires apostage proofbefore it is executed. For example, sending an introductorymessageto a new contact or an unsolicited invitation to a group chat.
message
- Messages are the atomic unit of XMTP. They are objects sent between
users, as defined by anwaku envelope, which contains axmtp envelope, containing apayload.
message contents
- Message contents are the encrypted
payloadencoded as a field in theXMTP envelope.XMTP nodescannot validate the contents of themessage, as they are encrypted. As such, message contents can be of any format and may be unreadable upon decryption. Message contents MUST conform to XIP-X (add in Martin's XIP here), and clients SHOULD reject messages that are non-compliant.
message storage
- Message storage referes to all types of facilities used to persist messages throughout their lifecycle. Due to the changing requirements for storage as the message progresses on its journey it seems prudent to distinguish at least pre-delivery and post-delivery storage.
network
- Unless otherwise specified, use of this term refers to the
xmtp network.
peer
- A catch-all term to describe any participant in the
XMTP network. BothclientsandXMTP nodesare peers.
payload
- To be written
pre-delivery storage
- Message delivery requires storage because the recipient may not be available at the time the message is sent. The message may also travel through multiple nodes to reach its destination, the network must make sure it doesn't get lost while in transit.
post-delivery storage
- Once a message reaches the recipient it needs to be stored to allow the user to see past and current conversations. At that point the message doesn't need to reach another party, just be available to the same one as long as desirable, albeit usually through multiple devices.
protocol
- The set of rules and standards that govern the interaction between
clients,XMTP nodes, and smart contracts on external blockchains.
session
- A session is an interactive information interchange between 2 or more
wallet addresses. Messaging sessions are created throughconnection requests.XMTP nodesMUST validate that a session has been constructed before relaying anymessages.
spam
- Unsolicited
messages
wallet address
- A unique identifier for a blockchain wallet held by a
user. Eachclientis associated with onewallet address. Wallet address ownership is validated through awallet signature.
wallet signature
- A cryptographic signature generated by the private keys associated with a given
wallet address.
XIP
- Short for "XMTP Improvement Proposal"
- An XIP is a design document providing information to the XMTP community, or describing a new feature for XTMP or its processes or environment.
XMTP
- Abbreviation for "Extensible Message Transport Protocol"
- When in use, it may also refer to:
XMTP network- The XMTP open-source project
- The
$XMTPnetwork token
XMTP envelope
- The XMTP envelope is stored in the
msgfield of thewaku envelope - A set of standard fields and
headersthat all validmessagesin theXMTP networkMUST contain. Invalid message envelopes MUST be rejected byXMTP nodesaccording tomessage acceptance criteria. Message envelope fields, other than thepayload, are unencrypted and can be read by nodes and be used in the acceptance decisions.
XMTP network
- To be written
XMTP node
An XMTP node is responsible for relaying, storing for a period of time, and serving
messages. It also managesnetworkstate and enforcesmessage acceptance criteria. XMTP nodes are capable of verifyingpostage proofsand executinglimited network actions. A XMTP node receivesnetwork incentivesin exchange for performing certainincentivized actions.XMTP's definition of a node differs from that of Waku, where clients are considered first-class citizens on the network. XMTP clients have less responsibilities than XMTP nodes, and as such XMTP clients do not receive
network incentives.
XRC
- An XMTP Request for Comment
- Includes
application-levelstandards and conventions, including messagepayloadformats and applications
user
- To be written
Waku envelope
- The Waku Envelope is the outermost container for a message. The
msgfield is where thexmtp-envelopeis stored
Terms in the works
connection request
- A connection request represents an intent to create a
messaging sessionbetween 2 or morewallet addresses. Connection requests are opted into by all involved parties and may happen off theXMTP networkusing a preconstructed code, or over the network which could requirepostage.
incentivized action
- A function executed by an
XMTP nodewhich makes the node eligible for anetwork incentive. For example, storing a message for a certain period of time. These functions may differ fromlimited network action.
message acceptance criteria
- A set of rules that govern whether a given
messageis to be forwarded to otherXMTP nodesandclients. - Some examples include:
- The message is well-formed with all required
headers - The message does not exceed any size limits enforced by the
XMTP network - The message is signed by the correct private key
- The private key used to sign the message was signed by a
wallet addressthat matches the sender address - If a
postage proofis required for this message, ensure that the proof is valid - If no
postage proofis included with the message, ensure that no proof is required
- The message is well-formed with all required
network incentive
- A network incentive is a payment denominated in the
XMTP tokengiven to aXMTP nodein exchange for performingincentivized actions.
postage
- Postage represents a transaction between a
clientand a smart contract in order to gain permission for the client to execute alimited network action. A valid request for postage, where the requester has paid or staked sufficient funds, MUST result in a confirmation being sent to the client, which MUST be used to construct apostage proof.
postage proof
- A postage proof is a string that proves a given
clienthas paid or stakedpostagefor a givenlimited network action. A postage proof MUST only be used once.
XMTP token
- To be written
Terms reservered
Definitions to be added later