Snapshots
Chapter 44: Snapshot Management
Section titled “Chapter 44: Snapshot Management”Overview
Section titled “Overview”Snapshots are a critical component of modern blockchain node infrastructure, enabling rapid node synchronization and significantly reducing the time required to join a network. This chapter provides comprehensive coverage of snapshot management.
44.1 What are Snapshots?
Section titled “44.1 What are Snapshots?”Blockchain snapshots are pre-computed state data that allow new nodes to synchronize much faster than traditional methods. Instead of processing the entire transaction history, nodes can download and verify the current state directly.
┌─────────────────────────────────────────────────────────────────────────────┐│ SNAPSHOT SYNC VS FULL SYNC │├─────────────────────────────────────────────────────────────────────────────┤│ ││ FULL SYNC SNAPSHOT SYNC ││ ━━━━━━━━━━ ━━━━━━━━━━━━━ ││ ││ ┌─────────┐ ┌─────────┐ ││ │ Genesis │ │ Snapshot│ ││ │ Block │ │ Download│ ││ └────┬────┘ └────┬────┘ ││ │ │ ││ ▼ ▼ ││ ┌────────────────┐ ┌────────────────┐ ││ │ Process all │ │ Verify state │ ││ │ transactions │ │ hash │ ││ │ from block 1 │ └───────┬────────┘ ││ └────┬─────────┘ │ ││ │ ▼ ││ ▼ ┌────────────────┐ ││ ┌────────────┐ │ Start normal │ ││ │ ...thousands│ │ operation │ ││ │ of blocks │ └────────────────┘ ││ └────┬───────┘ ││ │ ││ ▼ ││ ┌─────────────┐ ││ │ Latest Block│ ││ └─────────────┘ ││ ││ Time: Weeks Time: Hours ││ │└─────────────────────────────────────────────────────────────────────────────┘Benefits of Snapshots
Section titled “Benefits of Snapshots”| Benefit | Description |
|---|---|
| Speed | Reduces sync time from weeks to hours |
| Resource Efficiency | Less CPU/bandwidth usage |
| Trustless | State is verified by execution |
| Accessibility | Enables faster network participation |
44.2 Snapshot Types
Section titled “44.2 Snapshot Types”Ethereum Snapshots
Section titled “Ethereum Snapshots”┌─────────────────────────────────────────────────────────────────┐│ ETHEREUM SNAPSHOT TYPES │├─────────────────────────────────────────────────────────────────┤│ ││ 1. STATE SNAPS (Snap Sync) ││ ━━━━━━━━━━━━━━━━━━━ ││ - Downloads Merkle trie state ││ - Started in Geth v1.10.0 ││ - Automatically selected in snap sync mode ││ - Size: ~10-15 GB for mainnet ││ ││ 2. HISTORY SNAPS ││ ━━━━━━━━━━━━━━━━ ││ - Contains historical block data ││ - Erigon-specific feature ││ - Enables historical queries ││ - Size: ~100 GB+ for mainnet ││ ││ 3. SNAPSHOT FILES (.seg) ││ ━━━━━━━━━━━━━━━━━━━ ││ - Segmented snapshot files ││ - Erigon generates automatically ││ - Can be shared between nodes ││ │└─────────────────────────────────────────────────────────────────┘Snapshot Providers
Section titled “Snapshot Providers”| Provider | URL | Description |
|---|---|---|
| Erigon | Built-in | Automatic during snap sync |
| Polygon | Polygon Snapshots | Available from various providers |
| Avalanche | Avalanche Snapshots | Community-provided |
| Custom | Various | Community snapshots |
44.3 Using Snapshots with Different Clients
Section titled “44.3 Using Snapshots with Different Clients”Geth Snapshot Sync
Section titled “Geth Snapshot Sync”# Start with snap sync (automatically uses snapshots)geth \ --mainnet \ --syncmode "snap" \ --datadir /data/ethereum \ --cache 8192
# Verify snapshot statusgeth snapshot status --datadir /data/ethereumErigon Snapshots
Section titled “Erigon Snapshots”# Erigon automatically uses snapshots in snap syncerigon \ --chain mainnet \ --datadir /data/erigon \ --snapshots=true
# List available snapshotsls -la /data/erigon/snapshots/
# Verify snapshot dataerigon snapshot checkNethermind Snapshots
Section titled “Nethermind Snapshots”# Nethermind supports various sync modesdotnet Nethermind.Runner.dll \ --config mainnet \ --Sync.SnapSync true \ --Init.Datapath /data/nethermind44.4 Creating Custom Snapshots
Section titled “44.4 Creating Custom Snapshots”Creating Erigon Snapshots
Section titled “Creating Erigon Snapshots”# Generate snapshots from existing full nodeerigon snapshot build \ --datadir /data/erigon \ --from 15000000
# Verify snapshotserigon snapshot verify \ --datadir /data/erigon
# List snapshot segmentserigon snapshot ls /data/erigon/snapshots/Sharing Snapshots
Section titled “Sharing Snapshots”# Compress snapshots for transfertar -czvf erigon-snapshots.tar.gz /data/erigon/snapshots/
# Extract on new machinetar -xzvf erigon-snapshots.tar.gz -C /data/erigon/
# Verify integrityerigon snapshot check --datadir /data/erigon44.5 Snapshot Verification
Section titled “44.5 Snapshot Verification”Trustless Verification
Section titled “Trustless Verification”┌─────────────────────────────────────────────────────────────────┐│ SNAPSHOT VERIFICATION │├─────────────────────────────────────────────────────────────────┤│ ││ Snapshots are verified through: ││ ││ ┌─────────────────────────────────────────────────────────┐ ││ │ STATE ROOT VERIFICATION │ ││ │ │ ││ │ Snapshot → Compute State Root → Compare with Block │ ││ │ │ ││ │ ┌──────────────┐ ┌──────────────┐ │ ││ │ │ Snapshot │───▶│ Compute │ │ ││ │ │ Data │ │ Root Hash │ │ ││ │ └──────────────┘ └──────┬───────┘ │ ││ │ │ │ ││ │ ▼ │ ││ │ ┌──────────────┐ │ ││ │ │ Block │ │ ││ │ │ Header │ │ ││ │ │ State Root │ │ ││ │ └──────┬───────┘ │ ││ │ │ │ ││ │ ▼ │ ││ │ ┌──────────────┐ │ ││ │ │ MATCH? │ │ ││ │ │ VERIFIED │ │ ││ │ └──────────────┘ │ ││ └─────────────────────────────────────────────────────────┘ ││ ││ This ensures trustless verification without external trust ││ │└─────────────────────────────────────────────────────────────────┘Manual Verification Commands
Section titled “Manual Verification Commands”# Check Geth snapshot statusgeth snapshot status --datadir /data/ethereum
# Verify state root (re-computes the state root and compares to the header)geth snapshot verify-state --datadir /data/ethereum
# Erigon verification (subcommand: snapshot check)erigon snapshot check --datadir /data/erigon
# Inspect the geth database (health of chaindata) — note: there is no# "geth db check-chain-gap" command; use db stat:geth db stat --datadir /data/ethereum44.6 Snapshot Management Best Practices
Section titled “44.6 Snapshot Management Best Practices”Storage Requirements
Section titled “Storage Requirements”| Snapshot Type | Size (Ethereum Mainnet) | Recommended Storage |
|---|---|---|
| Snap Sync State | ~10-15 GB | 50 GB NVMe |
| Full Erigon | ~100-150 GB | 200 GB NVMe |
| Archive | ~12 TB | Multiple NVMe |
Regular Maintenance
Section titled “Regular Maintenance”# Schedule periodic snapshot verification# Add to crontab0 2 * * 0 /usr/bin/geth snapshot verify-state --datadir /data/ethereum
# Erigon keeps snapshots as segment files; delete old segments manually when# you no longer need them (there is no "erigon snapshot prune" subcommand):# 1. stop erigon# 2. remove old segment files in /data/erigon/snapshots/ (e.g., headers/v1-xxxxxx.seg)# 3. start erigon (it creates/reuses what it needs)Monitoring
Section titled “Monitoring”# Watch snap sync progress (RPC eth.syncing during sync)geth attach --datadir /data/ethereum \ -exec 'eth.syncing'
# Prometheus metrics — enable with --metrics, then check the REAL metric names:curl -s http://localhost:6060/debug/metrics/prometheus | grep -E 'chain_head_block|snapshot'# (geth exports chain_head_block, chain_head_header, and snapshot_* metrics;# verify the exact names for your client version — never guess metric names)44.7 Troubleshooting Snapshot Issues
Section titled “44.7 Troubleshooting Snapshot Issues”Common Issues
Section titled “Common Issues”| Issue | Cause | Solution |
|---|---|---|
| Slow snap sync | Network bandwidth | Increase peers, check bandwidth |
| Snapshot verification fails | Corrupted data | Delete and re-sync |
| Out of disk space | Large state | Enable pruning, use smaller disk |
| Stuck at snapshot | Peer issues | Add more bootnodes, try different peers |
Recovery Steps
Section titled “Recovery Steps”# 1. Stop the nodesystemctl stop geth
# 2. Remove corrupted snapshotsrm -rf /data/ethereum/snapshots/*rm -rf /data/ethereum/trie*
# 3. Restart with fresh syncsystemctl start geth
# 4. Monitor sync progressgeth --attach /data/ethereum/geth.ipc -exec 'eth.syncing'44.8 Interview Questions
Section titled “44.8 Interview Questions”| Question | Answer |
|---|---|
| What is snap sync? | Fast sync method using pre-computed state snapshots |
| How are snapshots verified? | By computing state root and comparing with block header |
| What clients support snapshots? | Geth, Erigon, Nethermind all support snap sync |
| How large are Ethereum snapshots? | ~10-15 GB for state, ~100 GB+ for history |
| Can snapshots be shared between nodes? | Yes, with proper verification |
Summary
Section titled “Summary”- Snapshots enable fast node synchronization (hours vs weeks)
- Snap sync is trustless through state root verification
- Different clients have different snapshot implementations
- Regular verification ensures data integrity
- Proper storage planning is essential
Next Chapter
Section titled “Next Chapter”In Chapter 45: Common Node Issues, we’ll explore troubleshooting common problems.
Last Updated: 2026-02-20