# oltenrs Full Documentation (LLM Edition) > Release: v0.9.0 | Target: Canton 3.7.x (PV 36–37) · Splice 0.10.x | Source: https://doc.oltenrs.dev > Lite index: https://doc.oltenrs.dev/llms.txt --- # Overview of oltenrs - URL: https://doc.oltenrs.dev/?lang=en#overview - Group: Getting Started - Command: `oltenrs [OPTIONS]` oltenrs is a native Rust runtime that runs the full Canton Network and Daml protocol stack in a single executable without a JVM. ## What does it run in a single binary? You only need the official damlc compiler to build Daml smart contracts into .dar archives. Everything downstream — protocol nodes, consensus, Ledger API v2, Splice application hosting, the Participant Query Store (PQS), database migration, and history archiving — runs inside a single oltenrs binary without recompilation. The CLI is organized into 13 canonical top-level commands across 3 groups: Develop & Verify (test, simulate, deploy, ui, mcp, trace, console), Cluster & Token (daemon, token), and Domain Namespaces (node, dar, splice, db). Pick the entry point that matches your workflow. Use daemon init and daemon up to launch a local multi-node network, use --port-offset and --shadow-verify to run side by side against an existing JVM Canton hub, or link CantonNodeBuilder and CantonExEx as crates to embed a ledger node directly inside a Rust service. ## Single-binary architecture at a glance Click any command in the tree below to jump straight to its guide and flags. > Diagram — **oltenrs single-binary topology**: Each protocol role can run isolated in its own OS process or be linked directly inside a single Rust process. ## Protocol Compatibility Target & Versioning (v0.9.0) oltenrs is an independent open-source Rust runtime that follows its own SemVer (MAJOR.MINOR.PATCH) release cycle, currently documented for v0.9.0. To distinguish it clearly from official Digital Asset distributions, the upstream protocol baselines it is oracle-tested against are tracked separately below. - **Internal fixes & optimizations → PATCH (0.9.0 → 0.9.1)**: Bug fixes and performance improvements that preserve CLI flags and protocol compatibility increment PATCH. - **Upstream Canton patch alignment → PATCH (0.9.x)**: Compatibility adjustments within the same Protocol Version (PV) window ship as PATCH releases. - **New features & new PV targets → MINOR (0.10.0)**: New capabilities or expanded PV targets increment MINOR and update the compatibility table above. - **Production GA & breaking changes → MAJOR (1.0.0+)**: GA stabilization, dropping old PVs, or breaking CLI, YAML, or SDK changes increment MAJOR and branch the documentation. *Protocol compatibility scope & oracle verification baseline (v0.9.0)* | Layer | Compatibility Scope | Oracle Baseline & Notes | | --- | --- | --- | | Canton Protocol | 3.7.x (PV 36–37) | Oracle-verified on 3.7.2 · Ledger API v2, Admin gRPC v30, BFT orderer, embedded Flyway schemas | | Daml-LF Engine | 2.1–2.4 (default 2.3) | Fixed-point decimal arithmetic and static package validation | | Splice | 0.10.x | Oracle-verified on 0.10.1 · Runs all 4 official Splice DARs unmodified with Scan & Registry APIs | | PostgreSQL | 16+ | Participant, sequencer, mediator state and PQS query projection | > **NOTE — Binary version vs. protocol compatibility target**: Run oltenrs --version to print the independent binary version (for example, oltenrs 0.9.0). The Canton and Splice baselines oracle-tested for each release are documented here and in GitHub Releases. --- # Using oltenrs with Scala Canton (Standard vs. Companion vs. Exclusive) - URL: https://doc.oltenrs.dev/?lang=en#scala-companion - Group: Getting Started - Command: `oltenrs dar | oltenrs test --dar | oltenrs deploy | oltenrs ui --url | oltenrs mcp` - Compatibility: Keep official Scala Canton in production. Adopt oltenrs alongside your existing nodes for offline DAR checks, CI testing, read-only inspection, and side-by-side verification without modifying production nodes. You do not need to replace your existing JVM Canton nodes to benefit from oltenrs. Every page in these docs is tagged with a 3-tier compatibility badge so teams can immediately distinguish Canton 3.7.x standard features from companion tools that plug directly into Scala Canton and oltenrs exclusive runtime features. ## 1. Three-Tier Compatibility Model oltenrs pairs 1:1 protocol compatibility across the Canton 3.7.x (PV 36–37) line (oracle-verified on 3.7.2) with modern single-binary developer tools. Separating these three tiers lets Scala Canton teams adopt individual tools immediately without touching production nodes. *At-a-glance comparison of the 3 compatibility tiers* | Tier | Scala Canton Impact | Primary Value | | --- | --- | --- | | Canton 3.7.x · PV 36–37 | 1:1 drop-in protocol parity | Preserve existing .dar, APIs, and DB schemas | | Works with Scala Canton | Zero node replacement | Upgrade dev, CI, and read-only inspection today | | oltenrs Exclusive | Local & CI pre-flight runtime | Dry-run simulation, snapshot forks, OTel & SDK | ## 1-1. Canton 3.7.x · PV 36–37 (Standard Runtime) Implements the official Canton 3.7.x wire protocols, APIs, and database schemas so existing Daml artifacts and operational tooling work unmodified. - **Core Nodes & Consensus**: Participant, Sequencer (DB & BFT), Mediator, Daml-LF 2.1–2.4 VM - **Standard APIs & Ecosystem**: Ledger API v2 (JSON · WS · gRPC), Splice 0.10.x Host & Scan, PQS, Scribe 3.5.x - **Existing Assets & Storage**: Unmodified .dar packages, Wallet SDKs, canton.conf (HOCON), PostgreSQL Flyway schemas ## 1-2. Works with Scala Canton (Companion DX Tools) Developer, CI, and read-only inspection tools that run offline on .dar files or connect over standard Ledger API v2 without replacing your Scala Canton nodes. - **Offline DAR Checks & Remote Cache**: dar inspect · diff · check-upgrade --downgrade-risk, https/gh/oci remote DAR cache - **Declarative Idempotent Deploy**: oltenrs deploy (daml.yaml profiles & SHA-256 frozen lockfiles over standard APIs) - **Read-Only Studio & AI MCP**: oltenrs ui (Olten Studio Live Inspector), oltenrs mcp (compile-time read-only MCP) - **Parallel CI Tests & Shadow Verify**: oltenrs test -j N (JUnit XML), dar script --cost-report, token CLI, --port-offset --same-identity ## 1-3. oltenrs Exclusive (Rust Runtime Superpowers) Native capabilities powered by the single-binary Rust runtime — ideal for fast local iteration, pre-flight simulation in CI, and automated operations. - **Declarative Supervisor & Safety Gates**: daemon up · doctor · top · snapshot · restore, --dev-auth, Plan-Hash apply gate - **Pre-Flight Simulation & Visualizers**: POST /_simulate, --from-snapshot forks, --diagnose, .simrun bundles, 5-tab tui, offline HTML graphs, daemon tx explain - **Tracing & Embedded Rust SDK**: Pure-Rust OTel tracing (oltenrs trace), in-process Rust SDK (CantonNodeBuilder · CantonExEx) ## 2. Five Workflows You Can Adopt Immediately All five workflows below operate either completely offline on compiled .dar archives or over standard Ledger API v2 / Admin endpoints — without modifying a single Scala Canton configuration file. ### Standalone & API Workflows alongside an existing Scala Canton 3.7.x Participant (:7575) ```bash # 1. Offline Smart Contract Upgrade (SCU) & downgrade-risk check in CI oltenrs dar check-upgrade ./release-v1.dar ./release-v2.dar --downgrade-risk # 2. Run all Daml Scripts in parallel on fresh isolated ledgers with JUnit XML output oltenrs test --dar ./target/app.dar -j 8 --format junit --output ./reports/daml-junit.xml # 3. Declarative idempotent deployment against a profile targeting your Scala Canton participant oltenrs deploy --file canton-deploy.yaml --profile staging --frozen-lockfile # 4. Open Zero-CDN Olten Studio (strictly read-only Live Node Inspector; defaults to port 18080) oltenrs ui --url http://127.0.0.1:7575 --token-env CANTON_JWT --port 8090 # 5. Connect an AI coding agent via compile-time Read-Only MCP oltenrs mcp --transport stdio --url http://127.0.0.1:7575 --root . ``` ## 3. Gradual Adoption Path Teams typically move through three stages at their own pace — stopping at Stage 1 or Stage 2 indefinitely if Scala Canton remains their production standard. ### Incremental adoption alongside Scala Canton Stage 1. **Offline & Read-Only Tools** — Adopt dar check-upgrade, oltenrs test, oltenrs deploy, oltenrs ui (Live Inspector), and oltenrs mcp with no changes to production JVM nodes. Stage 2. **LocalNet & Pre-Flight Simulation CI** — Replace heavy multi-container JVM LocalNet stacks in developer laptops and CI with oltenrs daemon + simulate (--from-snapshot, --diagnose, .simrun). Stage 3. **Shadow Verify & Optional Native Takeover** — Run oltenrs beside a live Scala hub (--port-offset --same-identity --state-in-files) to verify parity before evaluating native runtime takeover. --- # Install & Quickstart - URL: https://doc.oltenrs.dev/?lang=en#quickstart - Group: Getting Started - Command: `brew install cantonrs/tap/canton-rs` Install the standalone binary, spin up a local Canton cluster from a declarative manifest, and attach the live TUI dashboard and console. ## Installation On macOS and Linux, install oltenrs directly from the official Homebrew tap (cantonrs/tap). Without Homebrew, use the one-line install script — which detects your OS and CPU architecture (macOS Apple Silicon/Intel and Linux x86_64/arm64) automatically — or build directly from source with Cargo. ### Option 1: Homebrew official tap (recommended · macOS / Linux) ```bash # Install from the official tap (cantonrs/tap, Formula/canton-rs.rb) brew install cantonrs/tap/canton-rs # Verify installation and version (v0.9.0) oltenrs --version # Upgrade to a newer release # brew upgrade cantonrs/tap/canton-rs ``` *Installs the oltenrs formula from the official Homebrew tap repository (https://github.com/cantonrs/homebrew-tap).* ### Option 2: One-line installer (auto-detects macOS and Linux) ```bash # Install the latest release binary for your OS/architecture (~/.local/bin/oltenrs) curl -fsSL https://oltenrs.dev/install.sh | sh # Pin a specific release version # CANTON_RS_VERSION=v0.9.0 curl -fsSL https://oltenrs.dev/install.sh | sh ``` *Verifies the SHA-256 checksum after download and installs to your user bin directory without sudo.* ### Option 3: Build from source (Cargo) ```bash # Build the release binary cargo build --release -p oltenrs # Audit dynamic links to verify no JVM or non-system shared libraries are required ./target/release/oltenrs daemon audit ``` ## First Run Run oltenrs --help to view all 13 canonical commands organized into 3 groups (Develop & Verify, Cluster & Token, Domain Namespaces). For a local cluster, oltenrs daemon init defaults to a zero-DAR manifest (dars: []), so daemon doctor and daemon up work out of the box in any empty directory outside the source repository. Pass --with-sample-dar to extract the binary-embedded sample-contract.dar for instant offline sample contracts. Boot a named isolated instance (--name dev1), export connection variables with daemon env, and inspect via the live TUI or console. ### Manifest (zero-DAR / --with-sample-dar) → doctor preflight → named boot → TUI & console ```bash # 1. Generate a default zero-DAR manifest (dars: []) and run preflight checks (exit 0=ok, 2=conflict) oltenrs daemon init --template default -o canton-daemon.yaml # Or bootstrap with the embedded offline sample contract (sample-contract.dar): # oltenrs daemon init --template default -o canton-daemon.yaml --with-sample-dar oltenrs daemon doctor -f canton-daemon.yaml --name dev1 --port-offset 0 # 2. Boot a named instance with loopback dev-auth JWT & Prometheus file_sd registration oltenrs daemon up -f canton-daemon.yaml --name dev1 --port-offset 0 --dev-auth --observability -d # Exports per-service endpoint variables such as CANTON_RS_PARTICIPANT1_JSON_URL (default template) eval "$(oltenrs daemon env --name dev1)" # 3. Inspect slots, structured JSON status, and open the 5-tab TUI (pressing q keeps daemons running) oltenrs daemon ps --name dev1 oltenrs daemon status --name dev1 --format json oltenrs daemon top --name dev1 # 4. Attach the Canton console to the named instance oltenrs console attach --state-dir "${XDG_STATE_HOME:-$HOME/.local/state}/canton-rs/instances/dev1" # 5. Tear down and cleanly remove the registered instance (stray procs = 0) oltenrs daemon remove --name dev1 --force ``` --- # Architecture & Protocol Principles - URL: https://doc.oltenrs.dev/?lang=en#architecture - Group: Getting Started How the Canton protocol pairs sub-transaction privacy with atomic settlement, and how oltenrs integrates into existing Canton environments without downtime. ## 1. Virtual Shared Ledger & Role Separation Canton models transactions as a Virtual Shared Ledger backed by Blinded Merkle Trees. Each multi-party transaction tree is decomposed by authorization scope so that third-party nodes outside a transaction receive only salted hashes for blinded branches. - **Participant**: Stores contract payloads in its local Active Contract Set (ACS) only for contracts where it hosts a Signatory or Observer. - **Sequencer**: Assigns a strictly monotonic order and microsecond timestamp to encrypted envelopes ([SEALED]) without reading their contents. - **Mediator**: Collects encrypted Confirmation Responses against the transaction Root Hash (never payload values) to determine quorum verdicts. - **Splice & SDK**: Supports unmodified Splice DARs and Wallet SDK flows, and can be linked directly as a crate inside your Rust application. ## 2. Single Binary & In-Process Rust Library Because oltenrs compiles to a single native binary, it runs with low memory overhead and predictable tail latency across local development, CI runners, and production hosts. You can run protocol nodes as standalone OS processes or link the crate directly inside a Rust application to run the ledger in-process. *Core architectural layers* | Layer | Core Components | Operational Benefit | | --- | --- | --- | | Daml-LF 2 Engine | CEK evaluator, static package validator, fixed-point decimal math | Runs .dar archives built by damlc without modification | | Cryptography Layer | Domain-separated hashes, non-canonical rejection, Ed25519 · ECDSA (ML-DSA-65 parser/signer included) | Pure Rust implementation without external C/OpenSSL dependencies (external NIST ACVP & RSA unsupported) | | Privacy & Consensus | Blinded Merkle views, multi-synchronizer reassignment, ISS/Narwhal BFT | Joins existing Scala BFT clusters as a fork-free peer | | API & Data Layer | HTTP/WS/gRPC Ledger API v2, native pqs_* store, history archive | Single-binary deployment with safety-guarded cold archives | ## 3. Phased Adoption Alongside Existing JVM Nodes You do not need to swap an existing ledger core all at once. Because oltenrs speaks the standard protocol and official PostgreSQL schemas, teams can validate and adopt one boundary at a time. ### Four-stage adoption flow in an existing Canton environment Step 01 · Peripheral Services First. **Scribe 3.5.8 · splice serve --ledger-host** — Attach Splice (splice serve --ledger-host) or official Scribe 3.5.8 (gRPC GetUpdates) behind your participant node; oltenrs db pqs targets oltenrs JSON API v2 (pqs_* schema). Step 02 · Shadow Verification. **--port-offset · --shadow-verify** — Point oltenrs read-only at the same database and identity on offset ports; --shadow-verify compares live JVM vs Rust participant ledger_end offsets. Step 03 · Hybrid BFT Consensus. **node sequencer bft-peer join** — Onboard a Rust sequencer as a BFT peer in an active synchronizer cluster to verify multi-client consensus. Step 04 · DB Takeover & Archival. **db takeover · db archive** — Hand off PostgreSQL state ownership once parity is confirmed and export aged JSONL history into signed archive segments (in-flight/commitment states are not migrated). *Every step honors standard protocol and schema boundaries, keeping rollback straightforward at any stage.* --- # canton-daemon.yaml Configuration Guide - URL: https://doc.oltenrs.dev/?lang=en#daemon-yaml - Group: Daemon & Operations - Command: `oltenrs daemon up -f canton-daemon.yaml [--profile ] [--group ] [-d]` Declare synchronizers, cell isolation, port allocations, and PostgreSQL storage in a single YAML manifest instead of maintaining separate HOCON configs and Scala bootstrap scripts. ## How does it differ from HOCON + bootstrap.sc? Traditional Canton setups split static ports and database settings into canton.conf while scripting node onboarding and ping sequences in bootstrap.sc. canton-daemon.yaml combines service topology and startup dependencies into one manifest and allocates non-conflicting ports automatically. | Comparison | canton.conf + bootstrap.sc | canton-daemon.yaml | | --- | --- | --- | | Configuration Style | Static HOCON config paired with imperative Scala scripts | Single declarative YAML manifest | | Port Allocation | Manual assignment across JSON, gRPC, and Admin ports per node | Automatic allocation and conflict checks per cell base_port | | Institution Isolation | Manual checks across local state directories and DB schemas | Automatic pre-flight checks via cells: isolation: strict | | Secret Protection | Risk of plaintext database URLs inside static configs | ${ENV_VAR} substitution with automatic **** masking in inspect and TUI | ## Strict Cell Isolation (cells: isolation: strict) When hosting multiple institutions on a single machine, pointing two participants at the same state directory or PostgreSQL schema is an easy mistake to make. Declaring isolation: strict under cells: validates three isolation invariants during daemon config and before daemon up starts. - **Isolated state directories**: Services grouped under bank-a store keys and journals separately under /cells/bank-a/. - **Duplicate DB and certificate guard**: Startup aborts with a password-masked error if two strict cells share the same PostgreSQL URL or JWT verification certificate. - **Selective startup and memory caps**: Pass --group or --profile to start only selected cells together with their upstream dependencies (sequencer and mediator), and cap memory with max_rss_mb. ### canton-daemon.yaml example with strict cell isolation and per-cell PostgreSQL stores ```yaml name: dvp-sandbox synchronizer: core-sync state_dir: ./canton-rs-state cells: sync-core: isolation: strict description: "Shared synchronizer cell (sequencer + mediator)" bank-a: isolation: strict base_port: 11000 description: "Participant institution A" sec-b: isolation: strict base_port: 12000 description: "Participant institution B" services: seq-core: role: sequencer group: sync-core ports: ["5018:public", "5019:metrics"] med-core: role: mediator group: sync-core ports: ["5017:admin"] depends_on: [seq-core] p-bank-a: role: participant group: bank-a profiles: [core] dars: ["./contracts/target/sample-contract.dar"] storage: type: postgres url: ${BANK_A_PG_URL} limits: max_rss_mb: 1024 depends_on: [seq-core, med-core] pqs-bank-a: role: pqs group: bank-a profiles: [indexer] ledger_of: p-bank-a storage: type: postgres url: ${BANK_A_PQS_URL} depends_on: [p-bank-a] ``` *Environment variables such as ${BANK_A_PG_URL} are automatically masked as **** in inspect output and the TUI.* ## Six Built-In Templates & Two Topology Patterns Run oltenrs daemon init --template to generate a ready-to-run manifest tailored to your environment. Six built-in templates cover the two primary topology patterns below and default to zero-DAR (dars: []) so they start cleanly outside the source repo; pass --with-sample-dar to extract the embedded sample-contract.dar alongside the manifest. - **default / localnet**: Standard single-synchronizer + participant stacks (participant1, etc.) for rapid quickstart (default) and multi-participant LocalNet DX workflows (localnet). - **enterprise-dvp**: Local multi-party simulation spawning 6 nodes across 5 strictly isolated cells to validate Delivery versus Payment (DvP) settlement and third-party isolation. - **bft-cluster**: Launches 4 BFT sequencers alongside participants to verify quorum continuity when 1 sequencer node stops. - **multi-domain**: Boots two synchronizers (usd-sync and eur-sync) plus a bridge participant for cross-domain contract reassignment. - **org-production**: Single-organization production template connecting only your own participant, PQS, and Splice stack to an external consortium sequencer. | Dimension | Multi-Institution Simulation (Local PoC) | Single-Organization Production Stack | | --- | --- | --- | | Control Scope | Developers or auditors launch all institution cells on one host | Run only your organization's participant, PQS, and Splice behind your firewall | | Synchronizer Link | Direct connection to the local sequencer defined in the manifest | Remote connection to an external consortium sequencer (sequencer_url) | | Init Templates | default · localnet · enterprise-dvp · bft-cluster · multi-domain | org-production | > **TIP — Should I use canton.conf or canton-daemon.yaml?**: Use oltenrs daemon -c canton.conf when reading an existing production Canton configuration for shadow verification or cutover. Choose canton-daemon.yaml for new topologies that benefit from strict cell isolation, profile-based partial startup, and .env secret masking. --- # Process Supervisor & Real-Time Monitoring (daemon top) - URL: https://doc.oltenrs.dev/?lang=en#supervisor - Group: Daemon & Operations - Command: `oltenrs daemon [OPTIONS]` Launch multiple nodes in the background with dependency-ordered lifecycle management, automatic recovery, zero-payload protocol X-Ray, a 5-tab TUI, and Prometheus metrics. ## Built-in Process Supervisor Although oltenrs ships as a single binary, sequencers, mediators, participants, and Splice servers execute as isolated OS processes at runtime. The built-in supervisor brings services up and down in dependency order, while install-service omits --no-restart so init keeps the supervisor alive and the supervisor keeps restarting crashed children (Mode A auth_cert is passed via --auth-cert on participant services and refused on non-participant roles). - **Persistent slots (0..N) & auto-recovery**: Unexpected exits trigger backoff restarts automatically, while manually stopped services stay pinned in their numbered slot (Stopped) for instant restart under a new PID. - **Reverse-order shutdown & log rotation**: daemon down sends SIGTERM in reverse dependency order and rotates JSON-line stdout logs cleanly on line boundaries (50 MiB x 5 files). - **Unified snapshot metrics**: daemon top, daemon stats, and GET /metrics all read from a single cluster snapshot refreshed once per second. > Diagram — **Supervisor Execution Modes (3 Patterns)**: All three modes share the same persistent slots (0..N), daemon.sock control channel, and /metrics (:9464) endpoint. ### Start in the background and inspect persistent slots (daemon ps -a) ```text $ oltenrs daemon up -d && oltenrs daemon ps -a ID NAME ROLE PID STATUS PORTS CPU MEM 0 sequencer1 sequencer 41201 Up 2 hours (healthy) 127.0.0.1:26518->public 0.8% 31.2MB 1 mediator1 mediator 41208 Up 2 hours (healthy) 127.0.0.1:26517->admin 0.3% 24.0MB 2 participant1 participant 41219 Up 2 hours (healthy) 26575->json, 26501->grpc 1.9% 54.2MB 3 splice-sv splice - Exited (0) 3 mins ago 25020->http (stopped) - - ``` ## daemon top (5-Tab TUI) & Zero-Payload X-Ray Every oltenrs TUI adapts cleanly to light and dark terminals using Color::Reset and reverse-video highlights while offloading IPC and archive reads to non-blocking background threads. X-Ray ([x]) is opt-in (--xray or admin POST /_xray; zero cost computation when off) and records actual submitted batch plaintext envelope sizes (sealed_envelope_bytes), prepare-aligned total traffic cost (traffic_cost_bytes), estimated Root Hash, and lf-eval timing without contract payloads under admin-JWT protection (is_participant_estimate: true remains set because mock signature lengths are used). ### daemon top 5-tab dashboard and group view toggling ([g]) ```text ┌─ oltenrs daemon top ── sync: core-sync (postgres) │ 3/4 Up │ CPU: 3.0% │ RSS: 109.4 MB │ Ping: 2.8ms ───┐ │ ┌─ [1] Services (4 · ACTIVE) ────┐ ┌─ [2] Workspace ([/] tabs · z zoom) ────────────────────────────────┐ │ │ │ SERVICE STATE MEM │ │ [o] Overview │ [l] Live Logs │ [x] Protocol X-Ray │ [i] │ [c] ExEx │ │ │ │ ● sequencer1 Online 31M │ │ ────────────────────────────────────────────────────────────────── │ │ │ │ ■ mediator1 Stopped - │ │ Node : participant1 (participant) │ PID: 41219 │ Online │ │ │ │ ▶ ● participant1 Online 54M │ │ Ledger : offset #1,482 │ ACS: 319 │ Parties: 12 │ DARs: 4 │ │ │ │ ● participant2 Online 24M │ │ CPU (60s): ▁▁▂▁▁▃▂▁▁▁▂▂▁▁▁▁ 1.9% │ RSS: ▃▃▃▃▃▃▃▃▃▃▃▃ 54.2 MB │ │ │ └────────────────────────────────┘ │ Live Tail (participant1 · INFO+) │ │ │ ┌─ Cluster & Quick Status ───────┐ │ 01:49:58 INFO [participant1] submit-and-wait commandId=settle-42 │ │ │ │ Nodes : 3/4 Up · 1 Stopped │ │ 01:49:59 INFO [participant1] sequenced batch offset=1482 │ │ │ │ Wiretap : OPT-IN (--xray) │ └────────────────────────────────────────────────────────────────────┘ │ │ └────────────────────────────────┘ │ │ [↑/↓] Service [Tab/→] Workspace [g] Group [s] Stop/Start [o/l/x/i/c] Tabs [t] Lab [z] Zoom [q] │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ``` *Press [g] to switch between Cell/Group, SyncDomain, Role, Host, and Flat views, or press [s] on a group row to inject a fault at the @group level.* ### Opt-in Participant Estimate X-Ray trace example (Zero-Payload Estimate) ```text ┌─ X-Ray Traces (1 · ACTIVE) — ↑/↓ select RootHash, Enter full modal ──────────────────────────┐ │ ▶ ● 0x7f839a12c4e0.. participant1 AssetHolding 11.4ms APPROVED │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ ┌─ Trace Detail (dropped: 0) [ZERO-PAYLOAD PARTICIPANT ESTIMATE] ──────────────────────────────┐ │ RootHash (participant estimate): 0x7f839a12c4e088b1... │ Total: 11.40ms │ Verdict: ● Approved│ │ [1. Participant] participant1 │ pkg: 0fe75100.. │ tmpl: AssetHolding │ eval: 380us │ 1 view │ │ [2. Estimate] envelope_est: ~1,420 B │ informees: 2 (submitted by this participant only) │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ ``` > **TIP — If I press q to quit daemon top, do my running nodes stop?**: No. daemon top only detaches its terminal UI client from daemon.sock; background nodes continue running unaffected. Run oltenrs daemon down when you want to shut down the cluster. ## Prometheus & Grafana Integration (/metrics) The supervisor exposes OpenMetrics (/metrics), a JSON cluster snapshot (/snapshot), and health probes (/livez, /readyz) on port 9464 by default. While /livez checks process liveness, /readyz returns 200 OK only when PostgreSQL and sequencer connectivity are healthy. Launching daemon up with --observability automatically writes Prometheus file_sd_configs JSON targets under $XDG_STATE_HOME/canton-rs/file_sd_targets/ and cleans them up on daemon remove. Pre-built Grafana dashboards, alert rules, and Docker Compose monitoring stacks are available on GitHub (https://github.com/cantonrs/canton-rs/tree/main/deploy/monitoring), paired with 3 verified 1:1 upstream Canton metric aliases and 25 native canton_rs_* families. *Core OpenMetrics time-series & 3 verified upstream aliases (labels: synchronizer, group, role, node)* | Metric Name | Type | Use Case / Upstream Alias | | --- | --- | --- | | canton_rs_node_up | gauge | Node health and /readyz alerting (CantonRsNodeDown) | | canton_rs_node_memory_rss_bytes | gauge | Compare RSS memory across org cells or multi-instances via sum by (group) | | canton_rs_ledger_end_offset | gauge | Track commit progress and verify zero-downtime advancement during failover | | canton_rs_acs_active_contracts | gauge | Compare active contract counts across parties | | canton_rs_api_request_duration_seconds_bucket | histogram | Compute JSON/gRPC API p50, p95, and p99 latency | | canton_rs_mediator_pending_quorums | gauge | Verified 1:1 alias: daml_mediator_outstanding_requests | | canton_rs_bft_quorum_peers | gauge | Verified 1:1 alias: daml_sequencer_bftordering_p2p_connections_connected | | canton_rs_bft_configured_peers | gauge | Verified 1:1 alias: daml_sequencer_bftordering_topology_validators | | canton_rs_shadow_verified_tx_total / mismatch_total | counter | Compare live JVM vs Rust participant ledger_end offsets and surface mismatches | ### Inspect metrics and configure Prometheus file_sd_configs / static scraping (prometheus.yml) ```yaml # 1. Loopback default (127.0.0.1); set --metrics-bind 0.0.0.0 explicitly only when Docker bridge scraping is required # curl -s http://127.0.0.1:9464/metrics | head -n 20 # Booting with --observability creates and deletes file_sd_targets/*.json automatically. # 2. prometheus.yml scrape configuration (dynamic file_sd + static fallback) global: scrape_interval: 5s scrape_configs: - job_name: oltenrs file_sd_configs: - files: - "${XDG_STATE_HOME:-~/.local/state}/canton-rs/file_sd_targets/*.json" static_configs: - targets: ["host.docker.internal:9464"] ``` *Add either file_sd_configs or static_configs above to your existing Prometheus configuration to begin ingesting supervisor metrics immediately.* ### Run local Prometheus + Grafana via Docker (docker-compose.yml) ```yaml # Place prometheus.yml in the same folder, then run: docker compose up -d services: prometheus: image: prom/prometheus:v2.54.1 ports: - "9095:9090" extra_hosts: - "host.docker.internal:host-gateway" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro grafana: image: grafana/grafana:11.2.2 depends_on: - prometheus ports: - "3300:3000" environment: - GF_USERS_DEFAULT_THEME=dark ``` *Pre-built Grafana dashboard JSON files, alert rules (alerts.yml), and full multi-cell demo configs are available on GitHub at https://github.com/cantonrs/canton-rs/tree/main/deploy/monitoring.* ## daemon Supervisor Subcommands & Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `doctor [-f \| -c ] [--name ] [--port-offset ] [--pg-url ] [--check-routing --act-as [--read-as

] [--informees

] [--synchronizer ]] [--token-env \| --token-file ] [--format text\|json]` | - | `Preflight Check` | `text` | Run non-short-circuiting D1–D10 checks (port overflow, internal collisions, OS sockets, disk, PostgreSQL) with zero side effects (exit 0=ok, 2=preflight fail). Add --check-routing with --act-as to diagnose live multi-party routing readiness via POST /_diagnose/routing. | | `audit [--binary ]` | - | `Zero-JVM Audit` | `current binary` | Audit linked shared libraries of the binary (defaults to the current executable) to verify zero JVM or non-system library dependencies. | | `up [-d, --detach] [-f, --file ] [--name ] [--port-offset ] [--dev-auth] [--bind ] [--observability] [--pg-url ] [--profile ] [--group ] [--token-env \| --token-file ]` | - | `bool / PathBuf / String` | `canton-daemon.yaml / 127.0.0.1` | Run D1–D10 preflight, boot services in dependency order, isolate state by --name, and optionally enable --dev-auth HS256 JWTs and --observability Prometheus file_sd. | | `status / env / list / remove [--name ] [--dry-run] [--force] [--format text\|json]` | - | `Registry & Env` | `text` | Print machine-readable status (canton-rs.status/1), emit eval-ready env exports, list registered instances, and cleanly delete state/procs with remove. | | `snapshot --name --out [--token-env \| --token-file ] / restore --name --from [--port-offset ] [--force]` | - | `State Bundle` | - | Quiesce via /_quiesce/pause, write a 0600 checksummed archive, and restore/clone into another named instance and port window. | | `plan [-f \| -c ] [--name ] [--out ] [--ttl-secs 900] [--lsu-target-pv ] [--lsu-max-pending-txs 100] [--token-env \| --token-file ] [--format text\|json]` | - | `Dry-Run Plan` | `ttl: 900s / max-pending: 100` | Compute a deterministic manifest/DAR change diff, risk level (LOW–CRITICAL), LSU pre-flight checks, and a 64-hex SHA-256 plan_hash without mutating state. | | `apply --plan-hash <64_HEX> [-f \| -c ] [--plan-file ] [--name ] [--no-pre-snapshot-i-understand-risk] [--quiesce-timeout-secs 30] [--token-env \| --token-file ] [--format text\|json]` | - | `Guarded Apply` | `quiesce: 30s` | Apply changes only when the recomputed plan_hash matches --plan-hash, taking an automatic pre-apply snapshot first (skipping is refused on HIGH DAR SCU or CRITICAL LSU upgrades). | | `contracts --party

