# Contracts: Architecture

The on-chain system, in layers:

- **Storage** — component bytes stored via SSTORE2 (`SourceStore`/`ChunkedStore`): pay gas once to write, render
  free forever.
- **Registry** — `ComponentRegistry` maps a hash → its bytes (content-addressed). `AppRegistry`,
  `CompositionRegistry` track apps, mini-apps, and fork lineage.
- **Interpreter / Router** — `RenderRouter` + `OpcodeInterpreterV3Html` walk the byte tree and emit HTML/SVG; a
  `view` call, deterministic, fail-closed.
- **Resolvers** — the data/media library, each a small `view` contract.
- **Enforcer** — `TrustGrade` + `ActionVocab`: grades and refuses, on-chain, drift-locked with the SDK.
- **Theming** — `ThemeTokens` + `ThemeCssView` generate CSS from tokens; `PresentationContext` applies theme at
  render time.
- **Registries (governance-free)** — `SubnameStakeRegistrar` (names), `SubnameVersionRegistry` (versions),
  `ThemeSetRegistry` (themes), `AdvisoryRegistry`/`AttesterRegistry` (advisories/attestations).

Every contract is **ownerless and immutable** — no admin, no upgrade key. Verify once, rely forever.
