rfc-2 · addressing

content addressing

version 0.1 · updated 2026-04-15 · status: published


§1

scope

This document defines how content is addressed in the Aevia protocol. Every canonical reference to bytes in the protocol MUST use a Content Identifier (CID) as specified here. Opaque URLs are NOT a canonical reference.

MUST, SHOULD, MAY follow RFC 2119.

§2

CID encoding

Aevia adopts CIDv1 as per Multiformats. For any object O, its CID is:

CID(O) = "b" || base32(codec || 0x12 || 0x20 || SHA-256(O))

where:

  • the "b" prefix identifies multibase base32 without padding per the Multibase spec;
  • codec is the multicodec varint identifying the byte type (see §3);
  • 0x12 is the multihash identifier for SHA-256;
  • 0x20 is the digest length in bytes (32);
  • SHA-256(O) is the SHA-256 digest of the object bytes.

Implementations MUST reject CIDs that do not start with "b" or that use a multihash other than SHA-256 under this RFC.

§3

assigned codecs

codecvalueuse
raw0x55opaque bytes — HLS segments, images, files
json0x0200manifests and structured JSON documents

Other codecs MAY be added via revision of this RFC. Implementations SHOULD preserve CIDs with unknown codecs at proxy routing, rejecting them only at the application layer.

§4

verification

Given a CID x and a byte sequence O, a verifier MUST:

  1. decode x extracting (codec, digest_algo, digest_len, digest);
  2. verify that digest_algo == 0x12 (SHA-256);
  3. verify that digest_len == 0x20;
  4. compute SHA-256(O);
  5. compare the 32 bytes of the digest; accept only if identical.

A mismatch at any step MUST result in rejecting the bytes. The client SHOULD try another peer, not re-request from the same peer with the same bytes.

§5

retrieval semantics

CID retrieval is location-independent. Any node may satisfy the request; the protocol does not privilege any origin. Clients SHOULD:

  • query FindProviders(cid) in the DHT to obtain the candidate peer set;
  • request the bytes in parallel from multiple candidates, accepting the first response that passes §4;
  • discard invalid responses with no retry against the same peer;
  • cache the (cid → bytes) mapping locally for at least the session duration.

Clients MAY use HTTP gateways as fallback when libp2p is unavailable. Gateways MUST return the exact bytes; clients MUST verify by CID even when fetching via gateway.

§6

security considerations

  • SHA-256 is considered secure for content addressing over the horizon of this RFC. Transitions to SHA-3 or BLAKE3 MUST be preceded by a new revision.
  • retrieval timing attack: returning “I don’t have this CID” may leak cache patterns. Provider nodes SHOULD respond in constant time to unknown CID requests.
  • malicious HTTP gateways may return wrong bytes; §4 guarantees clients are not fooled, but gateways MAY be used for traffic analysis. Clients SHOULD rotate gateways.
§7

references

  1. IETF RFC 2119 — Key words for RFCs
  2. Multiformats CID v1 Spec
  3. Multihash Specification
  4. Multicodec Table
  5. Multibase Specification
  6. RFC-1 — Manifest Schema