Layer 2 · Capsule format — the DIGS data section
Canonical reference:
digstore-core::datasection(BINDING contract D1, the single source of truth). The module that carries this blob is described in The self-defending module.
The DIGS blob byte layout
All multi-byte integers are BIG-ENDIAN (datasection.rs:9-18):
magic "DIGS" (4 bytes)
version u8 = 1 (1 byte)
count u32 BE (4 bytes)
rows count × 10 bytes: id:u16 BE | offset:u32 BE | len:u32 BE (offset/len relative to byte 0)
bodies concatenated section bodies
total_len = max(offset+len) — self-describing, no terminator. HEADER_LEN = 9, ROW_LEN = 10. DataView::parse validates the magic, version == 1, and that every row lies within raw (datasection.rs:127-181).
All multi-byte integers are big-endian, matching Chia's streamable framing so the capsule shares one codec with the rest of the Chia-side wire formats.
SectionIds
SectionId is a u16 (datasection.rs:60-75). The compiler emits sections in ascending id order, and pushes ChainState (12) before Filler (11) so Filler stays the trailing / highest-offset body (data_section.rs:92-124).
| id | Section | Body |
|---|---|---|
| 1 | StoreId | 32 raw bytes |
| 2 | CurrentRoot | 32 raw bytes (the per-resource merkle root, D5) |
| 3 | RootHistory | Vec<Bytes32> = u32 BE count + raw 32B each |
| 4 | PublicKey | 48 raw bytes (BLS G1) |
| 5 | TrustedKeys | u32 BE count, per entry [u8;48] pubkey + String label (u32 BE len + utf8) |
| 6 | Metadata | MetadataManifest (plaintext) |
| 7 | AuthInfo | AuthenticationInfo { requires_session, requires_jwt, jwks_url, accepted_algorithms } |
| 8 | KeyTable (D3) | see below |
| 9 | ChunkPool (D4) | see below |
| 10 | MerkleNodes (D5) | u32 BE count + count×32 raw — the per-resource leaves, ascending by static_key |
| 11 | Filler | unreferenced ChaCha20 padding (self-defending module) |
| 12 | ChainState | on-chain anchor pointer (see below) |