Skip to main content

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-in evm_snapshot and evm_revert JSON-RPC methods. When you save a snapshot:
  1. A evm_snapshot call returns a snapshot ID
  2. Metadata (name, block number, chain ID, description, tags) is saved to ~/.dokrypt/snapshots/<project>/
When you restore:
  1. evm_revert is called with the snapshot ID
  2. The chain state rolls back to the exact state at the time of the snapshot
  3. 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

Export uses 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

Shows block number delta and time difference between two snapshots.

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
Each metadata file contains:
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.