How erigontech/erigon works
Erigon is an Ethereum execution-layer node with an optional external consensus client and an embedded consensus layer, Caplin, enabled by default. The main operator workflow is to start the node, synchronize chain data, process blocks and state, and expose node data through RPC; validators can also produce blocks. The graph includes documented networking, storage, and developer-facing services. Some subsystem links are based only on README claims or source-index references; unsampled code is not assumed to establish more specific call paths.
Main entry points: caplin/main.go Embedded Caplin · engine_server.go Engine API server · erigon/main.go Erigon node · transient_storage.go Chain state
Components 18
Node and APIs
- Erigon node
cmd/erigon/main.go - RPC daemon
cmd/rpcdaemon/main.go - Engine API server
execution/engineapi/engine_server.go
Execution and state
- EVM execution
execution/vm/program/program.go - Chain state
execution/state/transient_storage.go - Pruning policy
db/kv/prune/storage_mode.go
Consensus and validation
- Embedded Caplin
cmd/caplin/main.go - Beacon API
cl/beacon/handler/handler.go - Validator services
cl/validator/devvalidator/service.go - Fork choice
cl/phase1/forkchoice/forkchoice.go - Consensus sync
cl/phase1/stages/clstages.go - Consensus execution client
cl/phase1/execution_client/execution_client_engine.go
Sync and storage
- Snapshot downloader
cmd/downloader/main.go - Snapshot data
cl/persistence/format/snapshot_format/blocks.go
Networking
- P2P networking
p2p/server.go - Consensus gossip
cl/phase1/network/gossip/gossip_manager.go
Other components
- Node operator
- External CL client
Connections 17
- Node operator → Erigon node: starts node
- Erigon node → RPC daemon: offers RPC
- Node operator → RPC daemon: queries node
- External CL client → Engine API server: uses Engine API
- Embedded Caplin → Consensus execution client: uses execution client
cmd/caplin/main.go - Consensus execution client → Engine API server: calls Engine API
cl/phase1/execution_client/execution_client_engine.go - Engine API server → Chain state: accesses chain data
execution/engineapi/engine_server.go - Engine API server → EVM execution: processes payloads
- Node operator → Snapshot downloader: downloads snapshots
- Snapshot downloader → Snapshot data: obtains snapshot data
- Embedded Caplin → Consensus sync: runs consensus
- Consensus sync → Fork choice: updates head
- Embedded Caplin → Beacon API: exposes Beacon API
- Validator services → Beacon API: uses Beacon API
- Embedded Caplin → Consensus gossip: uses gossip
cl/phase1/network/gossip/gossip_manager.go - Erigon node → P2P networking: uses networking
- Chain state → Pruning policy: applies retention policy