For the complete documentation index, see llms.txt. This page is also available as Markdown.

Replaying the Market

1

Select Time Window

Check if the range matches any prebuilt bundles, which cover the past 30 days. If needed, filter the search with --after <DATE> or --before <DATE>.

sim ranges
Start Time (UTC)               End Time (UTC)                 Start Slot      End Slot        Bundle Size     Kind            Scope
----------------------------------------------------------------------------------------------------------------------------------
2026-06-30T17:53:10Z           2026-06-30T19:00:53Z           429,926,541     429,936,540     10,000          account_state   global
2026-06-30T18:23:38Z           2026-06-30T18:27:02Z           429,931,041     429,931,540     500             account_state   global
2026-07-19T05:50:16Z           2026-07-19T07:00:13Z           433,838,452     433,848,451     10,000          account_state   global

For ranges older than 30 days or ones that fall between prebuilt bundles, build a custom one instead.

sim bundle build --start-slot 400000000 --end-slot 400001000
2

Run a Baseline

Start a session to replay transactions and capture the existing behavior. If the range is covered by multiple bundles, use --parallel to split the work between concurrent sessions.

# Baseline
sim run \
  --start-slot 400000000 \
  --end-slot 400001000 \
  --program-id <PROGRAM_ID> \
  --output-file baseline.json

This generates a newline-delimited JSON file that contains the results of the run.

baseline.json
{
  "metadata": {
    "start_slot": 400000000,
    "end_slot": 400001000,
    "program_id": "<PROGRAM_ID>",
    "session_ids": ["..."],
    "timestamp": "2026-05-29T03:06:07Z"
  },
  "transactions": [
    {
      "slot": 400000042,
      "signature": "<BASE58_SIG>",
      "success": true,
      "error": null,
      "logs": ["Program log: ...", "..."],
      "sol_changes": { "<PUBKEY>": -5000000 },
      "token_changes": { "<PUBKEY>": { "<MINT>": -1000 } },
      "account_diffs": { "<PUBKEY>": { "before": "...", "after": "..." } }
    }
  ],
  "summary": {
    "total": 847,
    "successes": 831,
    "failures": 16
  }
}

sim provides a helper that reads the JSON to summarize the run's output.

sim summarize baseline.json
File         : baseline.json
Slot range   : 400000000 → 400001000
Program IDs  : <PROGRAM_ID>
Session(s)   : 10
Ran at       : 2026-05-29 03:06:07 UTC

i Transactions : 205308  (96972 successes, 108336 failures)
# Trace specific wallet balance changes
sim summarize baseline.json --accounts E2gE...
Account: E2gE...
  SOL 29.455253127 → 29.293640983  (Δ -0.161612144)
3

Run an Experiment

Build a modified program with parameter changes, feature upgrades, or bug fixes. Substitute it in place of the original binary and run the new logic against the same historical flow.

# Experiment
sim run \
  --start-slot 400000000 \
  --end-slot 400001000 \
  --program-id <PROGRAM_ID> \
  --program-so <PATH_TO_NEW_BINARY> \
  --output-file experiment.json

If the new program requires higher compute units, bump it up to prevent transaction failures with --extra-compute-units <EXTRA_UNITS>.

4

Compare Results

Once both the baseline and experiment are complete, compare the two runs:

  • regressions: original transaction that succeeded -> now fails

  • improvements: original transaction that failed -> now succeeds

  • balance changes: deltas in every account's token accounts

sim compare baseline.json experiment.json
# Only show what broke
sim compare baseline.json experiment.json regressions
# Check P&L impact
sim compare baseline.json experiment.json balances

Last updated