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)
op-deployer.
Prerequisites
Before generating genesis and rollup configuration files, ensure you have:-
Deployed the L1 contracts successfully using the
op-deployer applycommand -
Access to your deployment workspace directory (
.deployerif 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
Theop-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:
Step 2: Generate the L2 genesis file
Use theinspect genesis command to retrieve your L2 genesis file:
<L2_CHAIN_ID> with your L2 network’s chain ID.
Step 3: Generate the rollup configuration file
Use theinspect rollup command to retrieve your rollup configuration file:
Step 4: Verify the generated files
Examine the generated files to ensure they contain the expected configuration:genesis.json file contains the initial state of your L2 blockchain, including:
- Chain configuration parameters
- Initial account states
- Genesis block properties
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.jsonfile 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-gethwith yourgenesis.jsonfile - Learn how to configure
op-nodewith yourrollup.jsonfile - Learn more about the off-chain architecture