Snapshots
Take and revert sandbox state snapshots
Take point-in-time snapshots of your sandbox state and revert to them at any time. Snapshots are useful for resetting your sandbox between test runs without creating a new sandbox.
[!NOTE] Snapshot commands require a live sandbox. Run
buildbear statusto confirm before proceeding.
snapshot take
Capture the current state of the sandbox and return a snapshot ID.
Arguments:
| Argument | Required | Description |
|---|---|---|
rpcUrl | No | BuildBear RPC URL. If omitted, reads from .buildbear.json |
Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
--quiet | Suppress output except errors |
Example:
Output:
JSON output (--json):
Save the snapshot ID — you will need it to revert later.
snapshot revert
Roll the sandbox back to a previously taken snapshot.
Arguments:
| Argument | Required | Description |
|---|---|---|
rpcUrl | No | BuildBear RPC URL. If omitted, reads from .buildbear.json |
Options:
| Flag | Type | Required | Description |
|---|---|---|---|
--snapshot <snapshotId> | string | Yes | Snapshot ID to revert to (hex format, e.g. 0x1) |
--json | flag | No | Output as JSON |
--quiet | flag | No | Suppress output except errors |
Example:
Output:
JSON output (--json):
How snapshots work
Snapshots use the standard evm_snapshot and evm_revert JSON-RPC methods, which are also supported by Hardhat and Anvil — so existing test helpers using these methods will work against BuildBear sandboxes.
A snapshot captures the entire EVM state: account balances, contract storage, deployed code, and nonces. Reverting to a snapshot does not automatically invalidate later snapshots — you can take multiple snapshots and revert between them.