Loading schema…
A machine-readable model of BitTorrent in JSON-LD, in the manner of Bitcoin Schema: structures, their bencode keys and value types, derivations, and validity rules. One schema; many projections: a codec with no per-field code, this page, the diagram, the tests.
Seven modules from the bytes up to the index that finds a torrent, with what flows between them. The boxes are generated from the schema; each is a link to its module. Only the shaded box is data at rest: everything else is messages about it.
Three structs, and that is all of BitTorrent's data at rest. Everything a swarm must agree on is the info dictionary, hashed once; trackers, peers and Nostr events carry that one hash and nothing else that is authoritative, which is why the forty-one other structs are messages, not data. The metainfo structures as a UML class diagram — generated from the schema, so it never drifts. Filled diamonds are composition; /name entries are derived (computed, not stored); ? marks optional fields.
Loading schema…