Skip to content

Authored XCI source

The XCI source is your block's interface definition as a file: every method, its number, its typed parameters and result, its errors, and its effect and retry behaviour. The block pipeline produces it from your block and keeps it in the block's folder, beside the module:

billing.py          your block
billing.xci.json    its interface definition

It is the input the XCI compiler reads, at generation and again at bake, and it is archived into the Xratu package with the rest of the block's files, where the block's capsule lists it by hash.

What it records

For the ledger block, the entry for one method reads:

{
  "ordinal": 9,
  "name": "charge_status",
  "parameters": [{"id": 1, "name": "receipt", "declared": {"kind": "string_utf8"}}],
  "returns": {"kind": "string_utf8"},
  "delivery": "value",
  "errors": [],
  "effect": "read_only",
  "retry": {"kind": "retry_safe"},
  "run_capabilities": null
}

Around its methods, the file records:

  1. Identity and version. The package acme.billing, the interface Ledger, and version 1.2.
  2. Resources. Anything a caller holds across calls, such as a session.
  3. Retired numbers. Method numbers and record field ids that were removed, kept so they are never reused. See Export ordinals.

Field by field, the format is in the XCI source reference.

How it is tracked

Generation records the file's path and digest in the block's interface seed:

"xci_source": {
  "path": "billing.xci.json",
  "digest": "sha256:ab5db03ad9a058d6dae47a94c571642f946acacc98e9cdfb2743d37e85e38ffb"
}

Bake opens the file again and compares its digest. A file changed after generation stops the bake:

acme.billing XCI source digest does not match the opened project file billing.xci.json; regenerate the reusable block

Change the block, run xratu capability generate again, then bake.

The source and the compiled interface

The XCI source is the complete definition, including facts that exist only for the build, such as the former names of retired numbers. The compiler turns it into the compiled interface, which is what the capsule, the catalog and the kernel use. See Compiled interface.