Overview
Snapshots let you capture the entire state of your local blockchain at a point in time and restore it later. This is essential for:- Reproducible tests — Reset to a known state between test runs
- Fast iteration — Deploy contracts once, snapshot, then restore after each experiment
- Team sharing — Export snapshots and share with teammates
- Debugging — Snapshot before a failure and restore to investigate
How Snapshots Work
Dokrypt snapshots use the EVM’s built-inevm_snapshot and evm_revert JSON-RPC methods. When you save a snapshot:
- A
evm_snapshotcall returns a snapshot ID - Metadata (name, block number, chain ID, description, tags) is saved to
~/.dokrypt/snapshots/<project>/
evm_revertis called with the snapshot ID- The chain state rolls back to the exact state at the time of the snapshot
- A new snapshot is taken at the same point (EVM snapshots are consumed on revert)
Quick Start
Snapshot Lifecycle
Commands
Save
Restore
List
Delete
Export / Import
anvil_dumpState to capture the full chain state (accounts, storage, nonces, code). The exported JSON file contains both the metadata and the complete state.
Diff
Use Cases
Test Isolation
Contract Development Workflow
Sharing State with Team
Storage
Snapshots are stored at:snapshots
my-project
my-snapshot.json
before-deploy.json
Export/import (
anvil_dumpState/anvil_loadState) is Anvil-specific. If using Hardhat or Geth, basic evm_snapshot/evm_revert still works, but full state export is not available.