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
- Schema validation — Loads and validates the
.lodeschema file (field IDs, types, names, duplicates) - Required field checking — Ensures all required fields are present in the source object
- Type checking — Verifies source values match their declared types
- Binary encoding — Two-pass encoding: size calculation, then sequential write
- 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/lodeThe lodec binary is available at node_modules/.bin/lodec or via npx lodec.
Last updated on