Why I built it
Cosmos nodes keep every block and every state version until someone prunes them, and the usual advice to “prune your node” came with fragile, poorly documented tooling. Operators tended to put it off until the disk was full.
What it does
- Prunes both the CometBFT block store and the application state
- Configurable retention, defaulting to 100 blocks and 10 state versions
- Works with the standard node directory layout of any Cosmos SDK chain, without chain-specific setup
- Runs against a stopped node and reclaims disk space safely
How it’s built
A Go command-line tool that works directly on the node’s LevelDB or RocksDB databases.
The hard part
Not corrupting state. You can’t delete arbitrary heights without breaking the chain of state roots, so the tool had to understand each database’s key layout well enough to know which keys are safe to remove and the minimum history a node needs to restart.
Stack
GoCosmos SDKCometBFTLevelDBRocksDB