[--at \|--from ] / tx \|explain --id \|diff > [--format json]` | - | `Ledger Query` | - | Inspect party-scoped ACS snapshots, stream live (+)/(-) updates over WebSocket, replay LEDGER_EFFECTS trees, explain 6-reason cross-party visibility (explain), and diff captures against oracle runs (exit 3 on diff). | | `dar watch [--name ] [--debounce-ms 500] / creds [--name ] [--user ] [--party

] [--ttl 1h] [--format json]` | - | `Hot Reload / JWT` | - | Watch a DAR file, run check-upgrade before auto-uploading/vetting to all participants, and issue/authorize short-lived dev HS256 JWTs. | | `down [--clean-files] [--timeout-secs ]` | - | `bool / u64` | `false / 10` | Shut down all nodes in reverse dependency order; --clean-files removes local files only inside supervisor-marked state_dir directories (refuses CWD/$HOME) without touching PostgreSQL. | | `ps [-a, --all] [--scan-host] [--json] [--report]` | - | `Flags` | - | Print persistent slot indices, status, PID, bound ports, CPU, and RSS memory as a table, JSON, or Markdown report. | | `stop / start / restart ` | - | `Vec` | - | Stop, start, or restart a single service or target groups via selectors such as @bank-a or role:participant. | | `scenario > [--name ] [-f ] [--token-env \| --token-file ] [--json] (alias: lab)` | - | `Subcommand` | - | Run built-in party onboarding, contract commit, and third-party ACS 0-count scenarios against a live cluster (--name or --state-dir; same as TUI [t]). | | `logs [SERVICE] [-f, --follow] [--tail ] [--level ] [--grep ]` | - | `Stream Options` | `--tail 100` | Stream or filter tagged node logs across the cluster. | | `top (alias: tui, monit) / stats [--no-stream]` | - | `TUI / Table` | - | top launches the 5-tab full-screen dashboard; stats prints a resource usage table. | | `inspect > [--json]` | - | `String` | - | Inspect masked (****) node configuration or look up a participant-estimated X-Ray trace summary by Root Hash. | | `init [--template ] [--with-sample-dar] [-o ] [--force] / config` | - | `Enum / PathBuf` | `default / canton-daemon.yaml` | Generate a default zero-DAR canton-daemon.yaml from 6 built-in templates (add --with-sample-dar to extract the embedded sample-contract.dar) and run pre-flight isolation and port-conflict checks. | | `install-service [--system \| --user] [--output

]` | - | `Service Unit` | `--user` | Generate Linux systemd .service or macOS launchd .plist unit files without --no-restart so the supervisor keeps restarting crashed child nodes. | --- # LocalNet DX (1): Preflight Diagnostics, Multi-Instance Isolation & Snapshots - URL: https://doc.oltenrs.dev/?lang=en#localnet-dx - Group: Daemon & Operations - Command: `oltenrs daemon [OPTIONS]` Validate port plans and host prerequisites with zero side effects before spawning a single process, and isolate, snapshot, and clone multiple named Canton networks side by side on one workstation or CI runner. ## 1. Zero-Side-Effect Preflight Diagnostics (daemon doctor · D1–D10) When booting a multi-node local stack, even one occupied port or missing .dar archive can leave half the cluster started and half crashed. oltenrs daemon doctor accepts the exact same flags as daemon up (-f manifest or -c config, --name, --port-offset, --pg-url, --profile, --group) and evaluates all ten host checks (D1–D10) non-short-circuiting without spawning any child process. Instead of probing ports via temporary socket bind calls, doctor inspects live OS socket tables (macOS lsof/netstat, Linux /proc/net/tcp) so host state before and after the check remains untouched. Internally, daemon up runs this exact check function upfront and aborts with zero spawned processes whenever any check fails. *Ten Preflight Diagnostic Checks in daemon doctor (D1–D10)* | Check ID | Target | Failure Condition (fail · exit 2) | Warning (warn) or Status Condition | | --- | --- | --- | --- | | D1 | Valid Port Range | Resolved port < 1024 or base + offset > 65535 overflow | None | | D2 | Reserved Hub Port Guard | Overlaps any protected hub port (3080, 3901, 6432, 6501, 6502) | None | | D3 | Host Listening Sockets | Another external process is already listening on a planned port | Same --name instance is already healthy (running · exit 0) | | D4 | Intra-Manifest Port Uniqueness | Two services inside the same stack declare the same port | None | | D5 | State Directory Permissions | Directory cannot be created/written or collides with protected paths | Older registry metadata detected in existing directory | | D6 | Filesystem Free Space | Available disk space below 2 GiB | Early warning when available space falls below 10 GiB | | D7 | Build Cache (target/) Size | None | Advisory warning when workspace target/ exceeds 10 GiB | | D8 | PostgreSQL Reachability | TCP connection or authentication fails when --pg-url is supplied | Server major-version difference notice | | D9 | DAR Archive Integrity | Manifest-referenced .dar file is missing or fails archive parsing | None | | D10 | Shared Hub Container Detection | None | Read-only notice when hub-canton or hub-postgres is running | ### Example 1: Human-Readable Preflight Check & Machine-Readable JSON Report ```bash # 1. Inspect human-readable check rows and remediation hints (fix:) $ oltenrs daemon doctor -f canton-daemon.yaml --name dev1 oltenrs daemon doctor (schema=canton-rs.doctor/1, exit=0) [D1 ] ok all resolved ports within 1024..=65535 [D2 ] ok no overlap with reserved hub ports [D3 ] ok all planned ports free on host ... # 2. Emit deterministic JSON (schema: canton-rs.doctor/1) for CI scripts $ oltenrs daemon doctor -f canton-daemon.yaml --name dev1 --format json ``` > **IMPORTANT — Structured Exit Code Contract for CI & Automation (0 · 1 · 2 · 3)**: Every LocalNet DX subcommand shares four deterministic exit codes: 0 means success (warnings allowed), 1 indicates an unexpected internal failure, 2 means preflight rejection, port conflict, or invalid user input caught before booting, and 3 signals an integrity mismatch (corrupted snapshot hash, quiesce timeout, or oracle projection diff). ## 2. Named Multi-Instance Isolation & Shell Binding (--name · status · env) Running a feature-branch stack alongside a baseline stack on one laptop or shared CI runner requires strict separation of state directories, sockets, and TCP ports. Passing --name (lowercase alphanumeric and hyphens, e.g., dev1, pr-42) registers an isolated workspace under $XDG_STATE_HOME/canton-rs/instances// (mode-0600 instance.json). When --port-offset is omitted, the registry automatically picks the smallest unused 1000-port window (0, 1000, 2000, ...) that does not overlap any existing instance. Once up, daemon status verifies live HTTP/gRPC health per endpoint and eval "$(oltenrs daemon env --name )" exports every resolved endpoint URL into your current shell. *Choosing Between the Three Lifecycle Teardown Commands (stop vs. down vs. remove)* | Command | Process Action | Local State Dir (instances/) | PostgreSQL Schemas | When to Use | | --- | --- | --- | --- | --- | | daemon stop | Stops only the selected node or group (keeps slot index) | Preserved | Preserved | Injecting node faults before resuming immediately with daemon start | | daemon down [--name ] | Gracefully stops the entire cluster in reverse dependency order | Preserved (--clean-files wipes local files only) | Preserved | Pausing work and restarting later with the exact same ledger state | | daemon remove --name | Runs down first if active (requires --force non-interactively) | Deletes instance dir and Prometheus file_sd targets | Drops dedicated -* schemas | Reclaiming 100% of disk and DB state after finishing a branch or CI run | ### Example 2: Booting Two Named Instances Without Manual Port Math & Binding Shell Vars ```bash # 1. Boot dev1 (auto offset 0) and dev2 (auto offset 1000) side by side oltenrs daemon up -f canton-daemon.yaml --name dev1 -d oltenrs daemon up -f canton-daemon.yaml --name dev2 -d oltenrs daemon list # 2. Export all dev1 endpoints into the current shell (named by YAML service key — CANTON_RS_PARTICIPANT1_JSON_URL for default/localnet) eval "$(oltenrs daemon env --name dev1)" curl -s "$CANTON_RS_PARTICIPANT1_JSON_URL/v2/version" # 3. Query probe-verified JSON status (canton-rs.status/1), then preview and remove dev2 oltenrs daemon status --name dev1 --format json oltenrs daemon remove --name dev2 --dry-run oltenrs daemon remove --name dev2 --force ``` > **NOTE — Can daemon remove Accidentally Delete Project Directories or Follow External Symlinks?**: No. daemon remove strictly refuses paths outside $XDG_STATE_HOME/canton-rs/instances/ as well as protected repository paths (canton-rs-state/), and never follows symlinks pointing outside the instance directory. Pass --dry-run first whenever you want to preview the exact files and PostgreSQL schemas slated for deletion. ## 3. Consistent State Snapshots & Cross-Window Cloning (snapshot · restore) Capturing a seeded ledger after party onboarding and initial token issuance lets you rewind failed test runs in seconds or fork a live environment onto a new port window without repeating slow bootstrap scripts. daemon snapshot supports both file-backed mode (--state-in-files) and PostgreSQL mode (--pg-url, including per-schema pg_dump archives), and automatically restarts the source instance once the bundle is sealed. ### Four-Stage Atomic Flow of daemon snapshot & restore 01 · Quiesce Drain. **Pause Ingress & Drain In-Flight Work** — Calls /_quiesce/pause across all nodes and waits until active requests reach zero (if the 30s timeout expires, ingress resumes on every node and snapshot aborts safely with exit 3). 02 · Seal & Resume. **Pack 0600 Checksummed Archive & Restart Source** — Stops nodes in reverse order, packs file/PG stores plus snapshot.json (per-component SHA-256 hashes and participant ledger_end) into a mode-0600 .tar, and restarts the source cluster. 03 · Verify & Backup. **Validate Version & Hashes Before Swapping** — restore verifies binary version match (exit 2 on mismatch) and every component SHA-256 digest (exit 3 on corruption), moving any prior target directory to dir.bak- for automatic rollback. 04 · Rebind & Check. **Bind Target Port Window & Verify Ledger End** — Boots the target instance on its own port offset and confirms every participant's live ledger_end matches the snapshot manifest. *A cloned instance preserves cryptographic node identities and active contracts from the snapshot while isolating its listening ports under the new instance window.* | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `doctor [-f \| -c ] [--name ] [--port-offset ] [--pg-url ] [--check-routing --act-as ] [--format text\|json]` | - | `Preflight Check` | `text` | Evaluates all D1–D10 port, disk, PostgreSQL, and DAR checks without spawning child processes, plus optional live multi-party routing readiness (--check-routing --act-as) (0=ok, 2=preflight fail). | | `status / env / list [--name ] [--format text\|json]` | - | `Registry & Env` | `text` | Prints probe-verified endpoint states (canton-rs.status/1), eval-ready shell exports, or all registered instances. | | `remove --name [--dry-run] [--force] [--format text\|json]` | - | `Clean Teardown` | - | Stops the target instance and deletes its state directory, dedicated PostgreSQL schemas, and Prometheus file_sd targets. | | `snapshot [--name ] --out [--quiesce-timeout-secs 30] [--token-env \| --token-file ] [--format text\|json]` | - | `Snapshot Bundle` | - | Drains in-flight work, writes a SHA-256 verified mode-0600 .tar bundle of file/PG stores, and resumes the source cluster. | | `restore --name --from [--port-offset ] [--pg-url ] [--force]` | - | `Atomic Restore` | - | Verifies binary version, SHA-256 digests, and post-boot ledger_end offsets with automatic backup rollback on failure. | ### Example 3: Capturing a Seeded Snapshot, Forking a Clone & Rewinding State ```bash # 1. Save a quiesced mode-0600 snapshot of dev1 (dev1 automatically resumes afterward) oltenrs daemon snapshot --name dev1 --out /tmp/dev1-seeded.tar # 2. Clone that exact ledger state into a new isolated instance (dev1-fork at offset +1000) oltenrs daemon restore --name dev1-fork --from /tmp/dev1-seeded.tar --port-offset 1000 # 3. Rewind running instance dev1 back to the seeded checkpoint (--force required while active) oltenrs daemon restore --name dev1 --from /tmp/dev1-seeded.tar --force ``` > **TIP — Overwriting a Running Instance (--force) & --with-sample-dar Snapshots**: To prevent accidental data loss, restore refuses to overwrite a running target instance by default. Pass --force to rewind an active instance, or specify a new --name (such as --name dev1-fork) to spin up a parallel clone. Manifests generated with daemon init --with-sample-dar work directly with daemon snapshot, daemon restore, and simulate --from-snapshot without rewriting DAR paths. --- # LocalNet DX (2): Party-Scoped Projections & Loopback Dev Auth - URL: https://doc.oltenrs.dev/?lang=en#daemon-inspect-auth - Group: Daemon & Operations - Command: `oltenrs daemon [--name ] [OPTIONS]` Inspect and diff active contracts and transaction effect trees strictly from a chosen party's visibility scope without hand-writing JSON filter payloads, and issue loopback-scoped development JWTs with live participant authorization. ## 1. Party-Scoped Active Contracts & Transaction Effect Trees (contracts · tx) On a Canton ledger, the exact same transaction reveals different contracts and sub-events depending on whether the querying party is a signatory, an observer, or an unrelated third party. daemon contracts and daemon tx let you inspect what a specific --party can see directly from the terminal without assembling raw HTTP JSON filter bodies. Point commands at a named instance via --name (automatically selecting the first participant, or pass --participant on multi-participant stacks), or pass --url http://host:port to inspect any standalone participant. Shared connection flags (--name, --state-dir, --url, --participant, --token-env, --token-file) are global and accepted either before or after the subcommand (for example, both daemon contracts --name dev1 ls ... and daemon contracts ls --name dev1 ...). *Five-Step Terminal Debugging Flow for Party-Scoped Ledger State* | Command | Underlying Standard API | Output & Primary Debugging Role | | --- | --- | --- | | daemon contracts ls | POST /v2/state/active-contracts | Lists active contracts visible to --party at --at (defaults to ledger end) sorted by CID, including signatories, observers, and payload (--template filter supported) | | daemon contracts watch | WS /v2/updates (ACS_DELTA) | Streams live contract creations (+ cid) and archives (- cid) line by line; pressing Ctrl-C drains cleanly and exits 0 | | daemon tx ls | POST /v2/updates range scan | Summarizes updates witnessed by --party across (--from, --to] (offset, updateId, commandId, event count, template set) | | daemon tx replay --id | POST /v2/updates/update-by-id (LEDGER_EFFECTS) | Reconstructs the parent-child choice execution tree and optional interface views (--interface) visible to --party as indented text or JSON | | daemon tx explain --id | Cross-party LEDGER_EFFECTS projection | Builds an event (row) × party (column) visibility matrix explaining each visible cell via 6 reasons (signatory, observer, actor, choice-observer, witness-by-ancestor, divulged) | ### Example 1: Filtering Active Contracts -> Live Deltas -> Replaying & Explaining Visibility ```bash # 1. Query active contracts for Alice filtered by template (#package-name:Module:Template) oltenrs daemon contracts ls --name dev1 --party Alice \ --template "#sample-contract:AssetHolding:AssetHolding" --format json # 2. Stream real-time contract creates (+) and archives (-) visible to Alice oltenrs daemon contracts watch --name dev1 --party Alice # 3. Locate an updateId, replay its choice tree, and explain cross-party visibility reasons oltenrs daemon tx ls --name dev1 --party Alice --from 0 oltenrs daemon tx replay --name dev1 --id --party Alice oltenrs daemon tx explain --name dev1 --id --parties Alice,Bob,Carol ``` ## 2. Semantic Projection Diffing Across Runtimes (daemon tx diff) When validating a cutover from JVM Canton or checking contract upgrades in CI, running the identical Daml scenario twice produces different recordTime timestamps, offsets, updateIds, party namespace fingerprints, and V12 contract ID hashes — rendering plain text diff unusable. daemon tx diff compares two ScenarioCapture JSON files (assembled from per-step, per-party tx replay captures such as scripts/oracle-projection-diff.sh) after normalizing run-specific identifiers (alpha-renaming contract IDs in encounter order c0, c1, ... and mapping party fingerprints to logical names) while comparing every semantic ledger effect. - **Volatile Metadata Stripped During Normalization**: Removes only run-dependent transport fields: offset, updateId, recordTime, commandId, workflowId, literal synchronizerId strings, and traceContext. - **Semantic Fields Strictly Compared**: Verifies exact equality across templateId, createArgument, choice, choiceArgument, exerciseResult, signatories, observers, witnessParties, consuming flags, interfaceViews, and parent-child event tree order. ### Example 2: Comparing a oltenrs Scenario Capture Against an Official Oracle Capture ```bash # Verify 100% semantic LEDGER_EFFECTS parity across all scenario steps and parties (exit 3 on diff) oltenrs daemon tx diff ./captures/canton-rs-dvp.json ./captures/jvm-oracle-dvp.json --format json ``` > **IMPORTANT — Guarantees — Oracle Projection Equivalence & Non-Party Privacy Check**: If even one contract argument or witnessParties set differs — or if an unrelated third-party projection is non-empty — daemon tx diff exits immediately with code 3 (exit 3) and prints the exact mismatch tuple ((step_index, party, json_path, left_value, right_value)). ## 3. Loopback Dev Auth & Single-Command Party JWTs (--dev-auth · creds) Developing locally with JWT authentication completely disabled often hides missing actAs/readAs claims or token-refresh bugs until staging or production deployment. Passing --dev-auth to daemon up enables real participant JWT enforcement without standing up an external OIDC server by generating an instance-local 256-bit OS CSPRNG secret (dev-jwt.key, mode 0600). Running oltenrs daemon creds then performs two steps in one command: (1) grants --user live CanActAs + CanReadAs rights for --party on the target participant, and (2) signs a short-lived Bearer JWT (--ttl, up to 24h) bound to that participant's audience (aud). - **Zero-Config Integration with Built-In CLI Commands**: When targeting a --dev-auth instance via oltenrs token --name , daemon contracts --name , or daemon tx --name , the CLI signs local requests automatically so you do not need to paste --token flags manually. - **Use daemon creds for Custom Apps, SDKs & curl**: Mint explicit tokens via daemon creds when testing your own TypeScript, Python, Java, or Rust backend or testing token-expiry handling (e.g., --ttl 15m). Raw key bytes in dev-jwt.key are never printed in logs, argv, daemon status, or daemon inspect. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `contracts ls [--name ] --party

