diff --git a/pages/builders/chain-operators/deploy/genesis.mdx b/pages/builders/chain-operators/deploy/genesis.mdx index 7004e07d8..259e9040c 100644 --- a/pages/builders/chain-operators/deploy/genesis.mdx +++ b/pages/builders/chain-operators/deploy/genesis.mdx @@ -8,20 +8,96 @@ import { Callout } from 'nextra/components' # OP Stack genesis creation - -This page is out of date and shows the legacy method for genesis file creation. -For the latest recommended method, use [op-deployer](/builders/chain-operators/tools/op-deployer). + +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](/builders/chain-operators/tools/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](/builders/chain-operators/tools/op-deployer#installation). +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: + ```bash + ./bin/op-deployer init --l1-chain-id --l2-chain-ids --workdir .deployer + ``` + + Replace `` and `` with their respective values, see a list of [`chainIds`](https://chainid.network/). + +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: +```bash +./bin/op-deployer apply --workdir .deployer \ + --l1-rpc-url \ + --private-key +``` + +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.` +```bash +./bin/op-deployer inspect genesis --workdir .deployer > .deployer/genesis.json +./bin/op-deployer inspect rollup --workdir .deployer > .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](/builders/chain-operators/architecture). + +### Step 3: Get data + +Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network. +You can also use the following inspect subcommands to get additional data: + +```bash +./bin/op-deployer inspect l1 --workdir .deployer # outputs all L1 contract addresses for an L2 chain +./bin/op-deployer inspect deploy-config --workdir .deployer # outputs the deploy config for an L2 chain + + +## Legacy method: using foundry script + The following guide shows you how to generate the L2 genesis file `genesis.json`. This is a JSON file that represents the L2 genesis. You will provide this file to the execution client (op-geth) to initialize your network. There is also the rollup configuration file, `rollup.json`, which will be provided to the consensus client (op-node). -## Solidity script + + The following genesis creation information is the legacy method for creating OP Stack configuration files. + This method is not recommended. It's preserved here for historical context. + + + +## Solidity script (Legacy) -At the time of this writing, the preferred method for genesis generation is to use the foundry script -located in the monorepo to generate an "L2 state dump" and then pass this into the op-node genesis subcommand. +You can also use the foundry script +located in the monorepo to generate an "L2 state dump" and then pass this into the op-node genesis subcommand. The foundry script can be found at [packages/contracts-bedrock/scripts/L2Genesis.s.sol](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/scripts/L2Genesis.s.sol).