Skip to main content
Version: Next

History expiry

History expiry is a feature set that aims to reduce storage space requirements for a node by removing old historical data. The goal is to remove the requirement from nodes to store all the historical data but ensure the old data is preserved and accessible for anyone who needs it. For details, see EIP-4444.

info

The EIP-4444 is currently in development phase, aiming to ship initial implementation across all clients by May 1, 2025. The consensus is to stop serving pre-Merge blocks and receipts.

Era1 format

The pre-Merge historical data is serviced in Era1 format, which is an archival format initially designed for the consensus layer by Nimbus.

An Era1 archive can be expressed as follows:

era1 := Version | block-tuple* | other-entries* | Accumulator | BlockIndex
block-tuple := CompressedHeader | CompressedBody | CompressedReceipts | TotalDifficulty
block-index := starting-number | index | index | index ... | count

Block headers, bodies, and receipts are compressed using the Snappy framing format. Each file contains a block index for fast lookup and an epoch accumulator for verification. The epoch accumulator can verify the entire archive with accumulators from a trusted source. It also allows a node to download a block header with a Merkle proof, proving it belongs to a particular epoch.

Import

Nethermind allows importing of a historical block range from a specified location to the database. During import, the block range before the head will be inserted in parallel like old bodies, and after the head will be "suggested" like forward sync. So, it will process a new imported block.

  • Import will not complete until the blocks are processed and will pause adding them if the processing queue reaches 2000 blocks.
  • An exception to this is if fast sync is enabled and the head is 0, in which case, it will only insert blocks like old bodies.
  • Accumulator and content are always verified/checksummed.

The data can be imported using the following configuration options on Nethermind startup. Note that this is a blocking operation and puts other activities on hold until it is completed:

If both Era.From and Era.To are set to 0, it imports all blocks.

Alternatively, the data can be imported using the admin_importHistory JSON-RPC method. This is a non-blocking operation. However, it can be run only one at a time, making it slower than the configuration option.

Export

Nethermind allows exporting a block range from the database to a specified location. It can be done using the following configuration options on Nethermind startup. Note that this is a blocking operation and puts other activities on hold until it is completed:

If both Era.From and Era.To are set to 0, it exports all blocks. It also always creates the accumulators.txt and checksums.txt files.

Alternatively, the data can be exported using the admin_exportHistory JSON-RPC method. This is a non-blocking operation. However, it can be run only one at a time, making it slower than the configuration option.