[--template ] [--at ] [--participant ] [--url ] [--token-env \| --token-file ] [--format text\|json]` | - | `ACS Query` | `text` | Lists active contracts visible to --party at the target offset sorted deterministically by contract ID. | | `contracts watch [--name ] --party

[--template ] [--from ] [--token-env \| --token-file ] [--format text\|json]` | - | `WS Stream` | `text` | Subscribes to WebSocket /v2/updates and prints live contract creation (+) and archive (-) deltas. | | `tx ls [--name ] --party

[--template ] [--from ] [--to ] [--token-env \| --token-file ] [--format text\|json]` | - | `Update Scan` | `text` | Lists transaction summaries visible to --party within the offset interval (from, to]. | | `tx replay [--name ] --id --party

[--interface ] [--token-env \| --token-file ] [--format text\|json]` | - | `Effect Tree` | `text` | Reconstructs the party-scoped LEDGER_EFFECTS event tree and optional interface views for one update. | | `tx explain [--name ] --id [--parties ] [--participant ] [--url ] [--token-env \| --token-file ] [--format text\|json]` | - | `Visibility Matrix` | `text (all parties)` | Builds an event × party visibility matrix for a committed update explaining each visible cell with 6 reasons (signatory, observer, actor, choice-observer, witness-by-ancestor, divulged). | | `tx diff [--format text\|json]` | - | `Oracle Diff` | `text` | Normalizes volatile identifiers across two scenario captures and diffs party-scoped ledger effects (exit 3 on diff). | | `creds [--name ] [--participant ] [--user ] [--party

] [--ttl ] [--format text\|json]` | - | `Dev JWT` | `participant_admin / 1h` | Grants live party rights on a loopback --dev-auth participant and issues a scoped HS256 Bearer JWT (max 24h). | ### Example 3: Booting with --dev-auth, Minting an Alice JWT & Calling Protected Endpoints ```bash # 1. Boot a loopback-bound instance with real JWT enforcement enabled oltenrs daemon up -f canton-daemon.yaml --name dev1 --dev-auth -d eval "$(oltenrs daemon env --name dev1)" # 2. Authorize Alice rights (CanActAs + CanReadAs) and mint a 1-hour Bearer JWT (canton-rs.dev-creds/1) TOKEN=$(oltenrs daemon creds --name dev1 --party Alice --ttl 1h --format json | jq -r .token) # 3. Call auth-protected Ledger API v2 endpoints from curl or an external client SDK (default template exports CANTON_RS_PARTICIPANT1_JSON_URL) curl -s "$CANTON_RS_PARTICIPANT1_JSON_URL/v2/authenticated-user" \ -H "Authorization: Bearer $TOKEN" | jq ``` > **WARNING — Can --dev-auth Be Used When Binding Nodes to External Interfaces (0.0.0.0)?**: No — it fails closed by design. To prevent development symmetric keys from ever guarding network-exposed listeners, both daemon up --dev-auth and daemon creds immediately abort with exit code 2 (exit 2) if any service or metrics listener binds outside loopback (127.0.0.1, ::1, localhost). Configure production JWKS or asymmetric keys (ES256–512 / RS256) whenever binding non-loopback interfaces. --- # Live Console & Canton REPL (console) - URL: https://doc.oltenrs.dev/?lang=en#console - Group: Daemon & Operations - Command: `oltenrs console '> [--state-dir

] | oltenrs console --participant ` Attach directly to a running daemon over daemon.sock without specifying host ports and execute standard Canton console expressions or existing .canton scripts. ## Auto-Binding via daemon.sock (attach / exec) oltenrs console attach discovers every running participant, sequencer, and mediator over daemon.sock and binds them into the @ prompt automatically. Typing exit closes only the console session, leaving background daemons running uninterrupted. oltenrs keeps monitoring and archiving features inside daemon top, db, and dar so the @ console remains strictly compatible with existing .canton operational scripts. ### Interactive console attach and single-expression exec ```bash # 1. Attach to the active cluster without specifying ports $ oltenrs console attach Attached to oltenrs daemon (sequencer1, mediator1, participant1, participant2) @ participant1.ledger_api.state.end() 1482 @ participant1.dars.upload("contracts/target/sample-contract.dar") "0fe75100..." @ val bob = participant1.ledger_api.parties.allocate("bob").party @ health.status() @ exit # 2. Evaluate a single expression from CI or shell automation $ oltenrs console exec 'participant1.ledger_api.parties.list().size' # 3. Attaching to a --name instance requires --state-dir (console attach does not take --name) $ oltenrs console attach --state-dir "${XDG_STATE_HOME:-$HOME/.local/state}/canton-rs/instances/dev1" ``` > **NOTE — Attaching to a --name Instance via --state-dir**: console attach and console exec (as well as daemon attach / daemon exec) locate daemon.sock via --state-dir (default: canton-rs-state) rather than --name. To attach to a named instance such as dev1, pass --state-dir "${XDG_STATE_HOME:-$HOME/.local/state}/canton-rs/instances/dev1". ## Direct Standalone Node Connection (--participant) When running individual nodes without the supervisor, use --participant to point the console at an explicit host and port with --eval or --script. ### Run commands against an explicit participant endpoint ```bash oltenrs console \ --participant participant1=127.0.0.1:7575 \ --eval 'val pkg = participant1.dars.upload("contracts/target/sample-contract.dar"); println(pkg)' oltenrs console --participant p1=127.0.0.1:7575 --script ./setup.canton ``` --- # Hands-On Network Labs (5 Scenarios) - URL: https://doc.oltenrs.dev/?lang=en#hands-on-labs - Group: Daemon & Operations - Command: `oltenrs daemon init --template [--with-sample-dar]` Reproduce multi-party DvP contract isolation, 4-node BFT failover, multi-domain bridging, a single-organization production stack, and the full LocalNet DX workflow locally in a few commands. ## Lab 1. 6-Node Multi-Party DvP & Non-Participant ACS Visibility Demo Run an interactive demo showing that a non-participant third party connected in the local Rust cluster does not see unrelated contracts in its ACS queries (this is an API-query check, not a wire/storage zero-knowledge proof). The enterprise-dvp template provisions 6 nodes across 5 strictly isolated cells. ### Boot cluster → verify privacy isolation → inspect via TUI X-Ray ```bash oltenrs daemon init --template enterprise-dvp -o /tmp/lab-dvp.yaml --force oltenrs daemon config -f /tmp/lab-dvp.yaml oltenrs daemon up -f /tmp/lab-dvp.yaml --state-dir /tmp/crs-lab-dvp -d # Commit BankA-SecB DvP trade and verify BankC ACS count == 0 oltenrs daemon scenario run dvp-privacy-proof --state-dir /tmp/crs-lab-dvp # Switch group views ([g]) and inspect [SEALED] X-Ray traces ([x]) in daemon top oltenrs daemon top --state-dir /tmp/crs-lab-dvp oltenrs daemon down --state-dir /tmp/crs-lab-dvp --clean-files ``` ## Lab 2. 4-Node BFT Consensus Cluster & Fault Recovery Confirm that out of 4 BFT sequencers (N=4), taking 1 offline (f=1) leaves the remaining 3-of-4 quorum committing transactions without interruption. ### Start 4-node BFT → stop sequencer 4 → verify uninterrupted commits ```bash oltenrs daemon init --template bft-cluster -o /tmp/lab-bft.yaml --force oltenrs daemon up -f /tmp/lab-bft.yaml --state-dir /tmp/crs-lab-bft -d oltenrs daemon scenario run bft-quorum-burst --state-dir /tmp/crs-lab-bft # Stop the 4th sequencer cell and commit 5 sequential batches under a 3/4 quorum oltenrs daemon stop @bft-spare --state-dir /tmp/crs-lab-bft oltenrs daemon scenario run bft-quorum-burst --state-dir /tmp/crs-lab-bft oltenrs daemon start @bft-spare --state-dir /tmp/crs-lab-bft oltenrs daemon down --state-dir /tmp/crs-lab-bft --clean-files ``` ## Lab 3. Multi-Domain Bridge (usd-sync ↔ eur-sync) Launch separated synchronizer domains (usd-sync and eur-sync) connected by a bridge participant capable of multi-synchronizer contract reassignment. ### Start multi-domain cluster and inspect by SyncDomain ```bash oltenrs daemon init --template multi-domain -o /tmp/lab-md.yaml --force oltenrs daemon up -f /tmp/lab-md.yaml --state-dir /tmp/crs-lab-md -d # Press [g] inside daemon top to toggle tree grouping by SyncDomain oltenrs daemon top --state-dir /tmp/crs-lab-md oltenrs daemon down --state-dir /tmp/crs-lab-md --clean-files ``` ## Lab 4. Single-Organization Stack & Health/Metrics Verification In single-organization production deployments, your manifest connects to an external consortium sequencer URL and manages only your participant, PQS, and Splice services by profile. ### Generate org-production manifest → validate config → probe /readyz and /metrics ```bash # 1. Generate a single-org stack and validate against the consortium sequencer URL oltenrs daemon init --template org-production -o ./canton-daemon.yaml --force CONSORTIUM_SEQUENCER_URL=http://10.20.30.40:5018 oltenrs daemon config -f ./canton-daemon.yaml # 2. Boot with loopback metrics binding (add --metrics-bind 0.0.0.0 explicitly only when required) oltenrs daemon up -f ./canton-daemon.yaml -d curl -s http://127.0.0.1:9464/readyz curl -s http://127.0.0.1:9464/metrics | grep canton_rs_node_up ``` *Connect the exposed :9464/metrics endpoint directly to the Prometheus & Grafana configuration shown in the Supervisor guide.* ## Lab 5. Full LocalNet DX Lifecycle (doctor · snapshot · contracts/tx · token) Walk through the complete single-host developer lifecycle: D1–D10 preflight, named instance isolation, dev JWT issuance, party allocation, CIP-0112 Token V2 minting and balances, projection queries, snapshot cloning, and clean removal. ### Preflight → named boot → dev JWT/contracts → snapshot clone → teardown ```bash # 1. Generate localnet manifest and run preflight socket checks oltenrs daemon init --template localnet -o /tmp/lab-dx.yaml --force oltenrs daemon doctor -f /tmp/lab-dx.yaml --name dx1 --port-offset 0 # 2. Boot with --dev-auth and --observability, then bind env vars oltenrs daemon up -f /tmp/lab-dx.yaml --name dx1 --port-offset 0 --dev-auth --observability -d eval "$(oltenrs daemon env --name dx1)" TOKEN=$(oltenrs daemon creds --name dx1 --format json | jq -r .token) # 3. Allocate parties (token does not create parties; localnet template exports CANTON_RS_PARTICIPANT1_JSON_URL) for HINT in Admin Alice; do curl -s -X POST "$CANTON_RS_PARTICIPANT1_JSON_URL/v2/parties" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "{\"partyIdHint\": \"$HINT\", \"identityProviderId\": \"\"}" done # 4. Mint a test token → check balance and contracts (Amulet faucet is Splice DevNet only — see “Tokens & Settlement”) oltenrs token create --name dx1 --instrument USDX --admin Admin --dar references/splice/daml/dars/splice-test-token-v2-1.0.2.dar oltenrs token mint --name dx1 USDX Alice 100.0 --admin Admin oltenrs token balance --name dx1 Alice USDX oltenrs daemon contracts ls --name dx1 --party Alice --format json # 5. Snapshot and restore into a +1000 port window, then clean both instances oltenrs daemon snapshot --name dx1 --out /tmp/dx1-snap.tar oltenrs daemon restore --name dx2 --from /tmp/dx1-snap.tar --port-offset 1000 --force oltenrs daemon remove --name dx1 --force oltenrs daemon remove --name dx2 --force ``` --- # Shadow Verification & Non-Disruptive Cutover - URL: https://doc.oltenrs.dev/?lang=en#migration - Group: Migration & DB - Command: `oltenrs daemon [up] -c [--bootstrap ] [OPTIONS]` Read your existing canton.conf and bootstrap.sc files directly, compare results side by side on offset ports against a running JVM hub, and cut over cleanly. ## HOCON Parsing & Read-Only Shadow Verification oltenrs includes an embedded HOCON parser that resolves include directives, array appends (+=), and variable substitutions (${_shared.*}) and reports supported versus unsupported keys at startup. Pass --strict-config to abort immediately if any unsupported key is present. To validate without disturbing live nodes, combine --port-offset, --same-identity, and --state-in-files. > Diagram — **Side-by-side topology with --port-offset**: Default port assignments alongside +20000 port mappings and database access modes. > **IMPORTANT — Does --shadow-verify write to the existing production database?**: When paired with --state-in-files, oltenrs only reads parties, DARs, Active Contract Set (ACS) state, and cryptographic keys from the existing PostgreSQL database. Its own runtime state is isolated to local files under --state-dir so the live database stays untouched. ## Shadow Verification & Production Cutover Examples ### Example 1: Side-by-side shadow verification on +20000 offset ports ```bash oltenrs daemon \ -c ./deploy/canton.conf \ --bootstrap ./deploy/bootstrap.sc \ --state-in-files \ --state-dir /tmp/oltenrs-beside \ --conf-auth-cert ./deploy/auth/jwt.crt \ --port-offset 20000 \ --same-identity \ --shadow-verify ``` ### Example 2: Detached production launch with --strict-config and JSON logs ```bash oltenrs daemon up \ -c ./deploy/canton.conf \ --bootstrap ./deploy/bootstrap.sc \ --state-dir ./canton-rs-state \ --log-encoder json \ --strict-config \ -d ``` ## daemon -c Key Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `-c, --config ` | `CANTON_RS_CANTON_CONF` | `PathBuf` | - | Path to the official HOCON configuration file defining nodes, ports, PostgreSQL, and auth settings. | | `--bootstrap ` | - | `PathBuf` | - | Bootstrap script parsed statically for synchronizer connections (connect_local/connect_bft) and ping checks. | | `--port-offset ` | - | `u16` | `0` | Offset added uniformly to every configured port (JSON, gRPC, Admin, Sequencer, and Mediator). | | `--same-identity / --shadow-verify` | - | `bool` | `false` | Load keys from common_crypto_private_keys in PostgreSQL to assume the same node identity; --shadow-verify compares live JVM vs Rust participant ledger_end offsets (not full ACS/Root Hash). | | `--state-in-files` | - | `bool` | `false` | Keep auxiliary runtime state exclusively in local files under --state-dir instead of creating database state tables. | | `--strict-config` | - | `bool` | `false` | Fail immediately on unsupported HOCON keys instead of logging a warning. | | `--log-encoder ` | - | `Enum` | `text` | Log format; json mode emits structured W3C traceparent and ApiRequestLogger fields. | | `--shadow-jvm-url / --metrics-port / --metrics-bind ` | - | `URL / u16 / String` | `metrics-bind: 127.0.0.1` | Reference JVM participant JSON API URL for --shadow-verify comparisons and the supervisor Prometheus (/metrics) bind port and host. | | `--token-env / --token-file ` | - | `String / PathBuf` | - | Supply a Bearer JWT via environment variable or file for authenticated participant probes and Ping checks in -c mode. | --- # DB Migrations & History Archiving (db) - URL: https://doc.oltenrs.dev/?lang=en#db - Group: Migration & DB - Command: `oltenrs db [OPTIONS]` Run embedded Flyway schema migrations, take over existing participant databases, and archive aged ledger history into signed hash-chain segments before pruning. ## Archiving Ledger History Before Pruning As a ledger matures, spent contract history rapidly grows inside PostgreSQL. Without extracting aged offset ranges prior to physical pruning, reconstructing point-in-time Active Contract Set (ACS) proofs later becomes impossible. oltenrs db archive exports PostgreSQL ledger history (--jdbc-url, including contract bodies, templates, and stakeholders) or offline JSONL history (--from-history) into fsynced segment files (.crs-seg.json) with SHA-256 hash chains (prev_segment_sha256), contiguous offset validation, and Ed25519 signatures (--signing-key-file). With --prune-after-archive enabled, pruning runs only when archiving directly from PostgreSQL (--jdbc-url) across contiguous offsets 1..=up-to with contract bodies and signing, and passing participant safe-pruning horizon checks (refused with --from-history or --zero-payload; segment-to-DB restore is not yet implemented and replay computes a self-verified SHA-256 digest). ### Four-stage segment replay (oltenrs db replay) 01 · Chain & Sig. **Hash Chain & Signature Check** — Verify prev_segment_sha256 continuity from offset 1 (or expected start) along with Ed25519 signatures (use db verify-archive --expected-signer-hex to pin an expected public key). 02 · Surface Index. **Template Distribution Scan** — Aggregate create and archive counts across modules and templates within the replayed range. 03 · ACS Execution. **Deterministic ACS Reconstruction** — Apply activations and archival events in BTreeMap order to rebuild the ACS (partial archives do not report COMPLETE). 04 · Digest Hash. **Internal SHA-256 Hash Calculation** — Compute an internal SHA-256 state hash across reconstructed contracts (not equal to Canton ACS commitment). *Note: --zero-payload (redacted bodies) and --from-history (offline JSONL) exports are refused by --prune-after-archive.* > **WARNING — When does --prune-after-archive refuse to prune?**: --prune-after-archive requires archiving directly from PostgreSQL (--jdbc-url) across contiguous offsets 1..=up-to with intact contract bodies, Ed25519 signing (--signing-key-file), and participant safe-pruning horizon checks (ACS digest checkpoint, commitment matching, deduplication window). Safety guards reject --prune-after-archive whenever --from-history or --zero-payload is set. ## Migration, History Archive & Storage TUI Examples ### 1. Apply embedded Flyway schema and inspect storage headroom (db stats) ```bash # Apply embedded official Flyway migrations (use PGPASSWORD or --password-file to avoid argv exposure) export PGPASSWORD="canton" oltenrs db migrate \ --jdbc-url "jdbc:postgresql://127.0.0.1:5432/participant_db?currentSchema=public" \ --role participant \ --migrate-and-start # Inspect pg_class.reltuples estimates, table sizes, and safe-prunable headroom oltenrs db stats \ --jdbc-url "postgres://canton@127.0.0.1:5432/participant_db" \ --password-file ./pg.pass \ --archive-dir ./cold-archive ``` ### 2. PostgreSQL cold archive (+prune) & offline JSONL archive → verify, replay & db tui ```bash # Export signed segments directly from PostgreSQL (--jdbc-url) and prune only after safe-to-prune checks oltenrs db archive \ --jdbc-url "postgres://canton@127.0.0.1:5432/participant_db" \ --password-file ./pg.pass \ --archive-dir ./cold-archive \ --up-to-offset 500 \ --signing-key-file ./archive-ed25519.key \ --prune-after-archive # (Optional) Offline JSONL export without PostgreSQL (--from-history cannot be combined with --prune-after-archive) # oltenrs db archive --from-history ./participant-history.jsonl --archive-dir ./cold-archive-jsonl --up-to-offset 500 --signing-key-file ./archive-ed25519.key # Verify hash chain & pinned signer key, then run 4-stage internal replay oltenrs db verify-archive --archive-dir ./cold-archive --expected-signer-hex oltenrs db replay --archive-dir ./cold-archive --up-to-offset 500 # Open the 3-tab storage TUI (specifying --archive-dir alone opens offline audit mode) oltenrs db tui --archive-dir ./cold-archive ``` > **NOTE — Concurrent write guards (DDL_LOCK & WriterLock)**: db migrate --migrate-and-start, db takeover, and pruning acquire a Purpose 33 WriterLock first so active workers cannot collide. db takeover refuses empty databases without an official schema and does not migrate in-flight submission or commitment states. ## db Subcommands & Key Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `migrate --jdbc-url [--password-file ] --role [--migrate-and-start]` | `PGPASSWORD` | `Flyway Engine` | `role: participant` | Inspect schema status or acquire WriterLock first and apply pending Flyway SQL migrations for the specified node role. | | `stats [--jdbc-url ] [--password-file ] [--archive-dir ] [--json]` | `PGPASSWORD` | `Diagnostics` | - | Display pg_class.reltuples estimates, disk usage, shared safe-prunable headroom, and archive segment chain health. | | `archive --up-to-offset [--archive-dir ] [--jdbc-url \| --from-history ] [--password-file ] [--signing-key-file ] [--zero-payload] [--prune-after-archive] [--json]` | `PGPASSWORD` | `Cold Export` | `archive-dir: ./cold-archive` | Export an offset range into fsynced signed hash-chain segments; --prune-after-archive requires a direct --jdbc-url export covering 1..=up-to with contract bodies (no --from-history or --zero-payload), signing, and safe-to-prune checks. | | `verify-archive [--archive-dir ] [--expected-signer-hex ] [--json]` | - | `Verify` | `archive-dir: ./cold-archive` | Validate SHA-256 hash chains and Ed25519 signatures across segments, optionally pinning the expected 64-hex signer public key with --expected-signer-hex (--expected-signer-key-hex alias also accepted). | | `replay [--archive-dir ] [--up-to-offset ] [--json]` | - | `Replay` | `archive-dir: ./cold-archive` | Execute deterministic 4-stage replay over Cold Archive segments and output reconstructed ACS counts and an internal SHA-256 state digest. | | `tui (alias: top) [--jdbc-url ] [--password-file ] [--archive-dir ]` | `PGPASSWORD` | `Interactive TUI` | - | Open the 3-tab storage, archive segment, and internal replay inspection TUI. | | `takeover --jdbc-url [--password-file ] [--prune-offset ] [--archive-cid --unsafe-offline-archive]` | `PGPASSWORD` | `DB Takeover` | - | Verify locks and official schema on an existing database before takeover and safe-horizon pruning (--archive-cid requires --unsafe-offline-archive). | | `pqs --pg-url [OPTIONS]` | `CANTON_RS_PQS_PG_URL` | `PQS Projection` | - | Synchronize, query active contracts/exercises, and prune the Participant Query Store (PQS) PostgreSQL projection (see the PQS guide for full options). | --- # Ledger API v2 (node json-api · node ledger-api) - URL: https://doc.oltenrs.dev/?lang=en#ledger-api - Group: Nodes & Ledger API - Command: `oltenrs node json-api [OPTIONS] | oltenrs node ledger-api [OPTIONS]` Serve both the HTTP/WebSocket Ledger API v2 (node json-api) for backend apps and Wallet SDKs and a standalone gRPC server (node ledger-api), or expose HTTP, gRPC, and Admin ports from a single shared-memory process. ## node json-api: HTTP, WebSocket v2 & Auth Run standalone without a sequencer during early contract development, attach --sequencer during integration, and point --canton-conf at production PostgreSQL and enterprise JWKS providers when hardening for release. - **RFC 6455 WebSocket streaming**: Streams /v2/updates, /v2/updates/flats, /v2/updates/trees, /v2/state/active-contracts, and /v2/commands/completions directly over the same HTTP port without a sidecar proxy. - **JWKS key rotation & multi-algorithm JWTs**: Validates HS256, RS256, ES256, ES384, and ES512 signatures, remote JWKS endpoints, aud claims, and token lifetime bounds. - **Interactive External Submission & Traffic Cost Estimation**: Exposes /v2/interactive-submission/prepare and execute so external wallets or HSMs can sign canonical hashes directly. prepare parses estimateTrafficCost hints (expectedSignatures required; disabled: true returns costEstimation: null) and estimates integer byte traffic costs (request, response, total) within 1% of official sequencer charges when traffic control (τ) is enabled. - **Single-process HTTP + gRPC + Admin**: Enabling --grpc-port and --admin-port shares one in-memory ledger state and offset stream across every protocol endpoint. ### Expose Wallet SDK HTTP + gRPC/Admin + CantonExEx together ```bash oltenrs node json-api \ --port 7575 \ --grpc-port 6501 \ --admin-port 6502 \ --jwt-hmac-secret unsafe \ --jwt-audience https://canton.network.global \ --jwt-max-lifetime-seconds 86400 \ --scan-history canton-rs-state/scan.jsonl \ --exex-jsonl canton-rs-state/exex-events.jsonl ``` *Increase --jwt-max-lifetime-seconds above the 300s default when accepting self-signed tokens generated by the Wallet SDK.* ### Bind ports, PostgreSQL, and RS256 public key from canton.conf ```bash oltenrs node json-api \ --canton-conf ./deploy/canton.conf \ --conf-participant participant1 \ --conf-auth-cert ./deploy/auth/jwt.crt \ --conf-port \ --with-grpc \ --conf-port-offset 20000 ``` > **WARNING — Fail-closed guard when auth certificates fail to load**: When token verification is configured but the certificate file cannot be read, oltenrs aborts startup rather than opening an unauthenticated port. ## node ledger-api: Standalone gRPC v2 Server (TLS · mTLS) Standalone gRPC-only Ledger API v2 server (default port 6865) supporting server TLS and mutual TLS (mTLS) client certificate verification. ### Launch standalone gRPC ledger server with mTLS ```bash oltenrs node ledger-api \ --host 0.0.0.0 \ --port 6865 \ --dar contracts/target/sample-contract.dar \ --tls-cert ./certs/server.crt \ --tls-key ./certs/server.key \ --tls-client-ca ./certs/client-ca.crt ``` ## node json-api & node ledger-api Key Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `-H, --host / -p, --port ` | - | `String / u16` | `json: 7575 / grpc: 6865` | Bind address and listening port for the API server. | | `--grpc-port / --admin-port (--with-grpc / --with-admin-api)` | - | `u16 / bool` | - | [node json-api] Co-host gRPC Ledger API v2 and Admin gRPC ports against the same ledger state. | | `--jwt-hmac-secret / --jwt-hmac-secret-file / --jwt-audience / --jwt-audience-self / --jwt-max-lifetime-seconds ` | - | `String / PathBuf / bool / i64` | `max-lifetime: 300` | Configure Bearer token HMAC secret (prefer mode-0600 --jwt-hmac-secret-file), static aud claim or dynamic participantId audience binding (--jwt-audience-self), and maximum token TTL in seconds. | | `--tls-cert / --tls-key / --tls-client-ca` | - | `PathBuf` | - | [node ledger-api] Paths to server PEM certificate, PKCS#8 private key, and root CA for mTLS client verification. | | `--canton-conf / --conf-participant / --conf-auth-cert / --auth-cert ` | `CANTON_RS_CANTON_CONF` | `PathBuf / String` | - | Apply RS256 public certificate JWT verification via canton.conf or standalone (--auth-cert). When auth is enabled, /metrics, /_telemetry, /_xray, and /_exex also require an admin JWT (/health remains public). | | `--xray / --traffic-enforcement / --max-dedup-seconds ` | - | `bool / u64` | `false / 604800` | --xray enables participant-local estimated X-Ray recording (also toggleable via admin POST /_xray); controls /v2/traffic/* metering and dedup retention. | | `--otel-endpoint / --otel-sample-ratio-bps / --otel-max-queue-size ` | `OTEL_EXPORTER_OTLP_ENDPOINT / CANTON_RS_OTEL_SAMPLE_RATIO_BPS / CANTON_RS_OTEL_MAX_QUEUE_SIZE` | `URL / u16 / usize` | `off / 10000 / 2048` | [node json-api] Pure-Rust OTLP/HTTP OpenTelemetry trace export (zero-overhead no-op when unset) with deterministic basis-points sampling (0..=10000; error spans always sampled) and a bounded non-blocking batch queue. | | `--exex-jsonl [--exex-party ] [--exex-zero-payload] [--exex-from-offset ]` | - | `PathBuf / Vec / bool / i64` | - | Stream stakeholder-scoped local/remote commits to 0600 JSONL (zero-payload uses instance-salted HMAC digests) and expose metrics on GET /_exex. | | `--scan-history / --store / --pg-url / --snapshot-every ` | `CANTON_RS_PG_URL` | `PathBuf / URL / u64` | - | Set output locations for Scan-compatible history (.jsonl, .auth) and standalone ledger state snapshots. | > **NOTE — Legacy Top-Level Aliases (v0.9.0 → v1.0.0)**: Legacy top-level forms (such as oltenrs json-api, oltenrs ledger-api, and oltenrs participant) remain available in v0.9.0 as hidden deprecated aliases that print a warning to stderr (suppressible via CANTON_RS_NO_DEPRECATION_WARNINGS=1). They are scheduled for removal in v1.0.0; use canonical oltenrs node commands in new scripts and deployments. --- # Standalone Protocol Nodes (node participant · node sequencer · node mediator) - URL: https://doc.oltenrs.dev/?lang=en#nodes - Group: Nodes & Ledger API - Command: `oltenrs node participant | oltenrs node sequencer <...> | oltenrs node mediator <...>` Run participant, sequencer, and mediator roles as dedicated standalone processes under oltenrs node and join existing BFT synchronizer clusters. ## 1. node participant: Participant & Multi-Synchronizer Reassignment A participant connects to one or more synchronizers, decomposes transactions into Blinded Merkle Views, and validates local views. Pass --also-sequencer to connect multiple synchronizers concurrently for Unassign/Assign contract reassignment while exchanging LtHash16Blake3 ACS Commitments with counter-participants. ### Connect concurrently to two synchronizers (sync0, sync1) ```bash oltenrs node participant run \ --participant-id participant1 \ --port 7575 \ --dar contracts/target/sample-contract.dar \ --sequencer http://127.0.0.1:5018 \ --sequencer-alias sync0 \ --also-sequencer sync1=http://127.0.0.1:5118 \ --state-dir canton-rs-state/p1-multi \ --exex-jsonl canton-rs-state/p1-exex.jsonl ``` *Once running, move contracts between synchronizers via POST /v2/commands/submit-and-wait-for-reassignment.* > **TIP — When should I run standalone node subcommands vs. daemon up?**: Use the standalone node participant, node sequencer, and node mediator subcommands when an external orchestrator such as Kubernetes or systemd manages each container or process individually. Use daemon up when managing multiple nodes together in dependency order on one host with integrated daemon top monitoring. ## 2. node sequencer: Sequencer & Compatible BFT Orderer The sequencer orders encrypted envelopes globally and stamps monotonic microsecond timestamps. In addition to standalone run mode, it implements Narwhal batch availability proofs, ISS parallel PBFT segments, and BlockReorderer deterministic ordering to join existing Scala BFT clusters via bft-peer without forking. ### Four-stage BFT consensus and deterministic time assignment 01 · Availability. **Batch Dissemination & Availability Certificates** — Broadcast encrypted batches to peer sequencers and collect quorum signatures to guarantee data availability. 02 · Consensus (ISS). **Segment Consensus & View Change** — Finalize block ordering across parallel PBFT segments with leader rotation on stalled views. 03 · BlockReorderer. **Intra-Block Deterministic Request Ordering** — Order requests deterministically within each block: confirmation responses, submissions, commits, then topology updates. 04 · BftTime & Tick. **Microsecond Timestamps & Topology Ticks** — Assign strictly monotonic BFT timestamps and emit epoch-end and 250ms-delayed topology ticks. *Consensus state and batches persist across 11 PostgreSQL ord_* tables and obey configured pruning retention windows.* ### Generate identity → join existing BFT cluster as bft-peer ```bash # 1. Generate a new sequencer keypair and onboarding transaction oltenrs node sequencer identity \ --name sequencer2 \ --identity canton-rs-state/seq2-id.bin \ --out canton-rs-state/seq2-onboard.tx # 2. Register the member via the existing synchronizer Admin API oltenrs node sequencer add-sequencer \ --sequencer-url http://127.0.0.1:5018 \ --admin-url http://127.0.0.1:5019 \ --onboarding canton-rs-state/seq2-onboard.tx # 3. Join as a P2P BFT peer (use node sequencer run for standalone mode) oltenrs node sequencer bft-peer \ --config ./deploy/canton.conf \ --node sequencer2 \ --sequencer-url http://127.0.0.1:5018 \ --admin-url http://127.0.0.1:5019 \ --identity canton-rs-state/seq2-id.bin \ --join \ --observe-sequencing \ --public-api 127.0.0.1:5028 \ --state-file canton-rs-state/seq2-bft.state ``` ## 3. node mediator: Blind Two-Phase Commit Coordinator The mediator never inspects contract plaintext; it tallies Confirmation Responses from blinded view participants against transaction Root Hashes, tracks timeouts and quorums, and issues the final Verdict. ### Initialize mediator → register on sequencer → run & query consensus status ```bash oltenrs node mediator init --name mediator1 --state-dir canton-rs-state/med1 oltenrs node mediator onboarding --state-dir canton-rs-state/med1 --out canton-rs-state/med1.tx oltenrs node sequencer add-mediator \ --sequencer-url http://127.0.0.1:5018 \ --admin-url http://127.0.0.1:5019 \ --onboarding canton-rs-state/med1.tx oltenrs node mediator run \ --port 5017 \ --sequencer-url http://127.0.0.1:5018 \ --state-dir canton-rs-state/med1 oltenrs node mediator consensus-status --port 5017 ``` ## node Subcommand Core Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `node participant run --participant-id -p --sequencer [--also-sequencer ]` | `CANTON_RS_STATE_PG_URL` | `Participant` | - | Set participant ID, JSON API port, primary synchronizer, and additional synchronizer connections. | | `node sequencer run --bind -p --name ` | `CANTON_RS_STATE_PG_URL` | `Standalone Seq` | - | Start a standalone sequencer public API server storing events in local files (--state-dir) or PostgreSQL. | | `node sequencer bft-peer --join --observe-sequencing --public-api ` | `CANTON_RS_ORD_PG_URL` | `BFT Peer` | - | Run P2P mTLS BFT ordering with peer sequencers and open the public participant sequencing API. | | `node sequencer >` | - | `Onboarding / Prune` | - | Create or register member onboarding transactions (.tx), or prune sequencer events up to a timestamp. | | `node mediator run --bind -p --sequencer-url [--group ]` | `CANTON_RS_STATE_PG_URL` | `Mediator` | - | Configure the mediator health/consensus port, upstream sequencer URL, and mediator group index (default 0). | > **NOTE — Legacy Top-Level Aliases (v0.9.0 → v1.0.0)**: Legacy top-level forms (oltenrs participant, oltenrs sequencer, oltenrs mediator, oltenrs json-api, and oltenrs ledger-api) remain supported in v0.9.0 as hidden deprecated aliases that emit a stderr warning (suppressible via CANTON_RS_NO_DEPRECATION_WARNINGS=1). They will be removed in v1.0.0; migrate to canonical oltenrs node commands. --- # Splice Apps & Scan Registry (splice · splice scan) - URL: https://doc.oltenrs.dev/?lang=en#splice-scan - Group: Splice & Query - Command: `oltenrs splice ` Host unmodified official Splice DARs in a single process covering Super Validator (SV) governance, Validator onboarding, wallet transfers, automated settlement rounds, and live Scan registry APIs. ## splice serve: Unified Single-Process App Host oltenrs splice serve consolidates the SV app, Validator app, wallet backend, and background automation loop into a single HTTP host (default port 5020) rather than deploying separate JVM app containers. Omit --ledger-host to run against the embedded in-memory ledger engine, or point --ledger-host at an external oltenrs or Scala participant's Ledger API v2. - **Incremental update synchronization**: Polls the participant's /v2/updates feed incrementally before handling requests or running automation ticks so Amulet and transfer contracts created by external Wallet SDK clients stay synchronized. - **Automatic Explicit Disclosure (disclosedContracts)**: Automatically resolves and attaches required createdEventBlob proofs whenever a wallet user exercises contracts owned solely by the DSO (such as AmuletRules or OpenMiningRound). - **Idempotent recovery across restarts**: Rebuilds contract state from the participant ACS on startup while persisting only deduplication keys (tracking_id) and onboarding secrets under --state-dir or PostgreSQL. > Diagram — **Cross-Compatible Interoperability Across Ledger API v2**: Standard Ledger API v2 and Admin v30 boundaries let you mix Rust and Scala implementations across apps and participant nodes. ### Example 1: Run participant (7575) alongside splice serve (5020) ```bash oltenrs node json-api \ --port 7575 \ --jwt-hmac-secret unsafe \ --jwt-audience https://canton.network.global \ --jwt-max-lifetime-seconds 86400 \ --scan-history canton-rs-state/scan.jsonl oltenrs splice serve \ --dar-dir tests/oracle/splice-dars \ --port 5020 \ --ledger-host 127.0.0.1 \ --ledger-port 7575 \ --ledger-auth-unsafe-secret unsafe \ --scan-history canton-rs-state/scan.jsonl \ --automation-interval-ms 5000 \ --state-dir canton-rs-state/splice-meta ``` ### Example 2: Register wallets → Tap mint → TransferOffer, accept, and settle ```bash # 1. Register wallet users and mint test funds via Tap curl -s -X POST http://127.0.0.1:5020/v0/register -H 'Content-Type: application/json' -d '{"username":"alice"}' curl -s -X POST http://127.0.0.1:5020/v0/register -H 'Content-Type: application/json' -d '{"username":"bob"}' curl -s -X POST http://127.0.0.1:5020/v0/wallet/tap -H 'Content-Type: application/json' -H 'x-wallet-user: alice' -d '{"amount":"100.0"}' # 2. Propose a transfer, accept it, and trigger an automation tick curl -s -X POST http://127.0.0.1:5020/v0/wallet/transfer-offers \ -H 'Content-Type: application/json' -H 'x-wallet-user: alice' \ -d '{"receiver_party_id":"","amount":"25.0","description":"invoice-1","tracking_id":"xfer-001"}' curl -s -X POST http://127.0.0.1:5020/v0/wallet/transfer-offers//accept -H 'x-wallet-user: bob' curl -s -X POST http://127.0.0.1:5020/v0/admin/automation/tick ``` ## splice scan serve: Scan History & Token Standard Registry Running a participant with --scan-history scan.jsonl writes committed transaction history alongside contract authentication salts in scan.jsonl.auth. oltenrs splice scan serve tails incremental appends per request to serve /api/scan/* and /registry/* endpoints without restarting the participant (legacy top-level scan remains a hidden deprecated alias in v0.9.0 and is scheduled for removal in v1.0.0). ### Launch Scan + Token Standard Registry server and query endpoints ```bash oltenrs splice scan serve \ --history canton-rs-state/scan.jsonl \ --dar tests/oracle/splice-dars/splice-amulet-0.1.25.dar \ --dar tests/oracle/splice-dars/splice-dso-governance-0.1.31.dar \ --dar tests/oracle/splice-dars/splice-validator-lifecycle-0.1.7.dar \ --dar tests/oracle/splice-dars/splice-wallet-0.1.26.dar \ --port 5012 curl -s http://127.0.0.1:5012/api/scan/v0/dso curl -s -X POST http://127.0.0.1:5012/api/scan/v0/open-and-issuing-mining-rounds -d '{}' curl -s -X POST http://127.0.0.1:5012/registry/transfer-instruction/v1/transfer-factory -H 'Content-Type: application/json' -d '{}' ``` ## splice & splice scan Key Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `splice serve --dar-dir ` | - | `PathBuf` | `tests/oracle/splice-dars` | Directory containing official Splice DAR archives. | | `splice serve --ledger-host --ledger-port ` | `CANTON_RS_SPLICE_LEDGER_HOST / CANTON_RS_SPLICE_LEDGER_PORT` | `String / u16` | `port 7575` | Host and port of an external participant's JSON Ledger API v2. | | `splice serve --automation-interval-ms / --round-tick-duration-ms ` | - | `u64` | `0 (manual)` | Background automation tick interval in milliseconds for settlement sweeps, traffic purchases, and mining round progression. | | `splice serve --state-dir / --state-pg-url ` | `CANTON_RS_SPLICE_STATE_PG_URL` | `PathBuf / URL` | - | Storage location for deduplication keys (tracking_id) and worker advisory locks. | | `splice serve --auth-unsafe-secret / --ledger-admin-token ` | `CANTON_RS_SPLICE_AUTH_UNSAFE_SECRET / CANTON_RS_LEDGER_TOKEN` | `String / JWT` | - | Wallet HTTP API HMAC verification secret and Bearer token for remote participant administration. | | `splice scan serve --history [--contract-auth ] [--dar ] [--port ]` | - | `Scan Serve` | `127.0.0.1:5012` | Specify the history JSONL file, .auth salt file (default .auth), and DARs used to encode createdEventBlob payloads. | --- # Real-Time PostgreSQL Participant Query Store (db pqs) - URL: https://doc.oltenrs.dev/?lang=en#pqs - Group: Splice & Query - Command: `oltenrs db pqs [OPTIONS]` Project JSON Ledger API v2 updates into oltenrs PostgreSQL tables (pqs_*) indexed with JSONB and GIN so backend queries never contend with internal participant tables (lapi_*). ## Why Query PQS Instead of Internal Participant Tables? Internal participant tables (lapi_events_*, par_*) are normalized for consensus throughput and pruning speed; running ad-hoc predicate SQL directly against them competes with commit threads and disk I/O. oltenrs db pqs runs from the same single binary and reads JSON Ledger API v2 updates (/v2/updates and paginated /v2/state/active-contracts-page bootstrap, including reassignments) from a oltenrs participant (node json-api / node participant) into four pqs_* tables (legacy top-level pqs remains a hidden deprecated alias in v0.9.0 and is scheduled for removal in v1.0.0). *oltenrs db pqs projection tables* | Table | Stored Columns | Primary Query Pattern | | --- | --- | --- | | pqs_contracts | Contract ID, template ID, stakeholder arrays, payload (JSONB), create/unassign_offset/archive offsets | Partial index (archive_offset IS NULL AND unassign_offset IS NULL) and JSONB (@>) | | pqs_exercises | Exercised choice name, target contract ID, acting parties, JSONB arguments and result | Audit choice execution history by template or choice | | pqs_packages | Uploaded package IDs, name, version (populated from vetting metadata) | Track package versions and template provenance | | pqs_watermark | Last projected offset watermark | Resume cleanly across restarts and bound prune horizon | > **NOTE — Schema Difference & JVM Compatibility Scope**: The pqs_* schema differs from official Scribe 3.5.8, and running oltenrs db pqs directly against a JVM JSON API is untested (official Scribe 3.5.8 is verified over gRPC GetUpdates). ## Real-Time Projection (--follow) & JSONB Queries ### Bootstrap ACS → follow paginated updates → query active contracts & choices ```bash export CANTON_RS_PQS_PG_URL="postgres://canton:canton@127.0.0.1:5432/pqs_read_db" # (Optional) Supply the JWT via --token-file , --token-env , or CANTON_RS_PQS_TOKEN # export PQS_READER_JWT="" # 1. Bootstrap ACS pages and stream paginated updates (--url is an alias for --json-api-url) oltenrs db pqs sync --json-api-url http://127.0.0.1:7575 --token-file ./pqs-reader.jwt --follow # (Alternative) Using --url alias and --token-env: # oltenrs db pqs sync --url http://127.0.0.1:7575 --token-env PQS_READER_JWT --follow # 2. Check current projection watermark and row counts oltenrs db pqs status # 3. Query active contracts filtered by exact template name and JSONB containment (@>) oltenrs db pqs active \ --template AssetHolding:AssetHolding \ --party "Alice::1220..." \ --filter-json '{"assetSymbol":"USD_BOND"}' # 4. Inspect choice execution history and prune archived rows at or below watermark oltenrs db pqs exercises --template AssetHolding:AssetHolding --choice Transfer oltenrs db pqs prune --before-offset 1000 ``` ## db pqs Subcommands & Key Flags | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `sync --json-api-url (alias --url) [--follow \| --stop-at-latest] [--party ] [--token \| --token-env \| --token-file ] [--page-size ]` | `CANTON_RS_PQS_PG_URL / CANTON_RS_PQS_TOKEN` | `Stream Sync` | `--page-size 500` | Paginates ACS bootstrap and /v2/updates (halving page size on HTTP 413 and handling reassignments) into pqs_* tables. --url is accepted as an alias for --json-api-url; --token-env reads the JWT from a named env var (mutually exclusive with --token/--token-file), and --token-file is re-read before every sync round while --follow runs. | | `active [--template ] [--party ] [--filter-json ]` | `CANTON_RS_PQS_PG_URL` | `Query` | - | Filter active contracts by exact template match, stakeholder party, and JSONB partial match (@>). | | `exercises [--template ] [--choice ]` | `CANTON_RS_PQS_PG_URL` | `Query` | - | Query choice exercise history filtered by template or choice name. | | `status / prune --before-offset ` | `CANTON_RS_PQS_PG_URL` | `Admin` | - | Display sync watermarks or safely delete archived rows capped at or below the current watermark. | --- # Token Standard V2 Overview & How It Works (oltenrs token) - URL: https://doc.oltenrs.dev/?lang=en#token-v2 - Group: Tokens & Settlement - Command: `oltenrs token [OPTIONS]` CLI client that connects to a running participant's JSON Ledger API v2 to mint tokens, execute two-step transfers, settle multi-party DvP batches atomically, and audit balances and activity. ## Contract-Based Token Model & Role of the CLI On Canton Network, a token balance is not a number in a single global table; it is a set of active Daml contracts on the ledger (Holding, TransferInstruction, and Allocation). CIP-0112 Token Standard V2 defines shared interfaces across these contracts so wallets, exchanges, and settlement engines can process assets from different issuers through one uniform workflow. oltenrs token does not launch a node. Instead, it acts as an HTTP client against an already running participant's JSON Ledger API v2. Every command therefore requires three things to be in place: (1) a reachable participant JSON API port, (2) a caller JWT carrying CanActAs and CanReadAs rights for the acting parties, and (3) a visible token rules contract on the ledger (TokenRules or AmuletRules). - **Standard Ledger API v2 boundary**: Never touches internal PostgreSQL tables directly; all reads and writes go through standard /v2/* HTTP endpoints, working identically against oltenrs and Scala participants. - **Automatic Explicit Disclosure (disclosedContracts)**: Fetches createdEventBlob payloads for issuer- or DSO-owned rules contracts (TokenRules, AmuletRules, OpenMiningRound) and attaches them automatically on submission. - **128-bit fixed-point decimal aggregation**: Parses amounts and sums balances and supplies strictly in 10-decimal fixed-point integers (Numeric 10) without IEEE-754 floating-point rounding. ## Five-Stage Execution Pipeline Each CLI invocation resolves the target endpoint, prepares credentials, queries active contracts, attaches any required disclosures, and submits an atomic ledger command. ### oltenrs token request pipeline 01 · Endpoint. **Resolve Participant URL** — Uses --url first when supplied. Otherwise looks up the participant's JSON API address (defaulting to the first participant, e.g. participant1) from the --name or --state-dir supervisor registry. 02 · Auth & Rights. **Prepare JWT & Dev Grants** — Forwards --token as-is when provided. Only when targeting a local --dev-auth instance via --name (without --url or --token) does it sign an HS256 JWT from dev-jwt.key and grant CanActAs/CanReadAs automatically. 03 · Party & ACS. **Expand Party Hints & Query ACS** — Resolves short hints like Alice via GET /v2/parties into full namespace IDs (Alice::1220…) and queries /v2/state/active-contracts for rules and unlocked Holdings. 04 · Disclosure. **(Amulet Only) Fetch Scan Context** — When --scan-url is set for Amulet faucet or transfer calls, queries Scan (/v0/dso and /registry/*) to obtain open mining rounds and DSO rules as disclosedContracts. 05 · Ledger Commit. **Submit Atomic Transaction** — Submits the Daml choice via POST /v2/commands/submit-and-wait-for-transaction and returns the committed updateId and offset. Any rejection leaves ledger state untouched. *The built-in HTTP client speaks plain http://host:port only. Place a local reverse proxy or SSH tunnel in front of remote TLS (https://) endpoints.* ## Supported Asset Families: TestTokenV2 vs. Amulet oltenrs token supports both the standard CIP-0112 reference token (TestTokenV2) and the Splice native network coin (Amulet). Because their rules contracts and supporting services differ, pick the family that matches your test or environment. *Comparison of runtime requirements and supported commands by asset family* | Dimension | TestTokenV2 (e.g. USDX, USDY) | Amulet (Canton Coin) | | --- | --- | --- | | Rules contract owner | TokenRules owned by your chosen issuer (admin) party | AmuletRules & OpenMiningRound managed by the network DSO | | Required DAR archive | splice-test-token-v2 (uploaded automatically by token create) | splice-amulet bootstrapped with the Splice network | | Minimum infrastructure | A single JSON API v2 participant (including a local daemon) | Splice LocalNet or DevNet (paired with Scan API) | | Initial funding | Run token create followed by token mint | Run token faucet (DevNet only) | | Supported commands | create · mint · transfer · allocation · settle · balance · activity | faucet · transfer · transfer accept\|reject\|withdraw · balance · activity | | Primary use case | Local development, CI regression suites, multi-party DvP tests | End-to-end Canton Coin transfer and wallet integration on DevNet | > **WARNING — Can I issue production tokens with token create and mint?**: No. token create and mint target TestTokenV2, a zero-fee reference implementation designed for local development and automated settlement tests rather than production asset issuance. By contrast, the read commands (balance, balances, and activity) inspect standard CIP-0112 Holding interfaces and work across any compliant V2 token as well as Amulet. ## Three Balance Buckets: available · locked · total Under CIP-0112, transfers and DvP settlements lock the sender's holdings until the counterparty or settlement executor finalizes the step. token balance and balances scan active Holding contracts and report three exact buckets. | Lifecycle Step | Sender available | Sender locked | Sender total | Receiver Balance | | --- | --- | --- | --- | --- | | 1) Initiate two-step transfer (transfer) | Decreases | Increases | Unchanged | Unchanged (awaiting accept) | | 2a) Receiver accepts (transfer accept) | Unchanged | Decreases (consumed) | Decreases | available increases | | 2b) Reject or withdraw (reject / withdraw) | Restored | Decreases (unlocked) | Unchanged | Unchanged | | 3) Lock DvP leg (allocation create) | Decreases | Increases | Unchanged | Unchanged (awaiting settle) | | 4a) Execute DvP batch (settle) | Unchanged | Decreases (consumed) | Decreases | available increases | | 4b) Abort DvP leg (withdraw / cancel) | Restored | Decreases (unlocked) | Unchanged | Unchanged | > **IMPORTANT — Guarantees — Fixed-Point Precision & Supply Conservation**: Every amount is evaluated in Numeric (scale 10) fixed-point arithmetic with zero float rounding. Across transfer initiation, acceptance, rejection, withdrawal, DvP allocation, and batch settlement, total instrument supply (Σ total) is strictly conserved, and rejected or cancelled locks return to the sender's available balance without drift. ## Subcommand Summary | Subcommand | Operation | Ledger Signer (actAs) | Target Asset | | --- | --- | --- | --- | | token faucet | Fund test coins via AmuletRules_DevNet_Tap | Receiver party | Amulet (DevNet only) | | token create --instrument --admin | Upload reference DAR and create issuer TokenRules | Issuer (admin) party | TestTokenV2 | | token mint | Submit admin OfferMint followed immediately by receiver Accept | admin → receiver (two txs) | TestTokenV2 | | token transfer | Lock sender holdings into a TransferInstruction (supports --auto-accept) | Sender (plus receiver with --auto-accept) | TestTokenV2 · Amulet | | token transfer | Accept, reject, or withdraw a pending TransferInstruction | accept/reject: receiver · withdraw: sender | TestTokenV2 · Amulet | | token allocation | Create, inspect, withdraw, or cancel atomic DvP leg allocations | create/withdraw: authorizer · cancel: executor | TestTokenV2 | | token settle | Settle all allocations in a batch in one atomic transaction | Settlement executor | TestTokenV2 | | token balance / token balances | Aggregate available, locked, total, and total supply | Read-only (readAs) | Any CIP-0112 V2 · Amulet | | token activity | List token-related choice exercises across an offset window | Read-only (readAs) | Any CIP-0112 V2 · Amulet | | token preset | Idempotently bootstrap, inspect, or reset CIP-0056/CIP-0112 local registry presets (amulet-preapproval, da-registry-local, oz-cip112) | Admin & profile parties | CIP-0056 · CIP-0112 | | token preapproval | Create, look up, or cancel receiver incoming transfer preapprovals (--receiver) | Receiver or provider | TestTokenV2 · Amulet | --- # Connection, Auth & Prerequisites - URL: https://doc.oltenrs.dev/?lang=en#token-setup - Group: Tokens & Settlement - Command: `oltenrs token [CONNECTION_OPTIONS] [--name | --state-dir | --url http://host:port] [--participant

] [--token | --token-env | --token-file ]` How endpoint discovery, JWT authentication modes, and ledger prerequisites work across local supervisor instances and external remote participants. ## Endpoint Resolution Priority Every token subcommand resolves its target HTTP JSON Ledger API v2 endpoint in the priority order below. Using --name or --state-dir reads assigned ports straight from local supervisor metadata so you do not have to track shifted port numbers manually. All shared connection, auth, and output flags (--url, --name, --state-dir, --participant, --token, --token-env, --token-file, --user, --scan-url, --synchronizer, --format) are marked global = true and accepted both before and after any subcommand (for example, both oltenrs token --name dev1 balances and the canonical oltenrs token balances --name dev1 work identically). | Flag Combination | Resolved Target | Behavior & Caveats | | --- | --- | --- | | 1st: --url http://host:port | Connects directly to the given HTTP address | Port is required; https:// is rejected with exit 2. Disables automatic local --dev-auth signing. | | 2nd: --name | First JSON API port in $XDG_STATE_HOME/canton-rs/instances/ | Falls back to ~/.local/state/oltenrs when XDG_STATE_HOME is unset; exits 2 if the instance does not exist. | | 2nd + --participant

| Specific participant port (

.json) inside the named instance | Use in multi-participant topologies to target the node hosting the acting party. | | 3rd: --state-dir

| JSON API port recorded in the given supervisor directory | Targets an unnamed daemon started with an explicit --state-dir path. | | Companion: --scan-url http://host:port/api/scan | Splice Scan endpoint (independent of the participant URL) | Used exclusively by Amulet faucet and transfer commands to fetch DSO rules and open mining rounds. | > **WARNING — How do I connect to an external participant behind HTTPS (TLS)?**: The built-in HTTP client speaks plain http://host:port only and exits with code 2 when given an https:// URL. When connecting to a TLS-protected DevNet or production endpoint, open a local loopback tunnel via SSH port forwarding or a local TLS-terminating proxy (such as Caddy or Nginx) and pass --url http://127.0.0.1:. ## Three Authentication Modes For local development, oltenrs token can mint tokens and grant party permissions automatically; against shared or production nodes, it forwards the exact Bearer JWT you supply. | Auth Mode | Trigger Condition | Runtime Behavior | Intended Environment | | --- | --- | --- | --- | | Automatic Dev Auth (--dev-auth) | --name (or --state-dir) without --url or --token against a --dev-auth instance | Signs short-lived user and admin HS256 JWTs from dev-jwt.key and calls POST /v2/users//rights to grant CanActAs and CanReadAs for required parties automatically. | Local single/multi-node dev & CI | | Explicit Bearer Token (--token / --token-env / --token-file) | --token , --token-env , or --token-file supplied on the CLI | Sends the given JWT in Authorization: Bearer without modifying user permissions (prefer --token-env or --token-file to keep tokens out of ps output). The token subject (--user, default participant_admin) must already hold party rights. | External DevNet, shared staging, production queries | | Unauthenticated | Participant running with auth disabled + no --token | Sends plain HTTP requests without an Authorization header. | Open local sandboxes | > **IMPORTANT — Why do I get HTTP 401 or 403 when passing --url?**: Passing --url tells the CLI to treat the target as an external node, turning off local dev-jwt.key signing and automatic permission grants. Reaching an auth-enabled participant without --token therefore returns HTTP 401 (Unauthorized), while passing a valid JWT whose user lacks CanActAs or CanReadAs for the target party returns HTTP 403 (Forbidden). ## Four Prerequisites Before Running Commands - **1. Running participant JSON API**: Confirm the target participant slot is healthy first with oltenrs daemon status --name --format json. - **2. Pre-allocated ledger parties**: oltenrs token never allocates missing parties implicitly. Allocate Admin, Alice, Bob, and any other parties beforehand. - **3. Matching DAR archive or Scan service**: When --dar is omitted, token create walks up to 8 parent directories looking for references/splice/daml/dars/splice-test-token-v2-1.0.2.dar. Always pass --dar when running outside the repository tree. Amulet commands require a Splice-bootstrapped network and --scan-url. - **4. Unexpired instruction and allocation windows**: Transfer instructions (--expires-secs) and DvP allocations (--deadline-secs) default to a 3600-second (1-hour) lifetime. Expired contracts are rejected by the ledger. ## Party Registration Example Combine daemon env and daemon creds against a local --dev-auth instance to allocate test parties in a few lines without hand-crafting JWT payloads. ### Example: Allocate Admin, Alice, and Bob on a local --dev-auth instance (dev1) ```bash # 1. Export instance endpoint URLs and mint an admin development JWT # (default/localnet templates name the first participant 'participant1' -> CANTON_RS_PARTICIPANT1_JSON_URL) eval "$(oltenrs daemon env --name dev1)" TOKEN=$(oltenrs daemon creds --name dev1 --format json | jq -r .token) # 2. Allocate three parties through JSON Ledger API v2 for HINT in Admin Alice Bob; do curl -s -X POST "$CANTON_RS_PARTICIPANT1_JSON_URL/v2/parties" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d "{\"partyIdHint\": \"$HINT\", \"identityProviderId\": \"\"}" done # 3. Short hints (such as Alice) now resolve automatically to full IDs (Alice::1220...) oltenrs token balances --name dev1 ``` *If multiple parties share the same prefix (e.g. Alice::1220aaa… and Alice::1220bbb…), the CLI aborts with ambiguous party hint; pass the full party ID in that case.* --- # Workflows by Environment (Local · Multi-Org · DevNet · CI · Production) - URL: https://doc.oltenrs.dev/?lang=en#token-usecases - Group: Tokens & Settlement Practical patterns tailored to single-node local development, cross-organization participants, Splice DevNet, automated CI pipelines, and production read/response workflows. ## Scenario 1. Single-Participant Local Development (Fastest Loop) When the issuer (Admin), sender (Alice), and receiver (Bob) are hosted on the same local participant, one connection can authorize all three parties. Pass --auto-accept to complete both halves of a transfer in a single command. ### Example 1: Initialize rules → mint supply → one-step transfer (--auto-accept) → verify balances ```bash # (Prerequisite) dev1 is running and Admin, Alice, and Bob are allocated oltenrs token create --name dev1 --instrument USDX --admin Admin \ --dar references/splice/daml/dars/splice-test-token-v2-1.0.2.dar oltenrs token mint --name dev1 USDX Alice 1000.0 --admin Admin # Both Alice and Bob live on participant1, so --auto-accept chains creation and receiver acceptance oltenrs token transfer --name dev1 USDX Alice Bob 250.0 --admin Admin --auto-accept oltenrs token balance --name dev1 Alice USDX oltenrs token balance --name dev1 Bob USDX ``` *Re-running token create for the same Admin reuses the active TokenRules contract (reused_rules: true), allowing multiple instruments (USDX, USDY) under one issuer.* ## Scenario 2. Multi-Participant & Cross-Organization Execution In a multi-institution deployment, Bank A's participant (participant1) hosts Alice while Broker B's participant (participant2) hosts Bob. Because a Canton participant can only submit actAs commands for parties it hosts, the sender initiates on participant1 and the receiver accepts on participant2. Do not pass --auto-accept here: participant1 cannot sign on Bob's behalf and the second step will fail authorization. ### Example 2: Initiate on Bank A (participant1) → accept on Broker B (participant2) or withdraw on participant1 ```bash # 1. Bank A participant (participant1): Alice locks 100 USDX and emits instruction_cid oltenrs token transfer --name net --participant participant1 USDX Alice Bob 100.0 --admin Admin --format json # 2. Broker B participant (participant2): Bob accepts the pending instruction (or runs reject) oltenrs token transfer accept --name net --participant participant2 --actor Bob # (Alternative) Before Bob accepts, Alice can reclaim the locked funds from participant1 oltenrs token transfer withdraw --name net --participant participant1 --actor Alice ``` *When participants run on separate hosts, replace --name/--participant with each organization's --url and IdP-issued --token.* > **WARNING — How does rules-contract disclosure differ between TestTokenV2 and Amulet across participants?**: For Amulet, passing --scan-url fetches createdEventBlob proofs for AmuletRules and OpenMiningRound from Scan and attaches them automatically, so validator participants without DSO hosting work out of the box. For TestTokenV2, the CLI queries TokenRules from the connected participant's ACS, meaning the participant executing accept or settle must also be able to see that TokenRules contract (for example by co-hosting the admin party). ## Scenario 3. Amulet (Canton Coin) on Splice LocalNet & DevNet Funding or transferring Amulet requires DSO-governed contracts (AmuletRules and the active OpenMiningRound). Supplying --scan-url lets the CLI fetch those contracts and transfer-factory contexts from Scan (/v0/dso and /registry/*) and attach them as disclosedContracts. ### Example 3: DevNet faucet tap → two-step Amulet transfer → receiver accept ```bash JSON_URL=http://127.0.0.1:22975 # Validator participant JSON Ledger API v2 SCAN_URL=http://127.0.0.1:25012/api/scan # Splice Scan API USER_JWT= # 1. Fund Alice with 100 Amulet via AmuletRules_DevNet_Tap oltenrs token faucet --url "$JSON_URL" --scan-url "$SCAN_URL" --token "$USER_JWT" Alice 100.0 # 2. Create a 25 Amulet transfer instruction and accept it as Bob oltenrs token transfer --url "$JSON_URL" --scan-url "$SCAN_URL" --token "$USER_JWT" Amulet Alice Bob 25.0 --format json oltenrs token transfer accept --url "$JSON_URL" --scan-url "$SCAN_URL" --token "$USER_JWT" --actor Bob oltenrs token balance --url "$JSON_URL" --token "$USER_JWT" Bob Amulet ``` *AmuletRules_DevNet_Tap is permitted only on networks configured with isDevNet = true; TestNet and MainNet ledgers reject faucet calls.* ## Scenario 4. Automated Payment Regression Tests in CI Every subcommand supports structured --format json output and non-zero exit codes on failure. Pair a named --dev-auth instance with a shell EXIT trap so failed assertions still clean up child processes and state directories. ### Example 4: Disposable instance boot, balance assertion, and guaranteed teardown ```bash set -euo pipefail trap 'oltenrs daemon remove --name ci-tok --force' EXIT oltenrs daemon up -f canton-daemon.yaml --name ci-tok --port-offset 0 --dev-auth -d # ... allocate Admin, Alice, and Bob (see “Connection, Auth & Setup”) ... oltenrs token create --name ci-tok --instrument USDX --admin Admin --dar "$TEST_TOKEN_DAR" oltenrs token mint --name ci-tok USDX Alice 100.0 --admin Admin oltenrs token transfer --name ci-tok USDX Alice Bob 30.0 --admin Admin --auto-accept BOB_AVAIL=$(oltenrs token balance --name ci-tok Bob USDX --format json | jq -r '.balances[0].available') test "$BOB_AVAIL" = "30.0" ``` ## Scenario 5. TestNet & MainNet Operational Boundaries - **Do not use test issuance commands**: token faucet (DevNet only) and token create / mint (reference TestTokenV2 only) are not production asset-issuance tools. - **Use for reconciliation and authorized instruction handling**: Run token balance, balances, and activity for real-time holdings reconciliation, and use transfer accept/reject/withdraw for participant-hosted parties with proper rights. - **Supply explicit IdP tokens over a local TLS proxy**: Never enable --dev-auth in production. Pass a least-privilege --token issued by your production IdP and connect via --url through a local TLS-terminating tunnel. - **Keep external-key signing separate**: oltenrs token submits commands using a user JWT for participant-hosted parties. External parties whose keys live in a wallet or HSM must use the interactive prepare/execute flow via Wallet SDK. ## Scenario 6. One-Command Local Registry Presets (preset) & Transfer Preapprovals (preapproval) Added in v0.9.0, token preset idempotently bootstraps CIP-0056/CIP-0112 local test parties (default alice,bob,carol), instruments, and preapproval setups in one command (supported profiles: amulet-preapproval, da-registry-local, oz-cip112). Use token preapproval to create, look up, or cancel receiver incoming transfer preapprovals (--receiver). ### Example 5: Bootstrap local preset → create, look up & cancel preapproval → reset state ```bash # 1. Bootstrap a local registry preset (oz-cip112 requires --dar-dir ) oltenrs token preset up --name dev1 --profile da-registry-local --parties alice,bob,carol oltenrs token preset status --name dev1 --format json # 2. Create (default 86400s lifetime), look up, and cancel a receiver preapproval for bob oltenrs token preapproval create --name dev1 --receiver bob --instrument USDX --expires-secs 86400 oltenrs token preapproval lookup --name dev1 --receiver bob --instrument USDX --format json oltenrs token preapproval cancel --name dev1 --receiver bob --instrument USDX # 3. Reset local preset and preapproval policy state cleanly without touching DARs oltenrs token preset reset --name dev1 ``` --- # Minting & Two-Step Transfer Lifecycle (create · mint · transfer · balance) - URL: https://doc.oltenrs.dev/?lang=en#token-transfers - Group: Tokens & Settlement - Command: `oltenrs token transfer [--auto-accept] [--admin ] [--expires-secs 3600]` How issuance and transfers map to Daml choices on the ledger, how pending locks behave on accept/reject/withdraw, and how input Holdings are chosen. ## Why Minting Submits Two Sequential Transactions Daml contracts enforce explicit consent: an issuer cannot unilaterally force an asset obligation onto another party's ledger view without that receiver's signature (the Offer-Accept pattern). First, token create uploads the reference DAR and creates a TokenRules contract for the issuer (admin). Next, token mint submits two transactions back to back: (1) TokenRules_OfferMint signed by admin to create a mint offer, followed immediately by (2) TransferInstruction_Accept signed by the receiver to materialize the final Holding. > **NOTE — What happens if token mint fails on the second (accept) step?**: Because the first transaction (OfferMint) has already committed, a pending mint offer (TransferInstruction) remains active on the ledger. Do not re-run mint from scratch or you will create a second offer; instead inspect the contract ID with oltenrs daemon contracts ls --party and complete acceptance via token transfer accept --actor . ## Two-Step Transfers (TransferInstruction) & Lock Resolution Running token transfer exercises TransferFactory_Transfer as the sender, locking the selected input Holdings and creating a pending TransferInstruction. Ownership only moves once the receiver accepts; rejecting or withdrawing immediately unlocks the funds back to the sender. *Follow-up actions on a pending TransferInstruction* | Follow-Up Command | Default Actor (--actor) | Ledger State Transition | | --- | --- | --- | | token transfer accept | Receiver | Consumes the locked input and creates an unlocked Holding owned by the receiver. | | token transfer reject | Receiver | Declines the transfer and restores the locked amount to the sender's available balance. | | token transfer withdraw | Sender | Cancels the offer prior to acceptance and restores the sender's available balance. | | Expiry reached (--expires-secs) | Automatic time guard | Once the deadline (default 3600s) passes, the ledger rejects subsequent accept attempts. | ### Example: Inspect a locked transfer balance and restore it via reject ```bash # 1. Initiate a 20 USDX transfer without --auto-accept → 20 USDX moves to locked oltenrs token transfer --name dev1 USDX Alice Bob 20.0 --admin Admin --format json oltenrs token balance --name dev1 Alice USDX # Sample output: USDX avail=80.0 locked=20.0 total=100.0 (admin=Admin::1220...) # 2. Bob rejects the instruction → Alice's available balance returns to 100.0 oltenrs token transfer reject --name dev1 oltenrs token balance --name dev1 Alice USDX # Sample output: USDX avail=100.0 locked=0.0 total=100.0 (admin=Admin::1220...) ``` ## Deterministic Input Holding Selection When a party owns multiple Holding contracts, token transfer and allocation create pick inputs deterministically so repeated runs against identical ledger state always select the same contracts. - **Candidate filtering**: Selects only active V2 Holdings owned by the sender that carry no lock and match both the instrument ID and issuer (admin). - **Largest-first ordering**: Sorts candidates by amount descending (breaking ties by contract ID ascending) and accumulates inputs just until the target amount is met. - **Insufficient balance handling**: Fails immediately before submission with insufficient unlocked balance if zero unlocked holdings exist. If holdings exist but their sum falls short, all candidates are submitted so the Daml ledger enforces its native insufficient-funds check with zero state change. - **Automatic --admin inference**: Infers the issuer from the sender's matching holdings when --admin is omitted. Pass --admin explicitly when no holdings exist yet and multiple issuers are active on the ledger. ## Querying Party Balances & Total Supply (balance · balances) token balance prints per-instrument buckets for one party, while token balances aggregates every local party on the participant (or a repeatable --party filter) alongside total supply (SUPPLY) per instrument. ### Example: Reconcile individual balances against total instrument supply ```bash oltenrs token balance --name dev1 Alice oltenrs token balances --name dev1 --instrument USDX # Sample output: # Alice::1220... USDX avail=750.0 locked=0.0 total=750.0 # Bob::1220... USDX avail=250.0 locked=0.0 total=250.0 # SUPPLY USDX 1000.0 ``` --- # Atomic DvP Allocations & Batch Settlement (allocation · settle) - URL: https://doc.oltenrs.dev/?lang=en#token-dvp - Group: Tokens & Settlement - Command: `oltenrs token allocation create --settlement-id --executor --authorizer --leg ... | oltenrs token settle ` Bind multiple asset legs — such as securities delivery and cash payment — under one settlement ID so every leg settles simultaneously in a single transaction or none do. ## DvP Roles & --leg Specification Syntax In a bilateral asset swap, neither counterparty wants to surrender its asset first without certainty of receiving the counter-asset (principal risk). Token Standard V2 eliminates this risk by having each party lock its outgoing leg in an Allocation contract first, after which a designated executor settles all legs in one atomic commit. - **allocation create --leg syntax (authorizer perspective)**: Written as ::::. Mark a leg sender when --authorizer pays out, and receiver when --authorizer receives. - **settle --leg syntax (batch perspective)**: Written as ::::. Full Canton party IDs containing double colons (such as Alice::1220…) are parsed cleanly without colliding with field delimiters. | Component | Role in the Settlement | | --- | --- | | settlement-id (batch) | Shared identifier binding all transfer legs that must settle together. | | leg | A single asset movement (sender, receiver, instrument, amount). A DvP batch typically contains two or more legs. | | authorizer | Counterparty approving its side of the trade and locking outgoing Holdings into its own Allocation contract. | | executor | Coordinator (clearing service, venue, or admin) that invokes SettlementFactory_SettleBatch once all allocations are active. | ## Four-Stage Swap Pipeline & Walkthrough ### Atomic swap: Alice (pays 10 USDX) ↔ Bob (pays 5 USDY) 01 · Lock Leg A. **Alice Allocates Outgoing USDX** — Alice signs an Allocation covering leg1 (send 10 USDX) and leg2 (receive 5 USDY), locking 10 USDX. 02 · Lock Leg B. **Bob Allocates Outgoing USDY** — Bob signs a matching Allocation under settlement-id dvp-1 (receive leg1, send leg2), locking 5 USDY. 03 · Settle Batch. **Executor Submits Batch Settlement** — The executor gathers both Allocation contract IDs and exercises SettlementFactory_SettleBatch in one transaction. 04 · Atomic Finalize. **Simultaneous Ownership Swap** — Alice receives 5 USDY, Bob receives 10 USDX, and all locks clear together. If any leg fails validation, nothing moves. ### Example: Lock both counterparty allocations → inspect list → settle batch ```bash # 1. Alice locks 10 USDX and declares expected receipt of 5 USDY oltenrs token allocation create --name dev1 --settlement-id dvp-1 \ --executor Admin --authorizer Alice --admin Admin \ --leg leg1:sender:Bob:USDX:10.0 \ --leg leg2:receiver:Bob:USDY:5.0 # 2. Bob declares expected receipt of 10 USDX and locks 5 USDY oltenrs token allocation create --name dev1 --settlement-id dvp-1 \ --executor Admin --authorizer Bob --admin Admin \ --leg leg1:receiver:Alice:USDX:10.0 \ --leg leg2:sender:Alice:USDY:5.0 # 3. Inspect active allocations and settle dvp-1 atomically as Admin oltenrs token allocation list --name dev1 oltenrs token settle --name dev1 dvp-1 --executor Admin ``` *When --alloc is omitted, settle automatically discovers all visible active Allocations matching the given batch ID.* > **IMPORTANT — Guarantees — All-or-Nothing Settlement (Zero Partial Fills)**: token settle evaluates every leg inside a single Daml transaction. If a counterparty withdraws its allocation beforehand or any required authorization is missing (missing authorizations), the entire settlement is rejected and no partial asset transfer can occur. ## Releasing Locks Before Settlement: withdraw & cancel Prior to batch settlement, either the counterparty or the designated executor can abort an allocation and return locked funds to the available bucket. Across multiple participants, run create and withdraw on each authorizer's participant, and run settle and cancel on the executor's participant. | Abort Command | Default Actor (--actor) | When to Use | | --- | --- | --- | | token allocation withdraw | The authorizer who created it | Used by a trading party to pull back its locked Holdings if the counterparty delays or backs out. | | token allocation cancel | First executor (or admin) | Used by the venue or clearing executor to void a cancelled trade and release counterparty locks. | --- # Troubleshooting & Recovery Guide - URL: https://doc.oltenrs.dev/?lang=en#token-troubleshooting - Group: Tokens & Settlement Exact causes and remedies for connection, permission, and contract-state errors, plus how to recover cleanly when a two-transaction command stops halfway. ## Process Exit Codes | Exit Code | Category | Trigger Conditions | | --- | --- | --- | | 0 | Success | Query succeeded or the ledger transaction committed cleanly. | | 1 | Runtime / Ledger Error | TCP connection failure, HTTP 401/403/404/500, missing party or contract, insufficient unlocked balance, or Daml choice rejection. | | 2 | Input / Preflight Error | Unsupported https:// URL, missing port number, unknown --name instance, missing JSON API endpoint, or failed dev-auth key lookup. | ## Connection, URL & Permission Errors | Error Message / Symptom | Root Cause | Resolution | | --- | --- | --- | | unsupported URL '…': expected http://... | Passed an https:// address to --url | Open a local TLS-terminating proxy or SSH port forward and pass plain http://127.0.0.1:. | | URL '…' is missing ':port' | Omitted the port number in --url | Specify both host and port explicitly, such as http://127.0.0.1:7575. | | no Ledger JSON API endpoint found for … | Named instance has no matching participant JSON port | Inspect endpoints via oltenrs daemon status --name --format json and pass the matching --participant name. | | cannot reach the JSON Ledger API at host:port | Target participant is stopped or listening on another port | Check process health and bound ports with oltenrs daemon ps. | | HTTP 401 | Sent an unauthenticated request to an auth-enabled node | Pass --token for remote nodes, or use --name (without --url) for local --dev-auth instances. | | HTTP 403 | Authenticated user lacks CanActAs or CanReadAs for the party | Grant party rights via admin API or mint a scoped dev token with oltenrs daemon creds --party

