Snapshot Testing Tool for Contract State
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Snapshot Testing Tool for Contract State is a security-focused tool that verifies contract storage state against expected snapshot values. It takes a contract address, an optional block number, and a set of expected slot-value pairs from the user, then reads the actual storage slot values via eth_getStorageAt at the specified block. The tool compares each actual value against the expected value and reports pass/fail results for each slot. It also fetches the contract bytecode via eth_getCode to confirm deployment, and captures block timestamps and headers for context. Results are displayed with a summary showing total slots tested, passes, fails, and errors, along with a detailed per-slot breakdown. This enables developers and auditors to verify that contract state matches known good snapshots, detect unauthorized changes, and validate contract behavior after upgrades.
HOW TO USE
Connect your wallet to the target EVM chain. Enter the contract address. Optionally enter a block number (uses the latest block if left empty). Enter the expected snapshot values in the text area, one per line, using the format "slot:expected_value" (e.g., "0x0:0x0000000000000000000000000000000000000000000000000000000000000000"). Click "Run snapshot tests" to read the actual state and compare against expectations. The tool will display a summary including the contract address, block number, bytecode preview, and a count of passed, failed, and error results. Each slot entry shows its label, expected value, actual value, and a pass/fail/error status. Results can be exported as a JSON file for further analysis.
TECHNICAL NOTE: STATE SNAPSHOT COMPARISON
The tool uses eth_getStorageAt with the specified block tag to read each storage slot's current value. Each slot is padded to 32 bytes using ethers.utils.hexZeroPad for correct addressing. The tool also fetches the contract bytecode via eth_getCode at the same block to verify the contract exists and is deployed. Block timestamps and headers are fetched via eth_getBlock to provide temporal context. The comparison is performed by case-insensitive hex string comparison of the slot values. Results are presented with color-coded status indicators: PASS (green), FAIL (red), or ERROR (amber). The tool handles errors gracefully, continuing to test remaining slots even if individual reads fail.
WHAT IT CANNOT SEE
The tool cannot test state without user-provided expected values; it does not generate expectations automatically. It is limited to the accuracy of the provided storage slot definitions; incorrect slots will produce incorrect results. It cannot detect changes in private or internal state without the user providing the correct slot numbers. The tool is limited by the RPC provider's archival capabilities; historical state may not be available on all nodes. It cannot test contracts on non-EVM chains. It cannot handle large numbers of storage slots efficiently, as each slot requires a separate RPC call. It cannot automatically generate expected snapshots from previous states.
PLEASE NOTE
This tool is designed exclusively for EVM-compatible chains (Ethereum, Polygon, BNB Chain, Arbitrum, Optimism, Avalanche C-Chain, etc.) with archival node support. It does not support non-EVM blockchains. The tool is read-only and does not modify any state. Expected snapshot values must be provided as 0x-prefixed hex strings. Archival node access is required for historical block queries; free RPC endpoints may not support this. The tool provides no warranty that the test results are complete or accurate; users are responsible for verifying slot definitions and expected values.