# ECP-0012: MoQ object wire format + track mapping

Status: Draft

## Problem

We need a concrete, interoperable way to represent every.channel chunk objects over MoQ tracks so that publishers and subscribers can exchange data without relying on file relay conventions.

## Constraints

- Works over `moq-lite` tracks with group/frame semantics.
- Must carry both metadata (timing, encryption) and chunk bytes.
- Should be simple to parse and deterministic.

## Decision

- **Broadcast name**: the canonical stream id (e.g. `ec/stream/v1/...`).
- **Track name**: fixed `chunks` track for object payloads.
- **Group sequence**: use `chunk_index` (u64) as the group sequence.
- **Frame payload**: a single frame per group containing:
  - 4-byte big-endian length prefix for JSON metadata
  - JSON-encoded `ObjectMeta`
  - raw chunk bytes (ciphertext or plaintext)

This yields a deterministic, self-contained payload with minimal framing and easy debugging.

`ObjectMeta` may include optional integrity helpers:

- `chunk_hash` (blake3 of plaintext chunk bytes)
- `chunk_proof` (Merkle branch proving membership in an epoch manifest)

## Alternatives considered

- Separate meta/data frames: rejected due to ordering ambiguity and more framing.
- Binary codec (postcard/bincode): deferred until interop is proven.

## Rollout / teardown

- Implement encode/decode helpers in `ec-moq`.
- Update publisher to emit one frame per chunk group.
- Update subscriber to decode into `ObjectPayload`.
- If superseded, provide a compatibility adapter in `ec-moq`.