. | | party '…' not found on ledger | Party has not been allocated or lives on another participant | Allocate the party via POST /v2/parties first and verify --participant in multi-node setups. | | ambiguous party hint '…' | Two or more parties share the same hint prefix | Pass the full party identifier (Alice::1220…) instead of the short hint. | ## Contract-State, Balance & Settlement Rejections | Error Message / Symptom | Root Cause | Resolution | | --- | --- | --- | | cannot locate default V2 DAR (pass --dar ) | Ran token create outside the repository without --dar | Pass --dar pointing to splice-test-token-v2-1.0.2.dar. | | active TokenRules not found for admin … | No TokenRules contract exists (or is visible) for that admin | Run token create --instrument --admin first, or connect to a participant where TokenRules is visible. | | multiple TokenRules (n) active; specify --admin | Multiple issuers have active TokenRules on the ledger | Add --admin to disambiguate. | | active AmuletRules contract not found on ledger | Ran faucet or Amulet transfer against a non-Splice daemon | Amulet requires Splice LocalNet or DevNet. Use TestTokenV2 (create/mint) on plain local daemons. | | insufficient unlocked balance … | Available balance is zero (for example because funds are locked) | Run token balance to inspect locked amounts and resolve pending instructions via accept, reject, or withdraw. | | active TransferInstruction '…' not found | Instruction was already consumed, expired, or belongs to another node | Check history with token activity and ensure you are connected to the acting party's participant. | | no active allocations found for batch '…' | No active Allocation matches the given batch ID | Run token allocation list to verify the exact settlement_id and expiry. | | DAML_FAILURE … missing authorizations | Called settle before all counterparties created allocations | Ensure every counterparty runs allocation create for the batch before invoking settle. | ## Recovering Two-Transaction Commands (mint & --auto-accept) Single-transaction commands are strictly atomic. Only token mint and token transfer --auto-accept submit two sequential transactions; if the first commits and the second (acceptance) fails, finish or unwind the pending TransferInstruction directly rather than re-running the initial command. ### Example: Locate a leftover TransferInstruction and accept or withdraw it ```bash # 1. List active contracts visible to Bob to find the pending TransferInstruction CID oltenrs daemon contracts ls --name dev1 --party Bob --format json # 2. Complete acceptance as Bob, or withdraw as Alice oltenrs token transfer accept --name dev1 --actor Bob oltenrs token transfer withdraw --name dev1 --actor Alice ``` *Each HTTP call waits up to 120 seconds for a reply. If a network drop interrupts the response, check balance or activity before retrying to see whether the transaction already committed.* --- # token CLI Flags & JSON Output Reference - URL: https://doc.oltenrs.dev/?lang=en#token-reference - Group: Tokens & Settlement - Command: `oltenrs token [CONNECTION_OPTIONS] [ARGS] [CONNECTION_OPTIONS]` Complete dictionary of global connection/auth flags, subcommand arguments, and --format json response keys. ## Shared Connection, Auth & Output Flags (global = true) All connection, auth, and output flags below are marked global = true, so they are accepted both before the subcommand (oltenrs token --name dev1 balances) and after it (canonical style: oltenrs token balances --name dev1). | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--name ` | - | `String` | - | Resolves the participant JSON API endpoint from the local instance registry and enables automatic HS256 dev-JWT signing and party grants on --dev-auth instances. | | `--state-dir

