Configure Erigon

How to customize your Erigon and get the best for your purpose

Erigon is by default an "all-in-one" binary solution, but it's possible start any internal component as a separated processes:

This may be for security, scalability, decentralisation, resource limitation, custom implementation, or any other reason you/your team deems appropriate. See the appropriate section to understand how to start each service separately.

Hint: Don't start services as separated processes unless you have clear reason for it.

Using TOML or YAML Config Files

You can set Erigon flags via a YAML or TOML configuration file with the flag --config. The flags set in the configuration file can be overridden by writing the flags directly to the Erigon command line.

YAML

Assuming we have chain : "mainnet" in our configuration file, adding --chain=goerli will override the flag inside the yaml configuration file and set the chain to goerli.

./build/bin/erigon --config ./config.yaml --chain=goerli

Example of setting up a YAML config file

datadir : 'your datadir'
internalcl : true
port : 1111
chain : "mainnet"
http : true

http.api : ["eth","debug","net"]

TOML

Example of setting up TOML config file

datadir = 'your datadir'
internalcl = true
port = 1111
chain = "mainnet"
http = true

"http.api" = ["eth","debug","net"]

Building new developments

Warning: for advanced users only.

For building the bleeding edge development branch:

git clone --recurse-submodules https://github.com/ledgerwatch/erigon.git
cd erigon
git checkout devel
make erigon

You can check the list of releases for release notes.

Increase download speed by flag --torrent.download.rate=20mb. (see Downloader)

Use --datadir to choose where to store data.

Use --chain=gnosis for Gnosis Chain, --chain=bor-mainnet for Polygon Mainnet, and --chain=mumbai for Polygon Mumbai. For Gnosis Chain you need a Consensus Layer client alongside Erigon (https://docs.gnosischain.com/node/guide/beacon).

Running make help will list and describe the convenience commands available in the Makefile.

Datadir structure

  • chaindata: recent blocks, state, recent state history. low-latency disk recommended.

  • snapshots: old blocks, old state history. can symlink/mount it to cheaper disk. mostly immutable. Must have ~100GB of free space (to merge recent files into a larger one).

  • temp: can grow to ~100GB, but usually empty. can symlink/mount it to cheaper disk.

  • txpool: pending transactions. safe to remove.

  • nodes: p2p peers. safe to remove.

Note that the --datadir option that allows you to store Erigon files in a non-default location, in this example, in the goerli subdirectory of the current directory. The name of the directory --datadir does not have to match the name of the chain in --chain.

./build/bin/erigon --internalcl --datadir=/goerli

Logging

Flags:

  • verbosity

  • log.console.verbosity (overriding alias for verbosity)

  • log.json

  • log.console.json (alias for log.json)

  • log.dir.path

  • log.dir.prefix

  • log.dir.verbosity

  • log.dir.json

In order to log only to the stdout/stderr the --verbosity (or log.console.verbosity) flag can be used to supply an int value specifying the highest output log level:

  LvlCrit = 0
  LvlError = 1
  LvlWarn = 2
  LvlInfo = 3
  LvlDebug = 4
  LvlTrace = 5

To specify an output directory for the logs to be collected on disk, please set --log.dir.path If you want to change the filename produced by erigon you should also set the --log.dir.prefix flag to an alternate name. The --log.dir.verbosity flag is also available to control the verbosity of this logging, with the same int value as above, or the string value e.g. ' debug' or 'info'. The default verbosity is 'debug' (4), for disk logging.

The log format can be set to json by using the boolean flags log.json or log.console.json, or for the disk output --log.dir.json.

Multiple Instances / One Machine

The following 6 flags must be defined to avoid conflicts: --datadir --port --http.port --authrpc.port --torrent.port --private.api.addr.

Example of multiple chains on the same machine:

# mainnet
./build/bin/erigon  --internalcl --datadir="<your_mainnet_data_path>" --chain=mainnet --port=30303 --http.port=8545 --authrpc.port=8551 --torrent.port=42069 --private.api.addr=127.0.0.1:9090 --http --ws --http.api=eth,debug,net,trace,web3,erigon

# sepolia
./build/bin/erigon  --internalcl --datadir="<your_sepolia_data_path>" --chain=sepolia --port=30304 --http.port=8546 --authrpc.port=8552 --torrent.port=42068 --private.api.addr=127.0.0.1:9091 --http --ws --http.api=eth,debug,net,trace,web3,erigon

Quote your path if it has spaces.

Dev Chain

The Erigon development mode sets up a private, instantly-mined test blockchain to rapidly prototype and test Ethereum applications and modifications without risk.

You can find a detailed explanation on how to run a local Dev Chain here.

Last updated