Skip to content

Release an application

Bind an accepted store closure, compiled LemaIR artifact, VM worker binary, and lema-cap.json deployment configuration into an immutable lema.release/v1 record, and deploy to a VM-only host.

How do you guarantee that the VM application running in production was compiled from the exact mathematical declarations and kernel receipts in your store, passed ConstantTime and SecretFlow static analyses, and runs only against the deployment configuration (lema-cap.json) you approved?

A release record (lema.release/v1, crates/lema-store/src/release.rs) binds all four pieces together under a single content-addressed SHA-256 ID:

  1. The accepted store closure and its Lean 4.34.1 kernel receipts (checked).
  2. The compiled LemaIR code and any required static guarantee receipts (ConstantTime, SecretFlow.<role>, tested).
  3. The registered lema-vm-runner worker binary digest.
  4. The normalized SHA-256 digest of the deployment’s lema-cap.json configuration (with secret values kept strictly outside the release bytes).

Every time you run lema run --release, the release gate re-verifies those bindings before starting lema-vm-runner inside the sandbox. Any application that uses secrets (Io::Secret, exchange, or serve) requires a release to run (LEMA-421).

Before you start

Workflow A: One-line project release (lema release and lema run --release)

Inside a Lema project directory, cutting and running a release takes two commands:

Shell
lema release
lema run --release --input request.bin

Here is what those two commands do under the hood (LEMA-375):

  • lema release [ENTRY] resolves the project’s application entry, verifies that its closure and required ConstantTime / SecretFlow guarantees hold, compiles or reuses the verified compile memo in .lema/store/vm-code-cache, creates and selects the lema.release/v1 record in .lema/store, and writes the 64-character release ID to .lema/last-release.
  • lema run --release reads .lema/last-release when no explicit release ID is given, runs the full release verification gate against .lema/store, the cached LemaIR artifact, the lema-vm-runner binary, and lema-cap.json, and launches the VM worker. Using the .lema/last-release shortcut never bypasses any verification check.

Workflow B: Explicit artifact release and VM-only host deployment

In production, you often want to elaborate and check proofs on a build host (which has the pinned Lean 4.34.1 toolchain installed) and deploy the verified application to a deploy host that has no Lean distribution, no lean/ directory, and no Rust compiler (LEMA-312, docs/deploy.md).

Here is what runs on each host:

StepHostNeeds Lean 4.34.1?Native calls
1. Admit modules & replay checkpoint (lema checkpoint import)Build hostYesLean kernel replay
2. Build VM artifact (lema build)Build hostNoNone (pure Rust LemaIR)
3. Register installed worker (lema build --worker)Deploy hostNoNone
4. lema release create, verify, select, withdrawDeploy hostNoNone
5. lema run --releaseDeploy hostNoOne lema-vm-runner worker per run

1. Stage the store and artifact on the build host

On your build host, import the lema.exec-source/v2 manifest, build the VM artifact in Rust, and export/import the accepted closure into a clean deployment store so its kernel receipts come from a fresh replay:

Shell
lema exec import --manifest apps/escrow-ledger-vm.json \
  --entry escrow-ledger.vm --expect none --socket $BUILD_SOCK
lema build escrow-ledger.vm --name ledger \
  --worker /usr/local/bin/lema-vm-runner --store $BUILD_STORE --runtime $BUILD_CONFIG

lema checkpoint export --root $EXEC_ID --out ledger.lemabundle --socket $BUILD_SOCK
lema checkpoint import ledger.lemabundle --sha256 $BUNDLE_HEX --socket $DEPLOY_PREP_SOCK

Ship the prepared store directory ($STORE), the lema and lema-vm-runner binaries from your release build, and your deployment configuration directory ($DEPLOYMENT/lema-cap.json) to the deploy host.

2. Configure a VM-only runtime on the deploy host

On the deploy host, write a lema.runtime-linux/v2 configuration file that omits distribution (Write a runtime configuration):

/srv/lema/runtime-vm.json
{
  "schema": "lema.runtime-linux/v2",
  "output": "/srv/lema/output",
  "shared_lock": "/srv/lema/native.lock",
  "profile": "container"
}

Confirm the VM-only configuration with lema check-runtime:

Shell
lema check-runtime --runtime /srv/lema/runtime-vm.json
Output
vm-only: Lean calls refused

A VM-only runtime binds no Lean toolchain into any sandbox and refuses every Lean or checker call before reserving the ledger, while supporting lema build, lema release, and lema run --release.

3. Register the deploy host’s lema-vm-runner worker

An imported store never registers a binary worker automatically. Run lema build once on the deploy host pointing at /usr/local/bin/lema-vm-runner:

Shell
lema build escrow-ledger.vm --name ledger \
  --worker /usr/local/bin/lema-vm-runner \
  --store /srv/lema/store --runtime /srv/lema/runtime-vm.json

This makes zero Lean calls, writes /srv/lema/store/vm-workers/<sha256>.json, and produces an artifact whose id matches the build host’s artifact ID.

4. Create, verify, select, and run the release

Now inspect the deployment digest, create the release record, verify it from scratch, select it, and run it:

Shell
lema release deployment --deployment /srv/ledger/deploy
lema release create --artifact ledger --deployment /srv/ledger/deploy \
  --store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema release verify --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
  --store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema release select --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
  --store /srv/lema/store --runtime /srv/lema/runtime-vm.json
lema run --release $RELEASE_ID --artifact ledger --deployment /srv/ledger/deploy \
  --input request.bin --store /srv/lema/store --runtime /srv/lema/runtime-vm.json

Notice the difference between create/run and explicit verify:

  • lema release create and lema run --release verify all store receipts, artifact digests, worker registration, and lema-cap.json, and may reuse the store’s validated compile memo (<store>/vm-code-cache) when its inputs match.
  • lema release verify always recompiles the accepted store closure to LemaIR from scratch in Rust and compares the freshly compiled bytes against the artifact on disk.

5. Inspect, supersede, or withdraw a release

Manage release lifecycles in the store using show, list, supersede, and withdraw:

Shell
lema release list --store /srv/lema/store
lema release show --release $RELEASE_ID --store /srv/lema/store
lema release supersede --release $RELEASE_ID --by $NEW_RELEASE_ID \
  --reason "Updated TCP deadline limits" --store /srv/lema/store
lema release withdraw --release $RELEASE_ID \
  --reason "Retired old endpoint address" --store /srv/lema/store
  • Superseding (supersede) records $NEW_RELEASE_ID as the preferred successor while still allowing $RELEASE_ID to be selected and run as an explicit rollback.
  • Withdrawing (withdraw) permanently blocks $RELEASE_ID from being selected or run in that store. Because a queued run checks the release gate at the moment execution starts, withdrawing a release immediately stops any pending run from launching.

Common refusals

Refusal message containsCause and fix
missing or different worker registrationRun lema build ENTRY --name NAME --worker /path/to/lema-vm-runner on the target store to register the local worker binary.
changed artifact bytesA file inside the artifact directory (manifest.json or compiled code) was modified after building. Re-run lema build.
changed lema-cap.json/srv/ledger/deploy/lema-cap.json was edited after lema release create. Restore the file or cut a new release for the updated configuration.
is withdrawnThe release was withdrawn with lema release withdraw (or a kernel receipt in its closure was withdrawn) and can no longer run.
block device file ...A file named in block_devices is not a canonical 0600 regular file with link count 1 under protected parents. Fix its permissions or path.

Lema v0.3.2 · Updated 29 October 2026 · Version and compatibility