Skip to main content

Module contract

Module contract 

Source
Expand description

SPEC-087: the JSON authoring contract and its compilation to one CBCL dialect carrying the state clause (SPEC-019). A contract is data an agent writes; the dialect it compiles to is what every host installs, verifies, and folds. One implementation, so every host that authors from JSON gets the same dialect, and therefore the same self-address, for the same contract (SPEC-087 REQ-001, REQ-002).

compile_contract(<json>) → {"name": "f1220…", "label": …, "dialect": "(define f1220… …)"}

Recognition (CON-001) rejects a malformed record before anything is compiled; the compiled dialect is then installed through R1–R7 and any blame is returned verbatim. The name is dialect_hash over the body, so the contract’s name is a label and no part of identity.

Constants§

CONTRACT_VERSION
MAX_CONTRACT_BYTES

Functions§

compile_contract_str
Compile a JSON contract to its dialect: recognise, emit, name by self-address, install through R1–R7. Returns JSON {"name": …, "label": …, "dialect": …} or a reason.