Erigon Seg Retire
Apps & Automationerigon-seg-retireErigon Seg Retire is an Agent Skill for apps & automation published in the erigontech/erigon repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Run the Erigon segment retire command to build, merge, and clean snapshot files. Use this for snapshot publication readiness preparation.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/erigontech/erigon/blob/HEAD/.claude/skills/erigon-seg-retire/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/erigon-seg-retire, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Erigon Segment Retire Command
The erigon seg retire command prepares snapshot files for publication by performing build, merge, and cleanup operations on segment files.
Prerequisites
- Erigon must be stopped - The command requires exclusive access to the datadir
- Binary must be built - Run
/erigon-buildfirst if the binary doesn't exist - Datadir must exist - A synced Erigon datadir with blockchain data
Command
./build/bin/erigon seg retire --datadir=<path>
Replace <path> with the actual path to your Erigon data directory.
What the Command Does
The retire command performs these operations in sequence:
- Build Missing Indices - Creates any missing indices for block and Caplin snapshots
- Retire Blocks - Freezes blocks from the database into snapshot files
- Remove Overlaps - Cleans up overlapping snapshot files
- Prune Ancient Blocks - Removes block data from the database that has been successfully snapshotted
- Build State History - Creates missing accessors and builds state history snapshot files
- Prune State History - Removes state history that has been snapshotted
- Merge and Cleanup - Merges smaller snapshot files into larger ones and removes overlaps
Usage in Snapshot Release Workflow
This command is part of the "Publishable v2" snapshot release flow:
- Shutdown Erigon
- Run
seg retire(this command) - Optionally run
seg clearIndexing - Run
seg index - Create torrent files
- Run integrity check
- Run
publishablecommand
Example
# Build the binary first (if needed)
make erigon
# Ensure Erigon is stopped, then run seg retire
./build/bin/erigon seg retire --datadir=/data/erigon
Important Notes
- File Lock: If Erigon is running, the command will fail due to file lock
- Long running: This command can take significant time on mainnet
- Disk I/O intensive: Performs extensive read/write operations
- Resource intensive: Designed to maximize resource utilization