Skip to content

Deterministic CBOR v1 (FRNK) Specification ​

Status: Normative Encoding and Validation Standard
Implementations: @frank/codec (TypeScript), frank-cbor (Rust zero-copy parser)
Conformance Vectors: docs/protocol/cbor/vectors/


1. Framing Architecture ​

Every independently stored, signed, hashed, or forwarded Frank object is serialized as an exact binary frame:

OffsetSizeFieldDescription
04 bytesMagic BytesASCII FRNK (0x46 0x52 0x4e 0x4b)
41 byteFrame VersionProtocol frame version (0x01)
54 bytesBody LengthBig-endian uint32 payload length (bytes 9..N)
9NN bytesCBOR EnvelopeCanonical CBOR map { 0: type_id, 1: schema_version, 2: min_reader_version, 3: payload_bytes }

Worked example: a Type 17 text item {0: "hi"} (23 bytes total):

text
46 52 4e 4b            FRNK (magic)
01                     frame version 1
00 00 00 0e            CBOR body length 14
a4                     envelope map, 4 entries
  00 11                  0: type_id = 17 (text-message-item)
  01 01                  1: schema_version = 1
  02 01                  2: min_reader_version = 1
  03 45                  3: payload = 5-byte string
     a1 00 62 68 69        payload map {0: "hi"}

2. Canonical Encoding Constraints (Strict CBOR) ​

To ensure byte-for-byte deterministic hashing across all languages (TypeScript, Rust, Go, Python):

  1. Integer Map Keys: All protocol map keys MUST be unsigned integers (uint), serialized in strictly ascending numerical order without duplicates. Text or string keys are forbidden.
  2. Minimal Integer Representation: Integers MUST use the shortest possible CBOR encoding (0–23 inline, 24–255 as 1-byte, 256–65535 as 2-byte, etc.).
  3. No Indefinite-Length Items: Indefinite-length byte strings, text strings, arrays, or maps are strictly rejected.
  4. No Floating-Point Values: IEEE 754 float types are disallowed in protocol records to prevent architecture-dependent precision loss.
  5. Exact UTF-8 String Encoding: Text strings MUST be valid UTF-8, with no unassigned Unicode code points or invalid surrogate pairs.
  6. Zero Trailing Bytes: The CBOR payload must consume exactly the remaining bytes of the frame. Trailing data is a fatal deserialization error.

3. Type ID Allocation Registry ​

Type IDHexNameCDDL Schema RuleDescription
10x0001Direct Message Deliverydirect-message-deliveryOutermost DKSAP message container with payment stamps
20x0002Directory Attestationdirectory-attestationWraps and signs a Type 4 directory statement with ECDSA
30x0003Mailbox Checkpointmailbox-checkpointDurable journal facts and mailbox state checkpoint
40x0004Directory Statementdirectory-statementAccount-to-relay binding, public keys (P,M,P′P, M, P'), and revision
50x0005Recipient Encrypted Payloadrecipient-encrypted-payload-v2XChaCha20-Poly1305 ciphertext with DLEQ zero-knowledge proof
60x0006Encrypted Message Contentencrypted-message-contentInner decrypted container with logical message ID & payload
70x0007Key Transition Statementkey-transition-statementCryptographic authorization linking a retiring key to a new subject key
80x0008Message Content Revisionmessage-content-revisionOrdered array of semantic message items
90x0009Topic Post Contenttopic-postPublic forum post content with structured authored entries
100x000aTopic Post Submissiontopic-post-submissionInitial post creation paired with raw signed on-chain burn transaction (T7T_7)
110x000bTopic Vote Submissiontopic-vote-submissionUpvote on existing post paired with raw signed on-chain burn transaction (T7T_7)
120x000cForum Post Observationforum-single-viewSingle post observation paired with author address, raw signed burn tx, and vote weight
130x000dForum Topic Batch (forum-topic-page)forum-topic-pagePaginated batch of up to 128 post observation frames within a topic, with continuation cursor and relay epoch
140x000eForum Discovery Listing (forum-discovery-page)forum-discovery-pagePaginated directory of active topics, post counts, and last activity timestamps
150x000fForum Operation Statusforum-operation-statusRelay submission/confirmation status report for an on-chain burn transaction
160x0010Container Message Itemcontainer-message-itemOpaque nested child frame container for multi-item deliveries
170x0011UTF-8 Text Itemtext-message-itemPlaintext chat message text up to 256 KiB
180x0012Blackjack Message Itemblackjack item (closed shapes)Peer-to-peer blackjack hand and move items (closed payload shapes, up to 4 KiB)
190x0013Stealth Payment Itemstealth-message-itemSingle-use ephemeral DKSAP on-chain transfer notification
240x0018Universal State Channel Updatechannel-update-itemInstant off-chain multi-network state execution and interactive turns
250x0019Forwarding Delivery Envelopeforwarding-delivery-envelopeStore-and-forward relay hop delivery envelope with storage stamps (up to 32 MiB)
260x001aEmail Bridge Message Itememail-message-itemEmail carried through a gateway: parties, subject, bodies, references and attachments
270x001bGeneric Plugin Message Itemplugin-message-itemApplication item type identifier with the owning plugin's opaque bytes (up to 512 KiB)

NOTE

Database Pagination vs. Web Pages: In Types 13 and 14 (forum-topic-page and forum-discovery-page), the term "Page" refers strictly to cursor-based database query result sets (holding up to 128 verified post observations with continuation cursors), not HTML documents or rendered web pages.


4. Multi-Stage Validation Order ​

Implementations MUST process frames through twelve rigorous validation stages:

Frank & Cashweb High-Assurance Protocol Documentation