Source: https://borz.ai/language/contracts/

Guides

# Deterministic contract author guide

Writing Borz contracts for the Ephernity ledger requires two guarantees beyond a plain Borz program: compile-time determinism enforcement and declared resource bounds. This guide covers both.

Guide in preparation

The full guide covers `@deterministic` compile-time enforcement, `@meter_budget` resource envelopes, the EXT-001..011 stdlib surface available to contract authors, and the three known dialect ergonomics. It is being prepared for publication. Full spec reference: [/spec.md](https://borz.ai/spec.md) §7 (Annotations) + §16.6 (stdlib).

Decorator

## @deterministic

Placing `@deterministic` on an actor tells the compiler to reject any handler that calls wall clocks, `f64` literals, unordered map iteration, random functions, cross-actor sends, or inline FFI. Every replica that runs the same handler on the same state must produce an identical state transition.

Decorator

## @meter_budget

`@meter_budget(cpu_us=N, mem_kb=N)` declares the per-call resource envelope. The DELIGHT KVM supervisor enforces these limits at runtime — a handler that exceeds its declared budget is terminated and the call is rejected before it can affect ledger state.

Stdlib surface

## EXT-001..011 — what contract authors may use

The eleven language extensions shipped as of Borz v0.9.5 define the stdlib surface available inside a `@deterministic` actor: `bytes` for binary payloads (EXT-001), `Decimal` / `BigInt` for currency and crypto counters without float loss (EXT-002..003), three-source time including `ledger_now()` (EXT-004), deterministic sorted map/set iteration (EXT-005..006), `@canonical` for byte-identical cross-target encoding (EXT-007..008), DENSE C++ backend for `bytes`/`u32` on the ledger (EXT-009), `std/blake3` + Ed25519 signing with byte-identical DENSE/native output (EXT-010), and the `@deterministic` decorator itself (EXT-011).

[← Back to documentation](https://borz.ai/docs/)
