Skip to main content

Caplin

Caplin is Erigon's embedded Consensus Layer. It runs inside the Erigon process and keeps all of its data under the same --datadir as the execution layer, so a full node needs neither a second client process nor a second datadir to operate.

Caplin does write to disk. It maintains an indexing database at <datadir>/caplin/indexing, its own snapshots under <datadir>/snapshots/caplin, and further subdirectories for blobs, PeerDAS column data and beacon state. What Caplin removes is the separate process and separate datadir of an external consensus client — not the storage itself.

Caplin Usage

Caplin is enabled by default, at which point an external consensus layer is no longer needed.

./build/bin/erigon

Caplin also has an archive mode for historical states, blocks, and blobs. These can be enabled with the following flags:

  • --caplin.states-archive: Enables the storage and retrieval of historical state data, allowing access to past states of the blockchain for debugging, analytics, or other use cases.
  • --caplin.blocks-archive: Enables the storage of historical block data, making it possible to query or analyze full block history.
  • --caplin.blobs-archive: Enables the storage of historical blobs, ensuring access to additional off-chain data that might be required for specific applications.

In addition, Caplin can backfill recent blobs for an op-node or other uses with the new flag:

  • --caplin.blobs-immediate-backfill: Backfills the last 18 days' worth of blobs to quickly populate historical blob data for operational needs or analytics.

With state archival enabled, Caplin's indexing database (<datadir>/caplin/indexing) is pruned automatically: state rows already frozen into snapshots are deleted on the antiquary cadence, so the database holds only the un-frozen tail. The mdbx.dat file does not shrink when rows are pruned — freed pages are reused, bounding future growth. Set CAPLIN_STATE_PRUNE_DISABLE=true to turn pruning off.

PeerDAS Data Column Retention

For nodes participating in PeerDAS (EIP-7594), Caplin retains data column sidecars for a configurable window:

  • --caplin.columns-keep-slots (default: 131072, ~18 days): Number of slots to retain PeerDAS data column sidecars. The default matches MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS × SLOTS_PER_EPOCH. Increase this value for DA oracle or rollup nodes that require a longer column history.

Caplin can also be used for block production, aka staking.

Beacon API Configuration

When Caplin is running, it exposes a Beacon API that external tools can query. The following flags control the Beacon API server:

FlagDefaultDescription
--beacon.api.addrlocalhostListening address for the Beacon API
--beacon.api.port5555Listening port for the Beacon API
--beacon.api.cors.allow-origins(empty)CORS allowed origins
--beacon.api.cors.allow-methodsGET, POST, PUT, DELETE, OPTIONSCORS allowed methods
--beacon.api.cors.allow-credentialsfalseAllow credentials in CORS requests
--beacon.api.protocoltcpNetwork protocol (tcp or tcp4 or tcp6)
--beacon.api.read.timeout5HTTP server read timeout, in seconds
--beacon.api.write.timeout31536000HTTP server write timeout, in seconds (~1 year)
--beacon.api.idle.timeout25HTTP server idle timeout, in seconds