` | - | `PathBuf` | - | Resolves endpoints and dev-auth keys directly from an explicit supervisor state directory path instead of --name. | | `--participant ` | - | `String` | `first JSON endpoint` | Selects a specific participant service (such as participant1 or participant2) inside a multi-participant instance. | | `--url ` | - | `http://host:port` | - | Connects directly to an explicit HTTP JSON Ledger API v2 URL (highest priority; disables local --dev-auth auto-signing). | | `--token ` | - | `JWT` | - | Explicit Bearer JWT sent in the Authorization header (disables automatic party permission grants). | | `--token-env ` | - | `Env Var Name` | - | Reads the Bearer JWT from the named environment variable (keeps tokens out of ps command-line arguments). | | `--token-file ` | - | `PathBuf` | - | Reads the Bearer JWT from a file path (keeps tokens out of ps command-line arguments). | | `--user ` | - | `String` | `participant_admin` | Ledger API command userId and sub claim used when signing local development JWTs. | | `--scan-url ` | - | `http://host:port/api/scan` | - | Splice Scan base URL queried for AmuletRules, open mining rounds, and transfer choice contexts. | | `--synchronizer ` | - | `String` | - | Target synchronizer ID when submitting transactions to a participant connected to multiple domains. | | `--format ` | - | `Enum` | `text` | Output format; prefer json in CI assertions and automation scripts. | ## Subcommand Arguments & Options | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `faucet [--dso ] [--dar ]` | - | `DevNet Amulet` | - | Exercises AmuletRules_DevNet_Tap to fund . --dso supplies an optional reader party hint when querying local ACS without --scan-url. | | `create --instrument --admin [--dar ]` | - | `TestTokenV2` | - | Uploads and verifies the V2 reference token DAR and creates (or reuses) the admin party's TokenRules contract. | | `mint [--admin ]` | - | `TestTokenV2` | - | Executes admin TokenRules_OfferMint followed by receiver TransferInstruction_Accept to mint Holdings. | | `transfer [--auto-accept] [--admin

] [--expires-secs ]` | - | `TransferInstruction` | `--expires-secs 3600` | Locks sender Holdings into a TransferInstruction; --auto-accept immediately submits receiver acceptance as well. | | `transfer [--actor ] [--admin ]` | - | `TransferInstruction` | - | Accepts or rejects (default actor: receiver) or withdraws (default actor: sender) a pending TransferInstruction. | | `balance [INSTRUMENT]` | - | `Query` | - | Prints exact fixed-point available, locked, and total balances for one party. | | `balances [--party ...] [--instrument ]` | - | `Query` | - | Prints balances across all local parties (or specified --party filters) together with total instrument supplies. | | `allocation create --settlement-id --executor --authorizer --leg ... [--admin

] [--deadline-secs ]` | - | `Atomic DvP` | `--deadline-secs 3600` | Approves DvP legs (::::) and locks outgoing Holdings. | | `allocation ] \| withdraw \| cancel > [--actor

]` | - | `Atomic DvP` | - | Lists active allocations or releases locked Holdings via authorizer withdraw or executor cancel. | | `settle [--executor ] [--alloc ...] [--leg ...] [--admin

]` | - | `Atomic DvP` | - | Executes SettlementFactory_SettleBatch to settle all batch legs (::::) atomically. | | `activity [--from ] [--to ]` | - | `Query` | `--from 0 / --to ledger_end` | Lists token-related choice exercises (EventLog, transfer, allocation, settlement) visible to in (from, to]. | | `preset [--parties alice,bob,carol] [--dar-dir

] \| status \| reset>` | - | `Local Preset` | `--parties alice,bob,carol` | Idempotently bootstraps, inspects, or resets CIP-0056/CIP-0112 local presets (amulet-preapproval, da-registry-local, oz-cip112; oz-cip112 requires --dar-dir). | | `preapproval --receiver [--provider

] [--expires-secs 86400] [--instrument ] [--actor

] [--dso ]` | - | `Preapproval` | `--expires-secs 86400` | Creates or renews (create), looks up (lookup, 404 when absent/cancelled), or cancels (cancel, default actor: receiver) an incoming transfer preapproval. | ## Key --format json Response Fields | Subcommand | Primary JSON Keys | | --- | --- | | faucet | action, instrument, receiver, amount, contract_id, update_id, offset | | create | action, instrument, admin, rules_cid, reused_rules, package_id, vetted_count, update_id, offset | | mint | action, instrument, admin, party, amount, offer_cid, holding_cid, update_id, offset | | transfer | action, status, instrument, is_amulet, from, to, amount, instruction_cid, update_id (or accept_update_id), offset | | balance / balances | balances[].{party, instrument, available, locked, total, admin}, supplies[].{instrument, supply} | | allocation create / list | allocation_cid, settlement_id, authorizer, executors | | activity | party, from_offset, to_offset, events[].{offset, node_id, update_id, choice, contract_id, template_id, acting_parties} | | preset up / status / reset | profile, parties, instruments, dar_digests, preapprovals | | preapproval create / lookup / cancel | action, receiver, provider, instrument, expires_at, status | --- # Transaction Simulation, Cost Estimation & .simrun Viewer (oltenrs simulate) - URL: https://doc.oltenrs.dev/?lang=en#tx-simulation - Group: SDK, Tools & Reference - Command: `oltenrs simulate --name --commands [--trace] [--visibility] [--diagnose] [--from-snapshot ] [--record] | oltenrs simulate ` - Compatibility: Requires the oltenrs runtime (POST /_simulate). Run locally or in CI for zero-side-effect pre-flight checks, traffic byte sizing, and privacy graphs before deploying to Scala Canton. Dry-run Daml transactions locally before submitting them to the network—previewing execution outcomes, traffic byte costs, synchronizer limits, authorization failures, and party-level visibility graphs without modifying ledger state. ## Why Simulate Before Submitting? On Canton Network, authorization gaps, archived contract references, oversized request batches (max_request_size), or insufficient traffic balance often surface only after a failed TestNet submission. Sub-transaction privacy adds another layer of complexity: verifying exactly which party sees each sub-event—and why—is hard to audit from Daml source alone. oltenrs simulate calls the participant's admin-only POST /_simulate endpoint (protected by an admin JWT), evaluates the exact same JSON payload as /v2/commands/submit-and-wait, and rolls back state immediately afterward. No matter how many times you run it, ledger end, completions, deduplication entries, and sequencer batch counts remain untouched. - **Sequencer-aligned integer byte costs**: When traffic control (τ) is active, cost estimation reuses the real confirmation request and response assembly path to report exact u64 byte counts within 1% of official sequencer charges. - **Pre-submit synchronizer limit checks**: Checks dynamic max_request_size (L1) and available traffic balance (L2) before submission, exiting with code 3 and a clear warning whenever a threshold would be breached. - **Redacted-by-default .simrun archives**: Recording a run with --record replaces contract argument values with SHA-256 redaction markers by default so teams and auditors can inspect results without exposing confidential payloads. ## Five-Stage Simulation Pipeline Each simulate invocation resolves the target participant, executes a dry-run rollback, computes traffic costs and limits, collects optional traces, and writes an immutable report bundle. ### oltenrs simulate request pipeline 01 · Target. **Resolve Instance & Admin JWT** — Discovers the participant endpoint and dev-auth admin JWT automatically from --name, or connects directly via --url and --token-file. 02 · Dry-Run. **Evaluate & Roll Back Ledger State** — POST /_simulate evaluates the command bundle, builds the LEDGER_EFFECTS tree and created/archived lists, and discards all state changes immediately. 03 · Cost & Limits. **Compute Traffic Bytes & Check L1/L2** — Measures serialized batch size to compute request, response, and total traffic bytes and evaluates max_request_size (L1) and traffic balance (L2). 04 · Trace & Views. **Collect CEK Traces & Visibility Matrix** — When --trace or --visibility is enabled, records per-node CEK step counts, missing authorizers, failing source locations, and per-party visibility reasons. 05 · Record. **Write Immutable .simrun Bundle** — Prints a deterministic JSON or text report and, with --record, atomically writes a SHA256SUMS-verified .simrun directory. *Exit codes: 0 accepted & limits ok · 3 predicted rejection, limit breach, or rerun diff · 2 invalid input or changed base state · 1 internal error.* ## Dry-Run, CEK Tracing (--trace) & Snapshot Forking (--from-snapshot) Use --name to dry-run a single command against a live local instance, or pass --from-snapshot to test multi-step 'what-if' sequences in complete isolation. --from-snapshot restores a local snapshot into an ephemeral directory on an auto-shifted port window, executes any setup bundles in --steps (JSONL), simulates the final command, and tears down every temporary process and directory on completion or SIGINT—leaving the original instance and snapshot file untouched. Because daemon snapshot self-bundles referenced .dar archives inside the snapshot archive with SHA-256 verification, --from-snapshot works portably even after the original working directory or relative DAR paths move or disappear. *Key Fields in SimulationReport* | Field | Values | What It Tells You | | --- | --- | --- | | outcome | accepted \| rejected | Whether live submission would succeed, plus official error.code on rejection | | cost | request · response · total (u64) | Integer traffic byte cost when τ is active (shows trafficControl: off otherwise) | | limits (L1) | max_request_size (ok \| exceeds) | Catches oversized request batches before hitting the synchronizer | | limits (L2) | Traffic balance (ok \| exceeds \| not-enforced) | Checks whether current balance covers cost.total when rate limiting is enabled | | trace (--trace) | steps · authorization.missing · location | Pinpoints the exact failing choice, missing party, and module/line/column | | diagnose (--diagnose) | traffic · contention · exposure · scu · routing | Reports traffic breakdown, contention hotspots (exit 3 with --fail-on-contention), wide observers (--max-observers), SCU, and routing | ### Example 1: Live Instance Dry-Run & Multi-Step Snapshot Fork Simulation ```bash # 1. Dry-run against dev1 with trace, visibility, diagnostics, and a rerun-ready .simrun # (Pass --include-payload for bundles you plan to rerun; omit for redacted sharing) oltenrs simulate --name dev1 \ --commands ./tx/settle-dvp.json \ --trace --visibility --diagnose \ --record ./simruns --include-payload # 2. Fork a local snapshot (.tar), apply setup --steps, and simulate final settlement cleanly oltenrs simulate \ --from-snapshot ./snapshots/dvp-ready.tar \ --steps ./tx/pre-allocations.jsonl \ --commands ./tx/final-settle.json \ --trace --diagnose --record ./simruns --include-payload ``` ## Immutable .simrun Records, Regression Rerun & Offline Viewers Each .simrun bundle stores manifest.json, input.json, report.json, optional trace.json and visibility.json, and SHA256SUMS (0700 dir, 0600 files). If even one byte is altered, simulate show and simulate rerun fail immediately with exit code 3. After upgrading a DAR or tuning synchronizer traffic parameters (τ), run oltenrs simulate rerun

