Configure Chains Dynamically
To use chains other than the defaults, supply a set of custom configuration files.
-
Ensure the chain name starts with the word
dynamic
e.g.dynamic-mynetwork
. -
Create the following files for dynamic configs. The examples for Cardona are in
zk/examples/dynamic-configs
and can be edited as required:dynamic-{network}-allocs.json
- the allocs file.dynamic-{network}-chainspec.json
- the chainspec file.dynamic-{network}-conf.json
- an additional configuration file.dynamic-{network}.yaml
- the run config file for erigon.
You can use any of the example yaml files at the root of the repo as a base and edit as required, but ensure the
chain
field is in the formatdynamic-mynetwork
and matches the names of the config files above. -
Put the erigon config file, along with the other files, in the directory of your choice. For example
dynamic-mynetwork
.Tip
- If you have allocs in the Polygon format from the original network launch, save this file to the root of the
cdk-erigon
code base and rungo run cmd/hack/allocs/main.go [your-file-name]
to convert it to the format needed by erigon. - This creates the
dynamic-{network}-allocs.json
file.
Tip
Find the following contract addresses for the
dynamic-{network}.yaml
in the output files created at network launch:zkevm.address-sequencer
=>create_rollup_output.json
=>sequencer
zkevm.address-zkevm
=>create_rollup_output.json
=>rollupAddress
zkevm.address-admin
=>deploy_output.json
=>admin
zkevm.address-rollup
=>deploy_output.json
=>polygonRollupManagerAddress
zkevm.address-ger-manager
=>deploy_output.json
=>polygonZkEVMGlobalExitRootAddress
- If you have allocs in the Polygon format from the original network launch, save this file to the root of the
-
Mount the directory containing the config files on a Docker container. For example
/dynamic-mynetwork
. -
To use the new config when starting erigon, use the
--config
flag with the path to the config file e.g.--config="/dynamic-mynetwork/dynamic-mynetwork.yaml"
.