BRC-231 Peer to peer

Binary Encoding for the Message Relay Interface

An alternative wire format for the BRC-33 message relay interface: the same requests and responses as DAG-CBOR instead of JSON, with the message body and identity keys as byte strings.

Open Protocol Labs (info@opl.dev) Authors: David Case (dcase@opl.dev)

How it connects

Relationships

Authoritative content mirror

Full upstream text

View source ↗
Rendered from peer-to-peer/0231.md at the indexed upstream commit

Abstract

An alternative wire format for the BRC-33 message relay interface: the same requests and responses as DAG-CBOR instead of JSON, with the message body and identity keys as byte strings.

Motivation

Text encoding makes binary data larger, and the growth compounds when a text-encoded payload itself carries binary encoded as text.

Specification

The endpoints, authentication and semantics are those of BRC-33. A request with Content-Type: application/cbor is answered in CBOR; a JSON request is answered in JSON. Each JSON object becomes a DAG-CBOR map with the same keys.

Endpoint Request Response
POST /sendMessage { message: { recipient: bstr(33), messageBox: tstr, body: bstr } } { status: tstr, messageId: tstr }
POST /listMessages { messageBox: tstr } { status: tstr, messages: [ { messageId: tstr, body: bstr, sender: bstr(33) } ] }
POST /acknowledgeMessage { messageIds: [ tstr ] } { status: tstr }

recipient and sender are 33-byte compressed identity keys. body is opaque bytes, delivered as submitted.

References