to re-execute against the same base state and diff any behavioral or cost regressions. Because rerun needs the original command payloads, the bundle must have been recorded with --include-payload (default redacted bundles are for show, tui, and export only); rerunning a snapshot-forked bundle also requires passing --snapshot (or an explicit --name/--url/--state-dir). You can inspect bundles in the 5-tab terminal UI (simulate tui) or export a single offline HTML file (simulate export --html) for code review. - **5-tab terminal viewer (simulate tui)**: Switch across [t] Transaction Tree, [c] Cost & Size, [v] Visibility Matrix, [s] Trace, and [l] Limits. In --live mode, press [w] to persist the run to a .simrun directory. - **Standalone offline HTML visibility graph (simulate export --html)**: Opens as a single zero-network HTML file (CSP default-src 'none'). The overview section maps parties on the left to transaction nodes in the center with reason-coded SVG edges (falling back to the matrix table when parties > 8 or nodes > 24). | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--name \| --state-dir \| --url [--token-env \| --token-file ]` | - | `String / PathBuf` | - | Target named local instance (auto-resolving registry and dev-auth admin JWT), state directory, or explicit participant URL and admin token. | | `--commands ` | - | `PathBuf` | - | Command bundle JSON file (or - for stdin) matching /v2/commands/submit-and-wait. | | `--trace / --visibility` | - | `bool` | - | --trace records per-node CEK steps, authorization failures, and source locations; --visibility captures the 6-reason party visibility matrix (visibility.json). | | `--diagnose / --fail-on-contention / --max-observers ` | - | `bool / usize` | `--max-observers 5` | Collects traffic breakdown, contention hotspots, wide-observer exposure (warns above 5 by default), SCU, and routing diagnostics. --fail-on-contention implies --diagnose and exits 3 on any hotspot. | | `--from-snapshot [--steps ]` | - | `PathBuf` | - | Forks a local snapshot (.tar) into an ephemeral isolated instance, applies setup --steps, simulates the final command, and cleans up automatically. | | `--record [DIR] [--include-payload]` | - | `Option` | - | Saves an immutable .simrun bundle (defaults to /simruns/). Contract arguments are redacted by default; pass --include-payload (mode 0600) when recording bundles for simulate rerun. | | `rerun [--snapshot ] [--update]` | - | `subcommand` | - | Re-executes a --include-payload .simrun bundle against its base state to detect regressions (snapshot-fork runs require --snapshot; --update saves accepted diffs into a new bundle). | | `tui / export --html ` | - | `subcommand` | - | Launches the 5-tab terminal viewer or exports a deterministic, zero-network static HTML report. | ### Example 2: Verify .simrun Integrity -> Regression Rerun -> TUI & Static HTML Export ```bash # 1. List recorded runs and verify SHA256SUMS offline (works on redacted bundles too) oltenrs simulate list ./simruns oltenrs simulate show ./simruns/20261124T090000Z-a1b2c3d4.simrun # 2. Detect behavioral or cost regressions after a DAR or τ change (requires --include-payload; exits 3 on diff) oltenrs simulate rerun ./simruns/20261124T090000Z-a1b2c3d4.simrun # 2b. Snapshot-fork .simrun reruns require --snapshot (add --update to accept intentional diffs) oltenrs simulate rerun ./simruns/20261124T090500Z-e5f6a7b8.simrun \ --snapshot ./snapshots/dvp-ready.tar # 3. Open the 5-tab TUI or export a zero-network HTML report oltenrs simulate tui ./simruns/20261124T090000Z-a1b2c3d4.simrun oltenrs simulate export ./simruns/20261124T090000Z-a1b2c3d4.simrun --html ./dvp-sim-report.html ``` > **WARNING — Can I fork live MainNet state or convert traffic costs to CC/USD?**: No. To respect privacy and network boundaries, simulate supports local instances and local snapshot forks only. In addition, (1) --ide-ledger has no synchronizer topology or τ, so cost estimation exits with code 2; (2) costs are reported strictly in integer traffic bytes rather than CC or USD; and (3) multi-synchronizer reassignmentCosts remain empty in single-synchronizer mode. --- # Olten Studio, Read-Only MCP, Declarative Deploy & Tracing - URL: https://doc.oltenrs.dev/?lang=en#studio-mcp-deploy - Group: SDK, Tools & Reference - Command: `oltenrs ui [OPTIONS] | oltenrs mcp [OPTIONS] | oltenrs deploy [init|status] | oltenrs dar | oltenrs trace ` - Compatibility: Studio Live Inspector (ui), Read-Only MCP (mcp), Declarative Deploy (deploy), and offline DAR tools work with standard Ledger API v2 — including official Scala Canton 3.7.2 nodes. Plan-Hash and oltenrs trace target oltenrs daemons. Shipped in v0.9.0: inspect live participants in a zero-dependency web UI, connect AI coding agents safely through a compile-time read-only MCP server, deploy daml.yaml projects idempotently with pinned remote DARs, guard daemon changes with Plan-Hash, and trace multi-hop transactions with pure-Rust OpenTelemetry. ## 1. Olten Studio Local Web UI (oltenrs ui) oltenrs ui embeds a single-binary local web application (default 127.0.0.1:18080) with zero Docker, zero NPM, and zero external CDN requests. It provides two isolated tabs: an In-Memory Lab (Scenarios & Sandbox) for instant contract experimentation, and a strictly read-only Live Node Inspector. In Live Node Inspector mode, point --url at any standard Ledger API v2 participant — either a local oltenrs instance or an existing Scala Canton 3.7.x node — to browse Active Contract Sets (ACS), filter templates, stream SSE updates, inspect vetted DARs, and copy ready-to-run CLI/curl snippets. Passing --dar pre-loads local or remote DARs into the verified local cache at startup while preserving Zero-CDN isolation. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--name \| --state-dir \| --url [--participant

]` | - | `Target` | - | Target named daemon instance, explicit supervisor state directory, or Participant Ledger JSON API v2 URL (http://:). | | `--bind --port ` | - | `String / u16` | `127.0.0.1 / 18080` | HTTP listener bind address and port (protected hub ports are rejected with exit 2). | | `--dar ` | - | `String (repeatable)` | - | Local .dar file(s) or remote DAR source(s) (https://..., gh:owner/repo@tag/asset.dar) verified into the local cache at startup. | | `--token-env \| --token-file ` | - | `Auth` | - | Environment variable or file supplying a bearer JWT for authenticated Participant Ledger JSON API calls. | | `--allow-non-loopback --http-auth-token-env ` | - | `Security` | - | Explicit opt-in for non-loopback binding; requires --http-auth-token-env holding a shared bearer token for incoming HTTP requests. | | `--open` | - | `bool` | `false` | Automatically opens the local Studio URL in the default desktop browser after binding. | ### Launch Olten Studio against a oltenrs instance or an existing Scala Canton node ```bash # Attach to a named oltenrs daemon instance (default 127.0.0.1:18080; --open launches browser) oltenrs ui --name dev1 --open # Bind a custom port and pre-load a local DAR archive oltenrs ui --name dev1 --port 8090 --dar ./contracts/target/sample-contract.dar # Or inspect an existing Scala Canton 3.7.x Ledger JSON API node (strictly read-only) oltenrs ui --url http://127.0.0.1:7575 --token-env CANTON_JWT --port 8090 ``` *Binds strictly to loopback (127.0.0.1) with Host/Origin checks and zero external network assets. Binding non-loopback requires both --allow-non-loopback and --http-auth-token-env.* ## 2. Read-Only AI MCP Server (oltenrs mcp) oltenrs mcp exposes 11 built-in read-only tools (ledger_*, pqs_*, dar_*, daemon_doctor) covering ledger status, ACS queries, PQS projections, DAR package inspection, and daemon doctor diagnostics to AI coding assistants (Cursor, Claude Code, Antigravity) over stdio (default) or Streamable HTTP (default 127.0.0.1:18765, POST /mcp). Write and submit endpoints are excluded at compile time. Local file tools enforce --root sandbox boundaries, block symlink escapes, and never read ambient secrets outside explicitly scoped flags; pass --allowed-party to restrict ledger and PQS queries to specific parties. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--transport ` | - | `Enum` | `stdio` | Selects line-delimited JSON-RPC 2.0 over stdin/stdout (stdio, zero sockets) or stateless Streamable HTTP (POST /mcp). | | `--bind --port ` | - | `String / u16` | `127.0.0.1 / 18765` | HTTP listener bind address and port (--transport http only; protected hub ports exit 2). | | `--name \| --state-dir

\| --url [--participant

]` | - | `Target` | - | Target local daemon instance or external Participant Ledger JSON API v2 URL queried by ledger_* tools. | | `--root

