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:
RPCDaemon, the JSON RPC layer
TxPool, the transaction pool
Sentry, the p2p layer
Downloader, the history download layer
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=holesky
will override the flag inside the yaml configuration file and set the chain to goerli.
Example of setting up a YAML config file
TOML
Example of setting up TOML config file
Building new developments
Warning: for advanced users only.
For building the bleeding edge development branch:
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 holesky
subdirectory of the current directory. The name of the directory --datadir
does not have to match the name of the chain in --chain
.
Logging
Flags:
verbosity
log.console.verbosity
(overriding alias forverbosity
)log.json
log.console.json
(alias forlog.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:
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:
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