Usage
Subcommands
save
Save the current chain state as a named snapshot.Arguments
Flags
How It Works
- Calls
evm_snapshotvia JSON-RPC on the running chain - Records the current block number and chain ID
- Saves metadata to
~/.dokrypt/snapshots/<project>/<name>.json
Examples
restore
Restore chain state to a previously saved snapshot.Arguments
How It Works
- Loads the snapshot metadata
- Calls
evm_revertwith the snapshot ID - Takes a new snapshot at the same point (EVM snapshots are consumed on revert)
- Returns the current block number
Examples
EVM snapshots are single-use — once reverted, the snapshot ID is consumed. Dokrypt automatically takes a new snapshot after restoring so you can restore again later.
list
List all snapshots for the current project.Output
delete
Delete a saved snapshot.Examples
export
Export a snapshot to a JSON file for sharing or backup.Arguments
How It Works
- Loads snapshot metadata
- Calls
anvil_dumpStateto export the full chain state - Writes a JSON file containing both metadata and state data
Examples
anvil_dumpState is Anvil-specific. Export may not work with Hardhat or Geth chains.import
Import a snapshot from a JSON file.Arguments
How It Works
- Reads and parses the JSON file
- Loads the chain state via
anvil_loadState - Saves the metadata to the local snapshot registry