Overview
After deploying the L1 system contracts for your OP Stack chain, you need to generate two files to run nodes on the L2 network:
- Genesis file (
genesis.json
): Initializes the execution client (op-geth
) - Rollup configuration file (
rollup.json
): Configures the consensus client (op-node
)
This guide shows you how to generate these files from your L1 contract deployment data using op-deployer
.
Prerequisites
Before generating genesis and rollup configuration files, ensure you have:
-
Deployed the L1 contracts successfully using the
op-deployer apply
command -
Access to your deployment workspace directory (
.deployer
if you've followed the instructions in the L1 deployment contracts guide)
Generating genesis and rollup files
After your L1 contracts have been deployed, follow these steps to generate the configuration files:
Step 1: Locate your deployment state file
The op-deployer
tool creates a state.json
file in your workspace directory that contains all the necessary information about your deployed contracts.
Verify that this file exists in your workspace:
ls -la .deployer/state.json
Step 2: Generate the L2 genesis file
Use the inspect genesis
command to retrieve your L2 genesis file:
op-deployer inspect genesis --workdir .deployer <L2_CHAIN_ID> > .deployer/genesis.json
Replace <L2_CHAIN_ID>
with your L2 network's chain ID.
Step 3: Generate the rollup configuration file
Use the inspect rollup
command to retrieve your rollup configuration file:
op-deployer inspect rollup --workdir .deployer <L2_CHAIN_ID> > .deployer/rollup.json
Step 4: Verify the generated files
Examine the generated files to ensure they contain the expected configuration:
# View the genesis file structure
jq . .deployer/genesis.json | head -20
# View the rollup configuration
jq . .deployer/rollup.json
The genesis.json
file contains the initial state of your L2 blockchain, including:
- Chain configuration parameters
- Initial account states
- Genesis block properties
The rollup.json
file contains the rollup protocol parameters, including:
- L1 contract addresses
- Sequencing settings
- Protocol upgrade activation times
Troubleshooting
If you encounter issues with the generated files:
- Verify that your L1 contract deployment was successful
- Check that you're using the correct L2 chain ID in the generation commands
- Ensure your
state.json
file is up-to-date with your latest deployment
Never manually edit the generated genesis or rollup files unless you fully understand the implications. Incorrect configurations can lead to consensus failures or chain security issues.
Next steps
- Learn how to initialize
op-geth
with yourgenesis.json
file - Learn how to configure
op-node
with yourrollup.json
file - Learn more about the off-chain architecture