Virtual TestNets are live! ⚡️ Test and stage dapps on real-time production data.
Get started →

All Products

Virtual TestNets
Revert State on TestNets

Revert State on TestNets

Reverting state can be helpful when testing contracts and protocols and you want to discard all state changes up to the snapshot position.

Instead of reverting state, consider forking an existing testnet instead, and do your testing on a disposable working copy.

Reverting to a snapshot

Create snapshot

Use evm_snapshot to create a snapshot on the current block. The method returns the snapshot ID you can use to revert.
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "evm_snapshot",
      "id": "1234"
    }' \
    | jq -r  '.result')


Use evm_revert to back revert to previously created snapshot (SNAPSHOT_ID). From this point onwards, all prior changes up to the snapshot will be discarded.
read -r -d '' REVERT_REQUEST <<EOF
  "jsonrpc": "2.0",
  "method": "evm_revert",
  "params": ["$SNAPSHOT_ID"],
  "id": "1234"
    -H "Content-Type: application/json" \