Skip to Content
DocsCompilerCompiler

Compiler

The LODE compiler (lodec) transforms JSON source objects into Vein binary payloads using schema definitions. It operates both as a CLI tool and as a programmatic TypeScript API.

Pipeline

What the Compiler Does

  1. Schema validation — Loads and validates the .lode schema file (field IDs, types, names, duplicates)
  2. Required field checking — Ensures all required fields are present in the source object
  3. Type checking — Verifies source values match their declared types
  4. Binary encoding — Two-pass encoding: size calculation, then sequential write
  5. Fingerprint computation — Canonical SHA-256 of the source object

What the Compiler Does Not Do

  • No optimization — The binary format is fixed; there is no minification or compression pass
  • No code generation — LODE does not generate TypeScript interfaces or validation code from schemas
  • No linking — Schemas are standalone; there is no import or reference mechanism between schemas
  • No transformation — The compiler encodes; it does not map, filter, or reshape data

Installation

npm install @stacknet/lode

The lodec binary is available at node_modules/.bin/lodec or via npx lodec.

Last updated on