Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions pages/operators/chain-operators/deploy/genesis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,88 +89,6 @@ Once you have `genesis.json` and `rollup.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](/operators/chain-operators/architecture).

## 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).

<Callout type="warning">
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.
</Callout>


### Solidity script (Legacy)

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).

<Callout type="info">
When generating the genesis file, please use the same `op-contracts/vX.Y.Z` release commit used for L1 contract deployments.
</Callout>

### Configuration

Create or modify a file `<network-name>.json` inside the `deploy-config`
folder in the monorepo. The script will read the latest active fork from the
deploy config and the L2 genesis allocs generated will be compatible with this
fork. The automatically detected fork can be overwritten by setting the
environment variable `FORK` either to the lower-case fork name (currently
`delta`, `ecotone`, or `fjord`) or to `latest`, which will select the latest fork
available (currently `fjord`).

By default, the script will dump the L2 genesis allocs (aka "state dump") of the detected or
selected fork only, to the file at `STATE_DUMP_PATH`. The optional environment
variable `OUTPUT_MODE` allows you to modify this behavior by setting it to one of
the following values:

* `latest` (default) - only dump the selected fork's allocs.
* `all` - also dump all intermediary fork's allocs. This only works if
`STATE_DUMP_PATH` is not set. In this case, all allocs will be written to files
`/state-dump-<fork>.json`. Another path cannot currently be specified for this
use case.
* `none` - won't dump any allocs. Only makes sense for internal test usage.

### Creation

* `CONTRACT_ADDRESSES_PATH` represents the deployment artifact that was
generated during a contract deployment.
* `DEPLOY_CONFIG_PATH` represents a path on the filesystem that points to a
deployment config. The same deploy config JSON file should be used for L1 contracts
deployment as when generating the L2 genesis allocs.
* `STATE_DUMP_PATH` represents the filepath at which the allocs will be
written to on disk.

```bash
CONTRACT_ADDRESSES_PATH=<CONTRACT_ADDRESSES_PATH> \
DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \
STATE_DUMP_PATH=<PATH_TO_WRITE_L2_ALLOCS> \
forge script scripts/L2Genesis.s.sol:L2Genesis \
--sig 'runWithStateDump()'
```

## Subcommand (op-node genesis l2)

The genesis file creation is handled by the `genesis l2`
subcommand, provided by the `op-node`. The following is an example of its usage
from [v1.7.6](https://github.com/ethereum-optimism/optimism/releases/tag/v1.7.6) --
note that you need to pass the path to the l2 genesis state dump file output by
the foundry script above:

```bash
go run cmd/main.go genesis l2 \
--deploy-config=<Path to deploy config file> \
--l1-deployments=<Path to L1 deployments JSON file as in superchain-registry> \
--l2-allocs=<Path to L2 genesis state dump> \
--outfile.l2=<Path to L2 genesis output file: i.e. ./genesis.json> \
--outfile.rollup=<Path to rollup output file: i.e. ./rollup.json> \
--l1-rpc=<RPC URL for an Ethereum L1 node. Cannot be used with --l1-starting-block>>
```

## Next steps

* Learn how to [initialize](/operators/node-operators/configuration/base-config#initialization-via-genesis-file)
Expand Down