Operators
Genesis creation

OP Stack genesis creation

The recommended way to generate genesis and rollup configuration files is using op-deployer. This ensures standardization and compatibility with the Superchain.

The op-deployer tool simplifies the creation of genesis and rollup configuration files (genesis.json and rollup.json). These files are crucial for initializing the execution client (op-geth) and consensus client (op-node) for your network.

The recommended flow for creating a genesis file and rollup configuration file on the OP Stack is as follows:

  1. Deploy the L1 contracts using op-deployer.
  2. Generate both the L2 genesis file (genesis.json) and the rollup configuration file (rollup.json) using op-deployer's inspect commands.
  3. Initialize your off-chain components (e.g., execution client, consensus client).

Recommended method: using op-deployer

Prerequisites

  1. You have installed the op-deployer binary following the instructions in deployer docs. After installation, extract the op-deployer into your PATH and cd op-deployer.

  2. You have created and customized an intent file in a .deployer directory, typically by running:

    ./bin/op-deployer init --l1-chain-id <YOUR_L1_CHAIN_ID> --l2-chain-ids <YOUR_L2_CHAIN_ID> --workdir .deployer

    Replace <YOUR_L1_CHAIN_ID> and <YOUR_L2_CHAIN_ID> with their respective values, see a list of chainIds (opens in a new tab).

  3. You have edited that intent file to your liking (roles, addresses, etc.).

Step 1: Deploy the L1 contracts

To deploy your chain to L1, run:

./bin/op-deployer apply --workdir .deployer \
  --l1-rpc-url <RPC_URL_FOR_L1> \
  --private-key <DEPLOYER_PRIVATE_KEY_HEX>

This command:

  • Reads your intent file in .deployer/.
  • Deploys the OP Stack contracts to the specified L1.
  • Updates a local state.json file with the results of the deployment.

Step 2: Generate your L2 genesis file and rollup file

After your L1 contracts have been deployed, generate the L2 genesis and rollup configuration files by inspecting the deployer's state.json

./bin/op-deployer inspect genesis --workdir .deployer <L2_CHAIN_ID> > .deployer/genesis.json
./bin/op-deployer inspect rollup --workdir .deployer <L2_CHAIN_ID> > .deployer/rollup.json
  • genesis.json is the file you will provide to your execution client (e.g. op-geth).
  • rollup.json is the file you will provide to your consensus client (e.g. op-node).

Step 3: Initialize your off-chain components

Once you have genesis.json and rollup.json:

  1. Initialize op-geth using genesis.json.
  2. Configure op-node with rollup.json.
  3. Set up additional off-chain infrastructure as needed (block explorer, indexers, etc.). For more on architecture, see Architecture overview.

Next steps

  • Learn how to initialize op-geth with your genesis.json file.
  • Learn how to initialize op-node with your rollup.json file.
  • Learn more about the off chain architecture.