Erigon Segment Retire Command

VerifiedCaution

Prepares snapshot files for publication by building missing indices, freezing blocks into snapshots, removing overlaps, pruning ancient data, building state history, merging, and cleaning. Use this when you need to prepare an Erigon datadir for snapshot release workflow after stopping Erigon.

Sby Skills Guide Bot
DevOpsIntermediate
3/8/2026
Claude Code
#erigon#blockchain#snapshots#cli#maintenance

Recommended for

Automated summary

Runs the `erigon seg retire` command to build, merge and clean snapshot segment files in an Erigon datadir ahead of publication.

Strengths

  • Precisely lists the seven sequential operations the command performs (indices, block retirement, overlap removal, ancient-block pruning, state history build, state history pruning, merge/cleanup)
  • States explicit prerequisites: Erigon stopped, binary built, synced datadir present
  • Places the command inside the full "Publishable v2" release workflow alongside adjacent commands
  • Calls out practical friction points: file lock, long runtime, disk I/O intensity

Limitations

  • Assumes the binary and datadir already exist and does not cover building or syncing them
  • Gives no guidance on diagnosing, resuming or rolling back a failed run
  • Provides no runtime or disk-space estimates for mainnet
When to use it

Use it when a synced Erigon datadir must be prepared for snapshot publication.

When not to use it

Avoid it for routine node operation or when Erigon must stay online and serving queries.

Security analysis

Caution
Quality score84/100

The skill documents a legitimate Erigon maintenance command and does not exfiltrate data, disable safety, or use obfuscated payloads. However, it grants Bash and directs a disk-intensive command that prunes database/state-history data, so it warrants caution rather than being considered risk-free.

Findings
  • •Instructs Bash execution of `erigon seg retire`, which prunes and mutates blockchain datadir contents; an incorrect `--datadir` path could cause data loss.
  • •Relies on prose-only prerequisites (Erigon stopped, correct datadir) with no validation or confirmation step.
How this analysis is made

Examples

Retire snapshots before publishing
Erigon is shut down on my node. Run seg retire against the datadir at /data/erigon so the snapshot files are ready to publish.
Résoudre une erreur de verrou
`erigon seg retire --datadir=/data/erigon` failed with a file lock error — what should I check and in what order?
Full publishable v2 flow
Walk me through the complete publishable v2 snapshot release flow, starting from shutting down Erigon and including where seg retire fits.

name: erigon-seg-retire description: Run the Erigon segment retire command to build, merge, and clean snapshot files. Use this for snapshot publication readiness preparation. allowed-tools: Bash, Read

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

  1. Erigon must be stopped - The command requires exclusive access to the datadir
  2. Binary must be built - Run /erigon-build first if the binary doesn't exist
  3. 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:

  1. Build Missing Indices - Creates any missing indices for block and Caplin snapshots
  2. Retire Blocks - Freezes blocks from the database into snapshot files
  3. Remove Overlaps - Cleans up overlapping snapshot files
  4. Prune Ancient Blocks - Removes block data from the database that has been successfully snapshotted
  5. Build State History - Creates missing accessors and builds state history snapshot files
  6. Prune State History - Removes state history that has been snapshotted
  7. 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:

  1. Shutdown Erigon
  2. Run seg retire (this command)
  3. Optionally run seg clearIndexing
  4. Run seg index
  5. Create torrent files
  6. Run integrity check
  7. Run publishable command

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

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/erigon-segment-retire-command-mmh8qqhk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/erigon-segment-retire-command-mmh8qqhk/download' --output '.skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md.part' && mv '.skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md.part' '.skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read

Original excerpt: Prerequisites
  1. Erigon must be stopped - The command requires exclusive access to the datadir
  2. Binary must be built - Run /erigon-build first if the binary doesn't exist
  3. Datadir must exist - A synced Erigon datadir with blockchain data

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md' && test -s '.skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/erigon-seg-retire' && cp -R '.skill-downloads/erigon-segment-retire-command-mmh8qqhk' '.claude/skills/erigon-seg-retire'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/erigon-segment-retire-command-mmh8qqhk'

openskills read 'erigon-segment-retire-command-mmh8qqhk'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/erigon-segment-retire-command-mmh8qqhk/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills