sim-cli 0.22.0

CLI tool for running and comparing Solana simulator backtests
Documentation

sim-cli

sim runs Termina simulator sessions over historical Solana slots from the command line. Replay a slot range, swap in a new program binary or account overrides, and compare the results with the onchain outcome or with another run.

This guide covers what each command is for. Every flag is documented in sim <command> --help; guides and concepts are in the Termina docs.

Install

mkdir -p "$HOME/.local/bin"
curl -fsSL https://cli.simulator.termina.technology/install.sh | INSTALL_DIR="$HOME/.local/bin" bash
sim --version

Or build it from crates.io (needs Rust 1.97 or newer):

cargo install sim-cli --locked --version 0.22.0

sim update replaces the binary with the latest prebuilt one. Prebuilt binaries track the main branch, so pin a version with cargo install when you need a reproducible install.

Commands

Command What it is for
sim run Replay a slot range, optionally with a new program binary, account overrides or rerouted swaps, and write the results as NDJSON
sim compare Diff two sim run output files: regressions, improvements, logs, compute units, balances
sim summarize Print the totals of one output file
sim ranges List the slot ranges the server can replay
sim usage Show your API key's usage
sim bundle Build, inspect and delete your custom bundles
sim depth Request and track venue-depth datasets
sim datasets credentials Print read-only S3 credentials for the datasets
sim update Replace sim with the latest prebuilt binary

Networked commands read your key from SIMULATOR_API_KEY.

Test a new program binary

export SIMULATOR_API_KEY=<your key>
sim ranges

sim run --start-slot <start> --end-slot <end> --program-id <program> \
  --output-file baseline.ndjson
sim run --start-slot <start> --end-slot <end> --program-id <program> \
  --program-so ./target/deploy/program.so --output-file experiment.ndjson

sim compare baseline.ndjson experiment.ndjson

Gate CI on regressions

With --fail-on-diff, sim compare exits with status 1 when the selected section has an entry:

set -e
sim compare baseline.ndjson experiment.ndjson regressions --fail-on-diff
sim compare baseline.ndjson experiment.ndjson compute-units --fail-on-diff \
  --compute-units-threshold 5

Reroute swaps

# Reroute the range's swaps through the router
sim run --start-slot <start> --end-slot <end> --program-id <program> --reroute-order-flow

# Price them on your own venue's instructions instead
sim run --start-slot <start> --end-slot <end> --program-id <program> \
  --reroute-order-flow venue --venue-templates templates.json

The template format is in File formats.