Streaming
The authoritative wire contract for the chunk object and the streaming/window math is Protocol · The dig RPC.
Every byte-bearing method — dig.getContent, dig.getCapsule, dig.getManifest — returns the same chunk object. One call returns one chunk; the client continues until the chunk that completes the object.
The chunk object
| Field | Type | Meaning |
|---|---|---|
ciphertext | string | The chunk's bytes, standard base64. Decode before use. |
total_length | uint | The full object's byte length (before chunking). Constant across a stream — size your buffer once. |
offset | uint | Byte offset at which this chunk's bytes begin in the full object. |
length | uint | This chunk's byte length (= decoded ciphertext length). |
complete | bool | true when offset + length ≥ total_length — this chunk finishes the object. |
next_offset | uint or null | The offset to request next, or null when complete. |
inclusion_proof | string or null | Base64 merkle inclusion proof for the whole resource (present on every window of dig.getContent/dig.getManifest; empty/null for capsules). |
chunk_lens | uint[] | Per-chunk ciphertext byte lengths of the full resource, in order. First window only (offset == 0); empty ⇒ a single chunk. Required to split + decrypt a multi-chunk resource. |
root | string | The resolved generation root (hex). Pin subsequent chunks to it. |
There is no decoy field on the wire: a miss is the capsule's own indistinguishable, non-verifying response, discovered client-side by inclusion-proof and/or decryption failure (see the blind host model).
Alignment and bounds
A node snaps the requested window to fixed 64 KiB blocks (RANGE_BLOCK_BYTES = 65536) and caps a single chunk at 3 MiB (RPC_MAX_CHUNK = 3 × 1024 × 1024 = 3145728 bytes), keeping each response under the serving tier's response ceiling.
The requested offset is snapped down to a block boundary and the span is bounded; the returned offset reflects the snap. Because every non-final chunk is a whole number of 64 KiB blocks, a client that always requests the returned next_offset receives block-aligned, gap-free, non-overlapping chunks. length defaults to the node's max chunk when omitted; a larger request is clamped, not rejected.