Skip to main content
b01t provides four functions for serializing and deserializing ExactProgram values. The format is exact-oracle-v1 — a JSON schema that captures the full program structure including certification level, register layout, and every op. On deserialization, b01t re-validates the structural invariants, so a corrupted or tampered file is rejected rather than silently accepted.

exact_program_to_json

Serializes an ExactProgram to a deterministic JSON string. Keys are sorted alphabetically and the output is indented with two spaces, making the format suitable for version control.
prog
ExactProgram
required
The exact program to serialize. Obtain one from .build_exact() on a @coherent or @primitive function.
Returns: a UTF-8 JSON string in exact-oracle-v1 format.

exact_program_from_json

Deserializes an ExactProgram from a JSON string. Validates the format version, then re-checks all structural invariants before returning.
s
str
required
A JSON string previously produced by exact_program_to_json.
Returns: a fully validated ExactProgram. Raises: DSLValidationError if the format version is not exact-oracle-v1, or if any structural invariant is violated.

exact_program_to_dict

Serializes an ExactProgram to a plain Python dict. Use this when you want to embed the program in a larger data structure (such as a registry entry) without converting to a string first.
prog
ExactProgram
required
The exact program to serialize.
Returns: a dict with the same structure as the JSON schema below.

exact_program_from_dict

Deserializes an ExactProgram from a plain Python dict. Validates the format version and structural invariants.
d
dict
required
A dict previously produced by exact_program_to_dict, or parsed from a JSON file in exact-oracle-v1 format.
Returns: a fully validated ExactProgram. Raises: DSLValidationError if the format version is wrong or any invariant is violated.

JSON schema

The exact-oracle-v1 format has the following top-level structure:

Op types

Each entry in "ops" has an "op" field that is one of:

Certification values


Round-trip example


Saving to a file