/ --dar ` | - | `PathBuf` | `current directory (CWD)` | Sandbox root confining client-supplied .dar, .audit-pack, and manifest paths, plus an optional default DAR when tools omit dar_path. | | `--allowed-party (alias --party) / --max-items ` | - | `String / usize` | `--max-items 200 (1..=1000)` | Restricts ledger and PQS queries to specific party ID(s) (repeatable) and caps default list/query result counts. | | `--pqs-pg-url ` | `CANTON_RS_PQS_PG_URL` | `PostgreSQL URL` | - | Optional PostgreSQL URL enabling the read-only pqs_query_active and pqs_query_exercises tools. | | `--token-env \| --token-file ` | - | `Auth` | - | Environment variable or file supplying a bearer JWT for authenticated Participant Ledger JSON APIs. | | `--allow-non-loopback --http-auth-token-env ` | - | `Security` | - | Explicit opt-in for non-loopback HTTP binding; requires --http-auth-token-env for incoming bearer token auth. | ### Start Read-Only MCP over stdio (IDE agent) or loopback Streamable HTTP ```bash # Stdio transport for local AI coding agents (works with Scala Canton Ledger API v2; opens zero sockets) oltenrs mcp --transport stdio --url http://127.0.0.1:7575 --root . # Loopback Streamable HTTP transport with strict Host & Origin validation (default port 18765) oltenrs mcp --transport http --bind 127.0.0.1 --port 18765 --name dev1 \ --allowed-party "Alice::1220..." --max-items 200 ``` ## 3. Declarative Deploy & Remote DAR Registry (oltenrs deploy · dar) oltenrs deploy reconciles a daml.yaml or canton-deploy.yaml profile idempotently against a target participant: validating DAR archives, checking smart contract upgrade safety, uploading and vetting packages, allocating parties and user rights, and running init scripts. Use deploy init to scaffold a manifest and deploy status to inspect drift without mutating participants. Remote DAR references support https://, gh:/@/.dar, and oci:// registries backed by a content-addressed SHA-256 local cache (dar fetch, dar cache ls|clean, CANTON_RS_DAR_CACHE) and lockfile pinning (--frozen-lockfile, --offline) for reproducible CI builds. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `deploy init [--from-daml-yaml ] [-o ] [--force]` | - | `Init` | `-o canton-deploy.yaml` | Generates a starter canton-deploy.yaml manifest, optionally pre-populated from daml.yaml metadata and init-script. | | `deploy [--profile ] [-f ] [--dry-run] [--no-build] [--skip-scripts \| --re-run-scripts]` | - | `Deploy` | `--profile localnet / -f canton-deploy.yaml` | Reconciles the selected profile idempotently (or prints the plan with --dry-run) and controls build and script stages. | | `deploy status [--profile ] [-f ] [--format text\|json]` | - | `Status` | `localnet / text` | Inspects live remote status and pending deployment drift without writing to participants. | | `--offline / --frozen-lockfile / --refresh / --cache-dir ` | `CANTON_RS_DAR_CACHE` | `Remote DAR` | - | Resolves strictly from cache (--offline), exits 3 on lock.json SHA-256 drift (--frozen-lockfile), bypasses cache (--refresh), or overrides the cache directory. | | `dar fetch [--offline \| --refresh] / dar cache ]>` | `CANTON_RS_DAR_CACHE` | `DAR Cache` | - | Fetches and verifies remote DARs (https://, gh:, oci://) into the content-addressed cache and lists or cleans cached blobs. | | `dar check-upgrade [--downgrade-risk] [--fail-on-risk] [--format text\|json]` | - | `SCU Check` | `--format text` | Validates upgrade lineage and runs static SCU downgrade-risk analysis (--fail-on-risk exits 3 when risks are found). | ### Verify DAR upgrades offline, manage the remote DAR cache, and run idempotent deploy ```bash # 1. Offline Smart Contract Upgrade (SCU) & downgrade-risk check (exits 3 on risk) oltenrs dar check-upgrade ./v1.dar ./v2.dar --downgrade-risk --fail-on-risk --format json # 2. Fetch, inspect, and list remote DARs cached by SHA-256 content address oltenrs dar fetch https://example.org/releases/asset-v2.dar#sha256= oltenrs dar inspect https://example.org/releases/asset-v2.dar#sha256= oltenrs dar cache ls # 3. Initialize manifest from daml.yaml -> check live drift -> run frozen-lockfile CI deploy oltenrs deploy init --from-daml-yaml ./daml.yaml -o canton-deploy.yaml oltenrs deploy status --profile localnet -f canton-deploy.yaml --format json oltenrs deploy --profile localnet -f canton-deploy.yaml --frozen-lockfile --offline ``` ## 4. Plan-Hash Safety Gate, Routing Doctor & OTel Tracer (oltenrs Exclusive) For teams running oltenrs daemons, v0.9.0 adds Terraform-style Plan-Hash apply guards (compute a deterministic diff and 64-hex SHA-256 plan_hash with daemon plan, then apply with daemon apply --plan-hash so drifted manifests are rejected and pre-apply snapshots run automatically), multi-party actAs routing diagnostics (daemon doctor --check-routing --act-as ...), and a pure-Rust OpenTelemetry OTLP/HTTP tracing pipeline. Use oltenrs trace (trace update, trace party, trace trace-id) to reconstruct multi-hop transaction and view graphs across Participant, Sequencer, and Mediator spans in tree, JSON, or Graphviz DOT format. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `daemon plan [-f ] [--name ] [--out ] [--ttl-secs ] [--lsu-target-pv ]` | - | `Plan-Hash` | `--ttl-secs 900 / --lsu-max-pending-txs 100` | Computes manifest/DAR diffs, risk level, LSU pre-flight checks, and plan_hash without mutating state; writes mode-0600 JSON when --out is set. Compares each DAR's main_package_id against live loaded participant packages so unchanged DARs produce zero diff while genuine SCU upgrades are flagged HIGH. | | `daemon apply --plan-hash <64_HEX> [--plan-file ] [--quiesce-timeout-secs ]` | - | `Safe Apply` | `--quiesce-timeout-secs 30` | Applies changes only when recomputed plan_hash matches, taking an automatic pre-apply snapshot (--no-pre-snapshot-i-understand-risk is refused for HIGH/CRITICAL upgrades). | | `daemon doctor --check-routing --act-as [--read-as

] [--informees

] [--synchronizer ]` | - | `Routing Check` | - | Calls POST /_diagnose/routing on a live participant to verify multi-party actAs synchronizer routing readiness (exits 2 if --act-as is omitted). | | `trace \| party [--since-offset 0] [--template ] \| trace-id <32_HEX>>` | - | `Subcommands` | - | Traces multi-hop contract/transaction lineage by committed update ID, party visibility scope, or 32-hex lowercase W3C trace-id. | | `trace [--name \| --state-dir

\| --json-api-url ] [--pqs-pg-url ] [--xray-url ] [--max-hops ] [--format tree\|json\|dot]` | - | `Trace Options` | `--max-hops 8 (1..=32) / --format tree` | Configures target participant, optional PQS/X-Ray enrichment sources, traversal hop depth, output format (tree, json, dot), and auth (--token-env / --token-file). | ### Pre-flight routing check, Plan-Hash safe apply, and multi-hop trace view ```bash # 1. Check multi-party actAs synchronizer routing before submitting (--act-as required) oltenrs daemon doctor -f canton-daemon.yaml --name dev1 \ --check-routing --act-as "Alice::1220...,Bob::1220..." # 2. Compute deterministic Plan-Hash (read-only) -> apply with automatic pre-apply snapshot oltenrs daemon plan -f canton-daemon.yaml --name dev1 --out ./plan.json --format json oltenrs daemon apply -f canton-daemon.yaml --name dev1 \ --plan-hash <64_HEX_PLAN_HASH> --plan-file ./plan.json # 3. Reconstruct multi-hop lineage by W3C trace-id, update ID, or party oltenrs trace trace-id <32_HEX_W3C_TRACE_ID> --name dev1 --format tree oltenrs trace update --name dev1 --max-hops 8 --format dot oltenrs trace party "Alice::1220..." --name dev1 --since-offset 0 ``` --- # Embedded Ledger Rust SDK (CantonNodeBuilder) - URL: https://doc.oltenrs.dev/?lang=en#sdk-exex - Group: SDK, Tools & Reference - Command: `use ledger_json_api::{CantonNodeBuilder, CantonEmbeddedNode};` Embed the full Daml-LF ledger engine (ExecutionService) directly inside your host Rust process memory without spawning external servers or databases, and optionally expose a background HTTP port to connect external CLI tools. ## Why Embed the Ledger Directly Inside a Rust Process? Running Daml smart contracts normally requires starting separate participant and sequencer processes, then exchanging authenticated JSON or gRPC payloads over network sockets. For matching-engine prototypes, high-frequency risk simulators, and Rust backend integration tests, managing external containers and paying serialization round-trips adds unnecessary friction. Exported by the workspace ledger-json-api crate, CantonNodeBuilder instantiates the exact same ledger core used by oltenrs node json-api (Arc + the lf-eval Daml-LF interpreter) as an in-memory handle (CantonEmbeddedNode) inside your Rust binary. You can allocate parties, create and exercise contracts, and query privacy-filtered Active Contract Sets (ACS) through plain Rust method calls. - **Identical Daml-LF Verification and Authorization**: Rather than a simplified mock, it runs the production 5-stage bytecode typechecker and signatory, observer, and controller authorization engine. - **Direct In-Memory Calls Without Socket Overhead**: submit_create and submit_exercise commit synchronously in process memory so hundreds of integration test cases finish in milliseconds. - **Optional Port Bridge for CLI and Wallet Tools**: Calling serve_http_background exposes that exact in-memory ledger over a standard HTTP/WebSocket Ledger API v2 port on demand. > **WARNING — Can CantonNodeBuilder Form a Multi-Institution Distributed Consensus Network?**: No. CantonEmbeddedNode is a single-node, in-memory ledger with no external sequencer, mediator, BFT consensus, or PostgreSQL persistence. All contract state resets when the host process exits. For staging and production environments requiring multi-participant cryptographic consensus or durable storage, run oltenrs daemon or standalone protocol nodes (node participant, node sequencer, node mediator). ## How Does Rust SDK Code Connect to the oltenrs CLI? (3 Topologies) CantonNodeBuilder (library) and oltenrs node json-api (CLI binary) are not separate engines — they wrap the exact same ExecutionService and differ only in which binary owns main(). Choose one of the three topologies below based on how external tools interact with your app. ### How a Host Rust App and the oltenrs CLI Share One Ledger in Hybrid Bridge Mode 01 · Embed. **Initialize In-Memory Ledger** — Your host Rust binary loads .dar packages via CantonNodeBuilder and constructs a shared Arc in memory. 02 · Bridge. **Open Background HTTP Listener** — Calling node.serve_http_background("127.0.0.1:7575") spawns a background listener serving standard Ledger JSON API v2 against the same in-memory engine. 03 · CLI Call. **Run External CLI or Script Commands** — From a terminal, run oltenrs token balances --url http://127.0.0.1:7575 or oltenrs dar script --ledger-host 127.0.0.1 --ledger-port 7575 to submit transactions. 04 · Unified Stream. **Single Offset Sequence & In-Memory Delivery** — Commits originating from external CLI calls and direct Rust calls share one monotonic offset sequence and stream immediately into in-memory CantonExEx channels. *Passing "127.0.0.1:0" lets the OS assign a collision-free ephemeral port and returns the bound SocketAddr.* *Three Execution Topologies by Process Owner and External Tool Access* | Topology | Process Owner (Entrypoint) | Network Port | How CLI & External SDKs Connect | Recommended Use Cases | | --- | --- | --- | --- | --- | | 1) Pure In-Process | Your Rust app (CantonNodeBuilder::build) | None (in-memory calls) | No external processes; call Rust methods (submit_create, rx.recv) directly | cargo test suites, authorization fuzzing, ultra-low-latency simulation | | 2) Hybrid Bridge | Your Rust app + node.serve_http_background | Opens background HTTP / WS v2 (e.g., :7575) | oltenrs token --url, dar script --ledger-host, db pqs, and Wallet SDK hit the live Rust memory ledger | Run a Rust matching/risk engine while seeding tokens or inspecting state via CLI | | 3) Standalone CLI Server | oltenrs node json-api or daemon up | CLI server binds HTTP / gRPC | Zero custom Rust code; consume --exex-jsonl files and /v2/* HTTP/WS endpoints | Language-agnostic web backends, LocalNet, and multi-node deployments | ## Anatomy of Builder Inputs: Where Do synchronizer_id and .dar Paths Come From? String literals passed to CantonNodeBuilder are not arbitrary magic values — each maps directly to a Ledger API v2 wire field or Daml package identifier. Use the guide below to understand where each value comes from and when to customize it. - **Cargo.toml Crate Dependency (ledger-json-api)**: CantonNodeBuilder lives in the workspace crate crates/apps/ledger-json-api rather than an external registry. Reference it via a path dependency in your Cargo.toml. - **Meaning & Default of .synchronizer_id("core-sync::1220cantonrs")**: Every Ledger API v2 transaction and CantonExEx event requires a synchronizer_id (::) identifying the ordering domain. Because an embedded ledger has no external sequencer, it stamps a logical domain label — defaulting to "embedded-sync::1220cantonrs" if omitted. Override it only when downstream parsers or test fixtures assert a specific domain ID. - **Origin of .with_dar_file(...) and .with_dar_bytes(...)**: The engine must load a compiled Daml archive (.dar) to know template schemas and signatory rules. "contracts/target/sample-contract.dar" is the repository's built-in sample fixture (containing AssetHolding); in your own project, point to the .dar produced by dpm build (or daml build) or embed it statically with include_bytes!("..."). Calling build() runs the full 5-stage Daml-LF typechecker and rejects invalid archives upfront. - **Template Identifier Syntax (#package-name:Module:Template)**: In "#sample-contract:AssetHolding:AssetHolding", the leading #sample-contract refers to the package name declared in daml.yaml, followed by the Daml module name and template name. You can equally pass a 64-hex SHA-256 package ID (":Module:Template"), and inspect all modules and templates inside any archive with oltenrs dar inspect . *CantonNodeBuilder Configuration Methods & CantonEmbeddedNode Core API* | Method | Default / Return Type | Behavior | | --- | --- | --- | | .synchronizer_id(id) | "embedded-sync::1220cantonrs" | Sets the logical synchronizer ID stamped onto in-memory commit records and Ledger API v2 responses. | | .with_dar_file(path) / .with_dar_bytes(bytes) | None (repeatable) | Queues .dar archives from disk or embedded byte slices and runs 5-stage LF type verification on build(). | | .with_max_dedup(duration) | 3600s (1 hour) | Configures the in-memory command deduplication window rejecting duplicate command_id submissions. | | .with_auth(AuthConfig) | AuthConfig::disabled() | Configures HS256, RS256, ES256–512, or JWKS JWT enforcement when exposing HTTP via serve_http_background. | | node.allocate_party(hint) | Result | Allocates a full party identifier ("Alice::1220...") from a human-readable hint ("Alice"). | | node.submit_create(act_as, cmd_id, tpl, args) | Result<(u64, String), String> | Creates a contract authorized by act_as and immediately returns the committed (offset, contract_id). | | node.submit_exercise(act_as, cmd_id, tpl, cid, choice, arg) | Result | Exercises a choice on an active contract and returns the committed ledger offset. | | node.active_contracts_for_party(party) | Vec | Returns active contracts (ACS) filtered strictly by ledger stakeholder visibility for that party. | | node.serve_http_background(bind_addr) | Result<(SocketAddr, Arc, JoinHandle), String> | Starts HTTP/WS Ledger API v2 on a background thread; store false into the returned AtomicBool for clean shutdown. | ## Walkthrough Examples: Pure In-Process vs. Hybrid CLI Bridge Compare running contracts purely inside Rust memory with zero open sockets (Example 1) against opening a background HTTP bridge so standard oltenrs CLI commands can interact with the embedded Rust process (Example 2). ### Example 1: Cargo.toml Dependency & Pure In-Process Contract Lifecycle ```rust // Cargo.toml: // [dependencies] // ledger-json-api = { path = "../../crates/apps/ledger-json-api" } // serde_json = "1" use ledger_json_api::CantonNodeBuilder; use serde_json::json; fn main() -> Result<(), String> { // 1. Uses default logical synchronizer_id ("embedded-sync::1220cantonrs") when omitted let node = CantonNodeBuilder::new() .with_dar_file("contracts/target/sample-contract.dar") .build()?; // 2. Allocate parties (hint -> full "Alice::1220..." identifier) let alice = node.allocate_party("Alice")?; let bob = node.allocate_party("Bob")?; // 3. Create contract in memory (#package-name:ModuleName:TemplateName) let (create_offset, cid) = node.submit_create( &[alice.clone()], "cmd-issue-01", "#sample-contract:AssetHolding:AssetHolding", json!({ "bank": alice, "owner": alice, "auditor": bob, "assetSymbol": "KRW_NOTE", "amount": "5000000.0" }), )?; println!("Committed create at offset #{create_offset}, cid={cid}"); // 4. Inspect privacy-filtered Active Contract Sets (ACS) per party assert_eq!(node.active_contracts_for_party(&alice).len(), 1); assert_eq!(node.active_contracts_for_party(&bob).len(), 1); Ok(()) } ``` *Use oltenrs dar inspect contracts/target/sample-contract.dar beforehand to inspect exact package names, modules, and template fields inside any archive.* ### Example 2: Bridging External oltenrs CLI Commands via serve_http_background ```rust use std::sync::atomic::Ordering; use ledger_json_api::CantonNodeBuilder; fn main() -> Result<(), String> { let node = CantonNodeBuilder::new() .synchronizer_id("local-hybrid::1220cantonrs") .with_dar_file("contracts/target/sample-contract.dar") .build()?; let alice = node.allocate_party("Alice")?; let (addr, running, handle) = node.serve_http_background("127.0.0.1:7575")?; println!("Background Ledger JSON API v2 listening on http://{addr} (party={alice})"); // From another terminal, standard oltenrs CLI commands now hit this live Rust ledger: // $ oltenrs token balances --url http://127.0.0.1:7575 --party Alice // $ oltenrs dar script --dar my-tests.dar --script-name Main:smoke \ // --ledger-host 127.0.0.1 --ledger-port 7575 // $ curl -s http://127.0.0.1:7575/v2/parties // Signal clean shutdown when finished running.store(false, Ordering::Release); let _ = handle.join(); Ok(()) } ``` --- # Privacy-Scoped Execution Extensions (CantonExEx · /_exex) - URL: https://doc.oltenrs.dev/?lang=en#canton-exex - Group: SDK, Tools & Reference - Command: `node.subscribe_exex_with_backfill(...) | oltenrs node json-api --exex-jsonl ` Stream real-time post-commit and pruning notifications into in-process Rust channels or 0600 JSONL audit files under strict party-level visibility scopes (ExExPartyScope) without stalling ledger commits. ## How CantonExEx Works & Non-Blocking Guarantees Real-time risk circuit breakers, matching-engine mirrors, and compliance audit sinks need immediate notification when transactions commit, yet a slow or stalled downstream consumer must never block ledger commits or BFT ordering threads. CantonExEx is an Execution Extension bus wired directly into the post-commit path of ExecutionService. It captures both locally submitted transactions and multi-node transactions replicated from remote participants, applies per-subscriber privacy filtering, and dispatches events over bounded mpsc channels or a dedicated background JSONL writer thread. ### Four-Stage Isolation Pipeline from Ledger Commit to Subscriber 01 · Zero-Cost Gate. **Zero Overhead with Zero Subscribers** — When no active subscribers are registered (active_count == 0), the hook checks a single atomic counter and returns immediately without cloning or serializing events. 02 · Privacy Filter. **Stakeholder Intersection & Metadata Masking** — Each subscriber's ExExPartyScope drops unauthorized contract events and masks command_id to an empty string whenever none of the scoped parties submitted the command. 03 · Non-Blocking Push. **Non-Blocking try_send & Drop Accounting** — If a subscriber's bounded buffer is full, the commit thread never blocks; skipped events increment a counter surfaced in the next ExExNotification::Committed via dropped_since_last. 04 · Atomic Backfill. **Gapless Historical Catch-Up** — subscribe_exex_with_backfill holds the internal commit_publish_lock across historical replay and live channel registration, guaranteeing zero missed or duplicated events at the boundary. *When ledger pruning runs (evict_pruned_up_to), every subscriber receives ExExNotification::PrunedUpTo { offset } to keep downstream retention aligned.* > **TIP — When Should I Choose PQS vs. CantonExEx?**: Use oltenrs db pqs when you need ad-hoc SQL queries, relational joins, BI dashboards, or durable queryable history in PostgreSQL. Choose CantonExEx when you need microsecond in-process Rust reactions right after commit without database ingestion latency, or a lightweight 0600 JSONL audit stream on disk. ## Four Visibility Scopes (ExExPartyScope) & Zero-Payload Masking To preserve Canton's sub-transaction privacy guarantees across internal hooks and log sinks, every CantonExEx subscriber must declare one of the four explicit ExExPartyScope variants at registration time. *Comparison of the Four ExExPartyScope Visibility Modes* | Visibility Scope (ExExPartyScope) | Event Filter Rule | Contract Payload (create_arguments) | Primary Use Case | | --- | --- | --- | --- | | Parties(BTreeSet) | Passes only contracts intersecting signatory, observer, or witness for the party set | Cleartext JSON included (non-submitter command_id masked) | Per-client, per-desk, or per-fund real-time position mirroring and webhooks | | AllParticipantVisible | All create and archive events witnessed and validated by this participant | Full cleartext JSON and command_id included | Operator-wide internal risk engines and custom participant indexers | | ZeroPayloadMetadata | All participant-visible events (retains offset, template, contract ID, byte size) | Stripped to None + per-instance CSPRNG HMAC-SHA256 digest | Throughput and latency telemetry without exposing sensitive contract payloads (daemon top X-Ray) | | PartiesZeroPayload(BTreeSet) | Passes only events visible to the specified party set | Stripped to None + per-instance CSPRNG HMAC-SHA256 digest | Per-party activity rate and lifecycle monitoring without cleartext payload exposure | > **WARNING — Is the ZeroPayloadMetadata Digest a Cryptographic Zero-Knowledge Proof (ZKP)?**: No. The payload_digest emitted by ZeroPayloadMetadata and PartiesZeroPayload is an HMAC-SHA256 identifier keyed with an ephemeral per-instance salt drawn from the OS CSPRNG at startup (failing closed if OS entropy fails) to prevent cleartext contract arguments from leaking into monitoring logs. Do not treat it as a third-party verifiable zero-knowledge proof. ## Consuming Events: In-Process Rust Channels vs. Zero-Code CLI JSONL Inside a host Rust application, register channels via CantonNodeBuilder::install_exex or node.subscribe_exex_with_backfill to receive mpsc::Receiver directly. When running a standalone node via CLI without custom Rust code, pass --exex-jsonl to oltenrs node json-api (or node participant run) to stream events into an owner-only (0600) file and inspect live delivery counters via GET /_exex. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--exex-jsonl ` | - | `PathBuf` | - | [node json-api / node participant run] Streams ExExNotification JSON lines into an owner-only (0600) file via a dedicated background flush thread. | | `--exex-party ` | - | `String (repeatable)` | - | [node json-api] Restricts the JSONL stream to events where the specified party set is a stakeholder. Defaults to all participant-visible events when omitted. | | `--exex-zero-payload` | - | `bool` | `false` | [node json-api] Strips cleartext create_arguments and records only payload byte length plus a per-instance CSPRNG HMAC-SHA256 digest. | | `--exex-from-offset ` | - | `u64` | - | [node json-api] Atomically replays retained history starting from OFFSET (inclusive) before switching to live streaming (requires --exex-jsonl). | ### Example 1: Party-Isolated In-Process Subscription & Offset Backfill in Rust ```rust use std::collections::BTreeSet; use ledger_json_api::{CantonNodeBuilder, ExExNotification, ExExPartyScope}; use serde_json::json; fn main() -> Result<(), String> { let node = CantonNodeBuilder::new() .with_dar_file("contracts/target/sample-contract.dar") .build()?; let alice = node.allocate_party("Alice")?; let outsider = node.allocate_party("Outsider")?; // Scoped feed for Alice (backfilling from offset 1) vs. unrelated Outsider feed let (_backfill, rx_alice) = node.subscribe_exex_with_backfill( "alice-position-feed", ExExPartyScope::Parties(BTreeSet::from([alice.clone()])), Some(1), 256, ); let (_empty, rx_outsider) = node.subscribe_exex_with_backfill( "outsider-feed", ExExPartyScope::Parties(BTreeSet::from([outsider])), None, 256, ); node.submit_create( &[alice.clone()], "issue-bond-01", "#sample-contract:AssetHolding:AssetHolding", json!({ "bank": alice, "owner": alice, "auditor": alice, "assetSymbol": "USD_BOND", "amount": "10000000.0" }), )?; // Alice receives the Committed notification immediately; Outsider receives nothing match rx_alice.try_recv() { Ok(ExExNotification::Committed { offset, dropped_since_last, events, .. }) => { println!("Received offset=#{offset}, dropped={dropped_since_last}, events={}", events.len()); } other => return Err(format!("Unexpected notification state: {other:?}")), } assert!(rx_outsider.try_recv().is_err()); Ok(()) } ``` ### Example 2: Zero-Code CLI 0600 JSONL Streaming & /_exex Telemetry Check ```bash # Stream only Alice's events with cleartext payloads stripped, backfilling from offset 1 oltenrs node json-api \ --port 7575 \ --dar contracts/target/sample-contract.dar \ --exex-jsonl ./alice-audit.jsonl \ --exex-party "Alice::1220..." \ --exex-zero-payload \ --exex-from-offset 1 # Check active subscribers, delivered_notifications, and buffer-full dropped_notifications # (Requires a participant_admin Bearer JWT when HTTP authentication is enabled) curl -s http://127.0.0.1:7575/_exex | jq ``` --- # DAR Package Inspection, Codegen & Security Audit (dar) - URL: https://doc.oltenrs.dev/?lang=en#dev-tools - Group: SDK, Tools & Reference - Command: `oltenrs dar ` Unified under oltenrs dar: compare compiled .dar schemas, gate zero-downtime contract upgrades, run 5-stage LF validation, generate strongly typed Rust bindings, fuzz multi-party authorization, and sign selective-disclosure audit capsules (.audit-pack). ## Unified v0.9.0 dar Namespace (Consolidating Legacy dpm) Starting in v0.9.0, all compiled .dar utilities live under the single canonical oltenrs dar namespace. Legacy top-level oltenrs dpm (inspect-dar, validate-dar, codegen, fuzz, audit-pack, packages, tui, version) remains a 100% compatible hidden deprecated alias (scheduled for removal in v1.0.0), while the AI MCP server moved to top-level oltenrs mcp. *Subcommands Under the Unified oltenrs dar Namespace* | Capability Area | Core Responsibility | Canonical Subcommands (v0.9.0) | Typical Stage | | --- | --- | --- | --- | | Inspection, Upgrades & Remote Cache | Archive decoding, cross-version schema diffing, upgrade lineage gating, remote DAR cache, and live hot-reload | dar inspect · dar diff · dar check-upgrade · dar fetch · dar cache · daemon dar watch | Pre-deployment v1 -> v2 upgrade checks, pinned remote DARs, and automatic local daemon reloads | | Validation, Codegen, Security & Scripts | 5-stage LF type verification, typed codegen, authorization fuzzing, audit capsules, TUI, and Daml Script execution | dar validate · dar codegen · dar fuzz · dar audit-pack · dar packages · dar tui (top) · dar version · dar script | Generating Rust client types, CI security regression checks, external audit proofs, and script runs | > **NOTE — Does oltenrs dar Compile .daml Source Files Directly?**: No. oltenrs dar is a pure-Rust inspection, upgrade-checking, validation, codegen, fuzzing, and audit tool operating on already compiled .dar archives (it does not include an upstream package installer or .daml source compiler). Compile .daml sources into a .dar first using the official Daml SDK (dpm build or daml build). ## 1. dar & daemon dar watch: Schema Diff, Upgrade Gate & Live Hot-Reload Uploading an incompatible follow-up .dar onto a ledger that already holds active contracts causes runtime deserialization failures when reading contracts or exercising choices. oltenrs dar statically verifies package dependency graphs and type-lineage upgrade rules offline before upload. During iterative local development, oltenrs daemon dar watch --name watches your build output with debouncing (default 500ms) and automatically uploads and vets rebuilt archives across every running participant — provided check-upgrade passes first. - **dar inspect [--format text|json] [--offline] [--cache-dir ]**: Decodes the main package ID, Daml-LF version, modules, templates, choices, interfaces, and transitive package dependency graph (supports local paths as well as https://, gh:, and oci:// remote DARs). - **dar diff [--format text|json]**: Summarizes added, removed, and modified modules and templates matched by package name alongside upgrade compatibility results. - **dar check-upgrade [--downgrade-risk] [--fail-on-risk]**: Exits non-zero immediately if breaking changes (removed fields, altered field order or types, deleted choices) violate upgrade safety, and runs static downgrade-risk analysis with --downgrade-risk (use dar fetch / dar cache to manage the content-addressed remote DAR cache). ### Example 1: Inspecting Templates, Gating v1 -> v2 Upgrades & Watching a Live Daemon ```bash # 1. Inspect package name, modules, and templates inside a .dar as JSON oltenrs dar inspect contracts/target/sample-contract.dar --format json # 2. Enforce v1 -> v2 upgrade compatibility and inspect schema diffs in CI oltenrs dar check-upgrade ./releases/app-v1.dar ./target/app-v2.dar oltenrs dar diff ./releases/app-v1.dar ./target/app-v2.dar # 3. Auto-verify, upload, and vet rebuilt .dar files onto running daemon instance dev1 oltenrs daemon dar watch --name dev1 ./contracts/target/app.dar --debounce-ms 500 ``` > **IMPORTANT — Guarantees — Pre-Upload Upgrade Compatibility Gate**: daemon dar watch never blindly uploads rebuilt files: it runs check-upgrade against the currently loaded lineage first and rejects breaking .dar builds before upload, protecting active contracts on your running local network. ## 2. dar Static Validation, Rust Codegen, Auth Fuzzer, .audit-pack & TUI oltenrs dar checks smart-contract authorization surfaces and visibility isolation prior to deployment, generates strongly typed Rust structs for host applications, and builds selective-disclosure cryptographic capsules that prove a single transaction view to external auditors without exposing unrelated counterparties. - **dar validate & dar codegen --lang **: Runs SHA-256 package hash verification plus the exact 5-stage LF bytecode typechecker used on participant upload (hidden alias validate-dar), and emits strongly typed Rust definitions or JSON Schemas for templates, records, choices, and interfaces. - **dar fuzz [--seed ] [--seeds ] [--steps ]**: Drives an in-memory CantonNodeBuilder with deterministic SplitMix64 seeds to test authorized creation, unauthorized choice rejection (DAML_AUTHORIZATION_ERROR), and Ledger API ACS visibility isolation, reporting PASS, INCONCLUSIVE, or FAIL (empirical dynamic testing, not a formal mathematical proof of 100% security). - **dar audit-pack **: Takes a user-supplied JSON array of transaction subviews (--views-json), keeps only --disclose-index in cleartext (DisclosedViewPayload), blinds sibling views into length-prefixed SHA-256 Merkle hashes, and signs/verifies offline with Ed25519 (--expected-signer-hex, alias --expected-signer-key-hex) without database access (does not auto-extract live participant DB views or sequencer signatures). - **dar packages [--dar ] · dar tui [DAR] (alias dar top) · dar version**: Supports runtime DAR package registration/listing (packages), the 3-tab interactive security TUI (dar tui / dar top), and SDK/Daml-LF version reporting (dar version). For AI coding agents, use the top-level oltenrs mcp --dar server. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `dar inspect [--format text\|json] / dar validate ` | - | `Inspect & Verify` | - | Prints package IDs, modules, and templates, and runs SHA-256 archive hash verification plus 5-stage LF static typechecking. | | `dar codegen --lang ` | - | `Codegen` | - | Emits strongly typed Rust bindings or JSON Schemas for templates, records, variants, and choices to stdout. | | `dar fuzz [--seed ] [--seeds ] [--steps ] [--json]` | - | `Security Fuzzer` | - | Deterministically tests unauthorized choice rejection (DAML_AUTHORIZATION_ERROR) and Ledger API party visibility isolation. | | `dar audit-pack ] \| verify [--expected-signer-hex ]>` | - | `Selective Disclosure` | - | Creates or offline-verifies blinded Merkle selective-disclosure capsules (.audit-pack) from user-provided view JSON (also accepts --expected-signer-key-hex alias). | | `dar packages [--dar ] / dar tui [DAR] (alias top) / dar version` | - | `Packages, TUI & Version` | - | Registers/lists runtime DAR packages, opens the 3-tab interactive DAR security analyzer TUI, or prints supported Daml-LF and SDK versions (use top-level oltenrs mcp for AI MCP). | ### Example 2: 5-Stage Static Validation, Typed Rust Codegen & Multi-Party Auth Fuzzing ```bash # Run upload-equivalent 5-stage Daml-LF static bytecode verification oltenrs dar validate contracts/target/sample-contract.dar # Generate strongly typed Rust structs to eliminate raw JSON typos in client code oltenrs dar codegen contracts/target/sample-contract.dar --lang rust > src/generated_contracts.rs # Run 4 deterministic seeds x 8 steps checking unauthorized rejection & ACS visibility isolation oltenrs dar fuzz contracts/target/sample-contract.dar --seeds 4 --steps 8 ``` ### Example 3: Signing & Offline Verification of .audit-pack Capsules, Security TUI & Version ```bash # Disclose only subview 0 from tx-views.json, blind sibling views into Merkle hashes, and sign oltenrs dar audit-pack create \ --views-json ./tx-views.json \ --disclose-index 0 \ --signing-key-file ./auditor-ed25519.key \ -o ./settlement-view0.audit-pack # Verify selective-disclosure root integrity offline against an expected public key (--expected-signer-key-hex alias accepted) oltenrs dar audit-pack verify ./settlement-view0.audit-pack --expected-signer-hex # Launch 3-tab interactive security TUI (alias dar top), inspect packages/version, or start top-level MCP oltenrs dar tui contracts/target/sample-contract.dar oltenrs dar packages --dar contracts/target/sample-contract.dar oltenrs dar version oltenrs mcp --dar contracts/target/sample-contract.dar ``` --- # Daml Script, Parallel Test Runner & Daemon Audit (dar script · test · daemon audit) - URL: https://doc.oltenrs.dev/?lang=en#script-localnet - Group: SDK, Tools & Reference - Command: `oltenrs dar script --dar --script-name [--cost-report] | oltenrs test --dar [-j N] | oltenrs daemon ` Execute compiled Daml Script scenarios in memory or against a live participant node, and run deterministic-port CI cluster lifecycles with binary dynamic-link auditing (daemon audit). ## 1. dar script: Fast In-Memory Scenarios (--ide-ledger) vs. Live Participant (--ledger-host) oltenrs dar script interprets compiled Daml Script functions (--script-name Module:Function) inside a .dar directly in Rust without spawning a JVM Daml SDK runtime (legacy top-level script remains a hidden deprecated alias in v0.9.0 and is scheduled for removal in v1.0.0). Switch seamlessly between two execution backends across your workflow: use --ide-ledger for fast, database-free iteration on business branching and simulated time (setTime), then switch to --ledger-host and --ledger-port to run the exact same script against a live participant (or hybrid CantonNodeBuilder port) before deployment. > Diagram — **Two Execution Backends for Daml Script Across Testing Stages**: Iterate on contract logic and static time in milliseconds with --ide-ledger, then validate auth, vetting, and consensus with --ledger-host. *Comparing --ide-ledger In-Memory Mode vs. --ledger-host Live Participant Mode* | Dimension | --ide-ledger (In-Memory Ledger) | --ledger-host / --ledger-port (Live Participant) | | --- | --- | --- | | State Persistence | Process memory only (discarded on exit) | Target participant's file or PostgreSQL store | | Ledger Clock (Time) | Static Time (starts 1970-01-01 · movable via setTime) | Real participant and synchronizer consensus wall clock | | Allocated Party IDs | Lightweight test suffix (e.g., alice-d4d95138) | Cryptographic namespace fingerprint (e.g., alice::1220...) | | Contract ID Format | Daml-LF in-memory test sequence | Canton V12 Unicum cryptographic hash | | Package Prerequisite | Loads --dar directly into memory for the run | Target participant must already have the DAR uploaded and vetted | | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--dar & --script-name ` | - | `PathBuf / String` | - | Path to the compiled .dar archive and fully qualified Daml Script entrypoint (e.g., Main:setup). | | `--ide-ledger [--static-time]` | - | `bool` | - | Executes immediately inside the embedded in-memory ScriptHost under static time (epoch 1970-01-01) with no external node. | | `--ledger-host & --ledger-port ` | - | `String / u16` | - | Connects to a running participant's HTTP JSON Ledger API v2 endpoint and submits script steps as real ledger commands. | | `--user-id & --output-file ` | - | `String / PathBuf` | `participant_admin` | Ledger user identifier for remote command submission and optional file path to serialize the final script result as JSON. | | `--token-env / --token-file ` | - | `Auth` | - | Environment variable or file supplying a bearer JWT for remote --ledger-host calls (mutually exclusive). | | `--cost-report [--cost-report-format text\|json] [--cost-report-file ]` | - | `bool / PathBuf` | - | When running against --ledger-host, calls prepare right before each submission to record per-submission traffic byte costs and integer template/choice aggregates in a separate report file (exits 2 with --ide-ledger). | ### Example 1: Fast In-Memory Validation Followed by Live Participant Execution (:7575) ```bash # 1. Run in memory (--ide-ledger) and write the script return value to JSON oltenrs dar script \ --dar contracts/target/sample-contract.dar \ --script-name Main:setup \ --ide-ledger \ --output-file ./script-result.json # 2. Run the exact same script against a live participant (or serve_http_background on :7575) oltenrs dar script \ --dar contracts/target/sample-contract.dar \ --script-name Main:setup \ --ledger-host 127.0.0.1 \ --ledger-port 7575 \ --user-id participant_admin ``` > **WARNING — Why Can a Script Pass on --ide-ledger Yet Fail Against --ledger-host?**: --ide-ledger executes inside one memory space with static time and synthetic party grants, bypassing JWT claim checks, asynchronous multi-node topology propagation, unvetted package rejections, and real-time clock skew. Always run your scenarios against --ledger-host as an integration gate before production release. ## 2. test: Parallel Daml Script Test Runner (oltenrs test) oltenrs test --dar discovers every top-level Script a test in the main package and runs each one inside its own fresh, isolated in-memory ledger (--ide-ledger, static time) across -j N parallel workers. Results are independent of execution order and concurrency, with built-in JUnit XML (--format junit) output for CI pipelines. - **Output formats (--format)**: Choose text (default terminal summary), json (deterministic key-sorted JSON report), or junit (XML 1.0 for CI). Pass --output to write atomically to disk. - **Contention & exposure diagnostics (--diagnose)**: Collects IDE-ledger contention hotspots and wide-observer warnings (--max-observers); add --fail-on-contention to exit 3 whenever a hotspot is detected. - **Order-independence check (--shuffle-seed)**: Shuffles execution order with a deterministic PRNG seed to verify scripts have no hidden cross-test dependencies. - **Exit codes**: 0 (all passed) · 2 (invalid flags, DAR load, or zero matches) · 3 (test failure or contention hotspot) · 1 (internal error) ### Example 2: Parallel Script Suite with JUnit Output & Remote Script Cost Report ```bash # 1. Discover and run all Script a definitions across 8 isolated workers (exits 3 on any failure) oltenrs test --dar contracts/target/sample-contract.dar \ --match "Main:*" -j 8 --format junit --output ./test-results.xml # 2. Generate per-submission integer traffic cost report against a live participant oltenrs dar script --dar contracts/target/sample-contract.dar --script-name Main:setup \ --ledger-host 127.0.0.1 --ledger-port 7575 \ --cost-report --cost-report-format json --cost-report-file ./cost-report.json ``` ## 3. daemon & daemon audit: CI Cluster Lifecycle & Pure-Binary Link Audit Starting in v0.9.0, multi-node local lifecycle management and binary dynamic-link auditing are unified under oltenrs daemon (legacy top-level localnet remains a hidden deprecated alias scheduled for removal in v1.0.0). In CI pipelines, pre-check ports and hub collisions with oltenrs daemon doctor, boot an isolated cluster via oltenrs daemon up --name ci --port-offset --dev-auth -d, and guarantee zero orphan processes with oltenrs daemon remove --name ci --force in an EXIT trap. In addition, oltenrs daemon audit (replacing localnet audit) inspects the binary's OS dynamic-library linkage table to verify zero JVM or unexpected non-system shared-library dependencies. Cross-verification oracle images and JAR digests are SHA-256 pinned in docker/oracle-images.tsv under a strict --pull=never policy, failing immediately with exit code 3 (exit 3) whenever an artifact is missing or drifted. ### Example 3: Binary Dynamic-Link Audit (daemon audit), Isolated CI Boot & Zero-Orphan Cleanup ```bash # 1. Audit binary dynamic libraries to verify zero JVM or unexpected external linkage oltenrs daemon audit # 2. Boot an isolated local cluster on a deterministic port offset -> inspect status -> clean up oltenrs daemon init --template localnet --with-sample-dar -o ./canton-daemon.yaml oltenrs daemon up -f ./canton-daemon.yaml --name ci --port-offset 100 --dev-auth -d oltenrs daemon status --name ci --format json oltenrs daemon remove --name ci --force # 3. Reference CI lifecycle (doctor -> up --name ci -> contract check -> trap cleanup on pass/fail) bash scripts/ci-localnet-example.sh ``` > **TIP — Do Existing oltenrs localnet Scripts Still Work in v0.9.0?**: Yes. Legacy oltenrs localnet up and localnet audit remain 100% functional as hidden deprecated aliases in v0.9.0, emitting a single-line notice to stderr (suppressible with CANTON_RS_NO_DEPRECATION_WARNINGS=1). Prefer canonical oltenrs daemon up --name -d and oltenrs daemon audit in new scripts and CI workflows. --- # v0.9.0 CLI Hierarchy, Admin gRPC & Environment Variable Reference - URL: https://doc.oltenrs.dev/?lang=en#reference - Group: SDK, Tools & Reference - Command: `oltenrs --help (13 canonical commands) | grpcurl -plaintext 127.0.0.1: ... | CANTON_RS_*` Reference for the v0.9.0 3-group 13-command CLI hierarchy and legacy alias mapping, participant control-plane Admin gRPC v30 services (--admin-port), and CANTON_RS_* environment variables that keep credentials out of process arguments. ## 1. v0.9.0 CLI Hierarchy & Legacy Compatibility Table In v0.9.0, the top-level oltenrs CLI is organized into 3 groups and 13 canonical commands: (1) Develop & Verify (test, simulate, deploy, ui, mcp, trace, console), (2) Cluster & Token (daemon, token), and (3) Domain Namespaces (node, dar, splice, db). All 10 legacy top-level commands remain 100% functional in v0.9.0 as hidden deprecated aliases (#[command(hide = true)]). Invoking a legacy alias emits a 1-line warning to stderr (never stdout, preserving JSON pipelines) that can be suppressed via CANTON_RS_NO_DEPRECATION_WARNINGS=1 (or true). All 10 legacy aliases are scheduled for removal in v1.0.0. *v0.9.0 Legacy Top-Level Aliases (10) → Canonical Commands (13-Command Hierarchy)* | Legacy Command (Hidden Alias in v0.9.0) | Canonical Command (v0.9.0) | Notes & Removal Schedule | | --- | --- | --- | | oltenrs participant ... | oltenrs node participant ... | Moved under node · removed in v1.0.0 | | oltenrs sequencer ... | oltenrs node sequencer ... | Moved under node · removed in v1.0.0 | | oltenrs mediator ... | oltenrs node mediator ... | Moved under node · removed in v1.0.0 | | oltenrs json-api ... | oltenrs node json-api ... | Moved under node · removed in v1.0.0 | | oltenrs ledger-api ... | oltenrs node ledger-api ... | Moved under node · removed in v1.0.0 | | oltenrs dpm ... | oltenrs dar ... (dpm mcp → oltenrs mcp) | inspect-dar→dar inspect, validate-dar→dar validate · removed in v1.0.0 | | oltenrs script ... | oltenrs dar script ... | Moved under dar · removed in v1.0.0 | | oltenrs scan ... | oltenrs splice scan ... | Moved under splice · removed in v1.0.0 | | oltenrs pqs ... | oltenrs db pqs ... | Moved under db · removed in v1.0.0 | | oltenrs localnet ... | oltenrs daemon ... (localnet audit → daemon audit) | Unified under daemon · removed in v1.0.0 | ## 2. Participant Admin gRPC Control Plane (--admin-port) Every participant node strictly separates its network listeners into two planes: client applications and wallets submit and query contracts over the data-plane Ledger API (--port / --grpc-port), whereas node operators, oltenrs console, and daemon dar watch perform privileged administration over the control-plane Admin gRPC port (--admin-port, e.g., 6502). Deployment scripts and Kubernetes readiness probes can query or automate these com.digitalasset.canton.admin.participant.v30 services directly with grpcurl or any standard gRPC client. *Implemented Participant Admin gRPC (com.digitalasset.canton.admin.participant.v30) Services* | gRPC Service | Key RPC Methods | Operational Role | | --- | --- | --- | | grpc.health.v1.Health | Check | Standard container orchestrator and load-balancer health probe (returns SERVING) | | IdentityInitializationService | GetId | Queries the participant's unique identifier (UID) and cryptographic namespace fingerprint | | ParticipantStatusService | ParticipantStatus | Reports node uptime, connected synchronizers, and active protocol versions | | PackageService | ListDars, UploadDar, GetDar, VetDar, RemoveDar, ListPackages | Uploads and extracts DAR bytes, vets packages, and removes unused DARs safely | | PruningService / ParticipantPruningService | Prune, GetSafePruningOffset | Computes safe pruning offsets respecting deduplication windows and prunes historical records | | TopologyManagerRead/WriteService | List*, Authorize, GenerateTransactions | Queries party, participant, and synchronizer topology mappings and authorizes signed changes | | PingService | Ping, Bong | Auto-loads the built-in Ping workflow and measures end-to-end consensus round-trip latency | | SynchronizerConnectivityService | ListConnectedSynchronizers, Connect, Disconnect | Lists active synchronizer connections and dynamically switches domain connectivity | ### Example 1: Inspecting Participant Admin Port (:6502) Status & Safe Pruning Offset via grpcurl ```bash # Query participant UID and connected synchronizer status grpcurl -plaintext 127.0.0.1:6502 com.digitalasset.canton.admin.participant.v30.IdentityInitializationService/GetId grpcurl -plaintext 127.0.0.1:6502 com.digitalasset.canton.admin.participant.v30.ParticipantStatusService/ParticipantStatus # List vetted DARs and compute the current safe pruning offset grpcurl -plaintext 127.0.0.1:6502 com.digitalasset.canton.admin.participant.v30.PackageService/ListDars grpcurl -plaintext 127.0.0.1:6502 com.digitalasset.canton.admin.participant.v30.ParticipantPruningService/GetSafePruningOffset ``` > **WARNING — Should --admin-port Ever Be Exposed to Untrusted Networks?**: Never. The Admin gRPC port is a privileged control channel capable of removing packages, authorizing topology transactions, and pruning ledger history. Bind it strictly to loopback (127.0.0.1) or an internal management subnet protected by mTLS. Unported upstream management RPCs are never silently ignored — they deterministically return gRPC status UNIMPLEMENTED. ## 3. Environment Variables (CANTON_RS_*) & Hidden Compatibility Flags Configuration values resolve in strict precedence order: explicit CLI flag > process environment variable (CANTON_RS_*) > manifest or config-file default. Supplying database URLs and signing secrets through environment variables (or a .env file beside canton-daemon.yaml) keeps credentials out of host process tables. | Flag | Env | Type | Default | Description | | --- | --- | --- | --- | --- | | `--canton-conf ` | `CANTON_RS_CANTON_CONF` | `PathBuf` | - | [daemon / node json-api / node ledger-api] Path to an upstream HOCON configuration file (canton.conf) parsed at startup. | | `--pg-url ` | `CANTON_RS_PG_URL` | `PostgreSQL URL` | - | [node json-api] PostgreSQL connection string storing standalone-mode commit journals and checkpoint snapshots. | | `--state-pg-url ` | `CANTON_RS_STATE_PG_URL` | `PostgreSQL URL` | - | [node participant / node sequencer / node mediator] PostgreSQL connection string storing protocol node state (canton_rs_state). | | `--pg-url / --token / --token-env (PQS)` | `CANTON_RS_PQS_PG_URL / CANTON_RS_PQS_TOKEN` | `PostgreSQL URL / JWT` | - | [db pqs] PostgreSQL connection string for read-optimized contract projections (pqs_contracts, pqs_exercises) and Bearer JWT for db pqs sync (or pass --token-env for a custom env var). | | `--ord-pg-url ` | `CANTON_RS_ORD_PG_URL` | `PostgreSQL URL` | - | [node sequencer bft-peer] PostgreSQL connection string storing BFT orderer epochs, consensus, and batches (11 ord_* tables). | | `--password-file (db)` | `PGPASSWORD` | `Password / PathBuf` | - | [db migrate\|stats\|archive\|takeover\|tui] Supplies PostgreSQL credentials via standard PGPASSWORD or --password-file without exposing secrets in process arguments. | | `--token-env / --token-file ` | - | `Auth` | - | [dar script / db pqs / token / simulate / trace / ui / mcp] Reads a Bearer JWT from the named environment variable or file path without exposing plaintext secrets in ps output. | | `--otel-endpoint ` | `OTEL_EXPORTER_OTLP_ENDPOINT` | `OTLP/HTTP URL` | - | [node json-api] OpenTelemetry OTLP/HTTP collector URL (e.g. http://127.0.0.1:4318; zero-overhead no-op when unset). | | `--otel-sample-ratio-bps / --otel-max-queue-size ` | `CANTON_RS_OTEL_SAMPLE_RATIO_BPS / CANTON_RS_OTEL_MAX_QUEUE_SIZE` | `u32 / usize` | `10000 (100%) / 2048` | [node json-api] Deterministic trace sampling ratio in integer basis points (0..=10000; error spans always sampled) and bounded async OTLP batch queue size. | | `--cache-dir ` | `CANTON_RS_DAR_CACHE` | `PathBuf` | - | [dar / deploy / ui] Overrides the local content-addressed (SHA-256) cache directory for remote DARs (https://, gh:, oci://). | | `--state-pg-url (Splice)` | `CANTON_RS_SPLICE_STATE_PG_URL` | `PostgreSQL URL` | - | [splice serve] PostgreSQL connection string storing wallet tracking_id idempotency records and automation worker locks. | | `--pg-url (legacy localnet up)` | `CANTON_RS_LOCALNET_PG_URL` | `PostgreSQL URL` | - | [localnet up (deprecated)] Supplies the state PostgreSQL URL for the hidden legacy localnet up alias without exposing passwords in process arguments (prefer daemon up --pg-url). | | `--token / --user-token` | `CANTON_RS_LEDGER_TOKEN / CANTON_RS_LEDGER_USER_TOKEN` | `JWT` | - | [splice / client] Admin Bearer JWT for participant management operations and standard user Bearer JWT for command submission. | | `--auth-unsafe-secret ` | `CANTON_RS_SPLICE_AUTH_UNSAFE_SECRET` | `String` | - | [splice serve] Shared HS256 secret used to verify local/test Wallet HTTP API Bearer tokens. | | `--ledger-host / --ledger-port (Splice)` | `CANTON_RS_SPLICE_LEDGER_HOST / CANTON_RS_SPLICE_LEDGER_PORT` | `String / u16` | - | [splice serve] Hostname and port of the external participant JSON Ledger API v2 server. | | `--snapshot-every ` | `CANTON_RS_SNAPSHOT_EVERY` | `u64` | - | [node json-api] Checkpoint interval writing a fast-recovery state snapshot every N ledger mutations. | | `CANTON_RS_NO_DEPRECATION_WARNINGS` | `CANTON_RS_NO_DEPRECATION_WARNINGS` | `1 \| true` | - | [all legacy aliases] Set to 1 or true to suppress the 1-line stderr deprecation warning emitted when invoking hidden v0.9.0 legacy top-level aliases (dpm, script, scan, pqs, localnet, participant, sequencer, mediator, json-api, ledger-api). | | `CANTON_RS_LOG` | `CANTON_RS_LOG` | `Log Filter` | - | [all crates] Enables gated internal library diagnostic output (library stderr output stays silent when unset). | | `ORACLE_IMAGES_TSV / XDG_STATE_HOME` | `ORACLE_IMAGES_TSV / XDG_STATE_HOME` | `Path` | - | [oracle-image.sh / daemon] Overrides the SHA-256 pinned oracle manifest path (docker/oracle-images.tsv) and daemon instance registry root ($XDG_STATE_HOME/canton-rs/). | | `--same-identity` | - | `bool` | - | [daemon] Reads existing keys from PostgreSQL common_crypto_private_keys to boot with the exact same node identity as an existing JVM participant. | | `--host-adopted-parties` | - | `bool` | - | [node json-api] Automatically hosts local-namespace parties inherited via --same-identity on newly connected synchronizers. | | `--no-tty / --log-profile / --log-file-appender` | - | `Compat Flag` | - | [daemon] Accepts legacy JVM launch-script CLI flags without argument-parsing errors during drop-in cutover. | > **IMPORTANT — Why Supply Passwords and Tokens via Environment Variables Instead of CLI Flags?**: Passing secrets directly on the command line (such as --pg-url postgres://user:pass@...) exposes cleartext credentials in ps output and /proc//cmdline to other local users. Injecting them via CANTON_RS_* environment variables leaves process arguments clean and automatically masks sensitive keys as **** in daemon inspect and daemon top.