Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7a1464d
Updated callouts
krofax Jan 24, 2025
b51399e
fix indentation issues
krofax Jan 24, 2025
af231c4
updated the L1 contract deployement section
krofax Jan 24, 2025
b83fa28
removed redundant section
krofax Jan 24, 2025
c553cf3
Add the steps to l2 testnet tutorial
krofax Jan 24, 2025
90586bd
fix format error
krofax Jan 24, 2025
acfdf9b
fix conflict
krofax Jan 27, 2025
08fc670
fix lint issues
krofax Jan 27, 2025
491efb5
updated the genesis config section
krofax Jan 27, 2025
c4aa0db
update lint
krofax Jan 27, 2025
7fe7be1
update testnet tutorial to use op-deployer
krofax Jan 27, 2025
f122ef5
update the indentation
krofax Jan 27, 2025
7a8395e
Update pages/builders/chain-operators/deploy/genesis.mdx
krofax Jan 28, 2025
7e969b7
fix broken links
krofax Jan 28, 2025
d7a14af
fix lint issues and conflcit
krofax Jan 28, 2025
76e8d6e
update the op-deployer callout
krofax Jan 28, 2025
eb58dc5
updated the testnet tut op-deployer section
krofax Jan 28, 2025
8aaa043
Update pages/builders/chain-operators/deploy/smart-contracts.mdx
krofax Jan 29, 2025
e187e28
Update pages/builders/chain-operators/deploy/smart-contracts.mdx
krofax Jan 29, 2025
a9c0c53
merge works from richard
krofax Jan 30, 2025
f86446e
fix lint issues
krofax Jan 30, 2025
6ccbd06
update the bash syntax
krofax Jan 30, 2025
fdf8333
updated the smart contract deployment with op-deployer
krofax Jan 30, 2025
8f30df3
updated the createL2 testnet tutorial
krofax Jan 30, 2025
d6c7de6
update term
krofax Jan 30, 2025
667540c
updated the intent file
krofax Jan 30, 2025
56db831
updated the command for op-deployer
krofax Jan 30, 2025
b66f13e
updated some wee things
krofax Jan 30, 2025
624915a
fix lint
krofax Jan 31, 2025
bdce87e
Update pages/builders/chain-operators/deploy/genesis.mdx
krofax Feb 4, 2025
d2de832
updated section
krofax Feb 11, 2025
568e1d4
resolve comments
krofax Feb 11, 2025
af3d902
fix merge conflicts
krofax Feb 11, 2025
b753f03
fix redirect links
krofax Feb 11, 2025
c3e1207
fix broken links
krofax Feb 11, 2025
a1ecb27
resolve comments
krofax Feb 18, 2025
17210b7
fix conflicts
krofax Feb 18, 2025
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
45 changes: 24 additions & 21 deletions pages/builders/chain-operators/deploy/genesis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Callout } from 'nextra/components'
# OP Stack genesis creation

<Callout type="info">
The recommended way to generate genesis and rollup configuration files is using `op-deployer`.
The recommended way to generate genesis and rollup configuration files is using `op-deployer`.
This ensures standardization and compatibility with the Superchain.
</Callout>

Expand All @@ -18,28 +18,31 @@ These files are crucial for initializing the execution client (`op-geth`) and co

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-deployers `inspect` commands.
3. **Initialize** your off-chain components (e.g., execution client, consensus client).
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
Comment thread
krofax marked this conversation as resolved.

### 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 <YOUR_L1_CHAIN_ID> --l2-chain-ids <YOUR_L2_CHAIN_ID> --workdir .deployer
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 <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`](https://chainid.network/).

3. You have edited that intent file to your liking (roles, addresses, etc.).
3. You have edited that intent file to your liking (roles, addresses, etc.).
Comment thread
krofax marked this conversation as resolved.

### Step 1: Deploy the L1 contracts

To deploy your chain to L1, run:

```bash
./bin/op-deployer apply --workdir .deployer \
--l1-rpc-url <RPC_URL_FOR_L1> \
Expand All @@ -48,28 +51,29 @@ To deploy your chain to L1, run:

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

Expand All @@ -79,7 +83,7 @@ You can also use the following inspect subcommands to get additional data:
```bash
./bin/op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
./bin/op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain

```

## Legacy method: using foundry script

Expand Down Expand Up @@ -143,7 +147,6 @@ 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()'
```
Comment thread
krofax marked this conversation as resolved.
Outdated

## Subcommand (op-node genesis l2)

Expand Down
83 changes: 65 additions & 18 deletions pages/builders/chain-operators/deploy/smart-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ lang: en-US
description: Learn how to deploy the OP Stack L1 smart contracts.
---

import { Callout } from 'nextra/components'
import { Callout, Steps } from 'nextra/components'

# OP Stack smart contract deployment

<Callout type="warning">
This page is out of date and shows the legacy method for smart contract deployment.
For the latest recommended method, use [op-deployer](/builders/chain-operators/tools/op-deployer).
<Callout type="info">
Standard OP Stack chains must use the latest governance approved and audited versions of the smart contract code.
</Callout>

The following guide shows you how to deploy the OP Stack L1 smart contracts.
Expand All @@ -19,29 +18,28 @@ official contract releases**. You can visit the see the [smart contract overview
for the official release versions. Changes to the smart contracts are
generally not considered backwards compatible.
Comment thread
krofax marked this conversation as resolved.

<Callout>
Standard OP Stack chains should use the latest governance approved and audited versions of the smart contract code.
<Callout type="warning">
The following deployment information outlines the legacy method for deploying the OP Stack L1 contracts.
This method is not recommended and is provided only for historical context.
</Callout>

## Deployment configuration

Deploying your OP Stack contracts requires creating a deployment configuration
JSON file. You will create a new deployment configuration file in the following
monorepo subdirectory: [packages/contracts-bedrock/deploy-config](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/deploy-config)
For the full set of deployment configuration options and their meanings, you
can see the [rollup deployment configuration page](/builders/chain-operators/configuration/rollup).
To deploy OP Stack contracts, you need to create a deployment configuration JSON file.
The file should be placed in the following monorepo subdirectory: [packages/contracts-bedrock/deploy-config](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/deploy-config).

For a detailed explanation of the configuration options and their meanings, refer to the [rollup deployment configuration page](/builders/chain-operators/configuration/rollup).

## Deployment script
## Deployment script (Legacy method)

The smart contracts are deployed using [foundry](https://github.com/foundry-rs)
and you can find the script's source code in the monorepo at
The legacy method for deploying smart contracts uses [foundry](https://github.com/foundry-rs) and the deployment script located in the monorepo at
[packages/contracts-bedrock/scripts/deploy/Deploy.s.sol](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol).

### State diff

Before deploying the contracts, you can verify the state diff by using the `runWithStateDiff()` function signature in the deployment script, which produces
the outputs inside [`snapshots/state-diff/`](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/snapshots/state-diff).
Run the deployment with state diffs by executing:
You can verify the state diff before deploying the contracts by using the `runWithStateDiff()` function in the deployment script.
This produces outputs in [`snapshots/state-diff/`](https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/snapshots/state-diff).
Run the deployment with state diffs using the following command:

```bash
forge script -vvv scripts/deploy/Deploy.s.sol:Deploy --sig 'runWithStateDiff()' --rpc-url $ETH_RPC_URL --broadcast --private-key $PRIVATE_KEY
Expand Down Expand Up @@ -82,6 +80,55 @@ All functions for deploying a single contract are public, meaning that
the `--sig` argument to forge script can be used to target the deployment of a
single contract.

## Using `op-deployer`
Comment thread
krofax marked this conversation as resolved.
Outdated

The recommended way to deploy the L1 smart contracts is with the `op-deployer` tool.
Follow these steps:

<Steps>
### Set Up your environment

* Install `op-deployer`:
The recommended way to install `op-deployer` is to download the latest release from the monorepo's
[release page](https://github.com/ethereum-optimism/optimism/releases). To install a release, download the binary
for your platform then extract it somewhere on your `PATH`.
* Access to the L1 blockchain (e.g., Sepolia or Mainnet) via an RPC URL.
* A private key with sufficient funds to cover deployment costs.

### Create an intent file

* Define the configuration of your chain in an intent file.
* This file specifies the deployment parameters for both L1 and L2.
Follow the instructions provided in the [configure your chain](/builders/chain-operators/tools/op-deployer#init-configure-your-chain) section to generate the intent file.

### Run the `apply` command

Execute the following command to deploy the L1 smart contracts:

```bash
./bin/op-deployer apply --workdir .deployer --l1-rpc-url <rpc-url> --private-key <private key hex>
```

* Replace `<rpc-url>` with your L1 RPC URL.
* Replace `<private key hex>` with the private key of the account used for deployment.

### Verify the deployment

Once the deployment is complete, you can verify the deployed contract addresses and configuration:

* Check the deployment output for contract addresses and transaction details.
* Verify the deployed contracts on the block explorer using the specified `ETHERSCAN_API_KEY` in the configuration file.
* To outputs all L1 contract addresses for an L2 chain run:
```bash
./bin/op-deployer inspect l1 --workdir .deployer <l2-chain-id>
```
</Steps>

<Callout type="info">
If you need deterministic deployment (e.g., for deploying contracts at the same address across multiple chains),
use the `CREATE2` method.
</Callout>

## Best practices

Production users should deploy their L1 contracts from a contracts release.
Expand All @@ -93,7 +140,7 @@ Starting with permissioned fault proofs gives chain operators time to get comfor
running the additional infrastructure requirements: [op-challenger](https://github.com/ethereum-optimism/optimism/tree/develop/op-challenger) and
[monitoring](https://github.com/ethereum-optimism/monitorism/tree/main). There are also
additional changes to the economics of operating a permissionless fault proof that chain
operators should have a firm understanding of.
operators should have a firm understanding of.
Comment thread
krofax marked this conversation as resolved.
Outdated

## Next steps

Expand Down
62 changes: 36 additions & 26 deletions pages/builders/chain-operators/tools/op-deployer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ The base use case for `op-deployer` is deploying new OP Chains. This process is

To get started with `op-deployer`, create an intent file that defines your desired chain configuration. Use the built-in `op-deployer` utility to generate this file:

<Callout type="info">
In deployment mode, op-deployer uses a declarative intent file to determine how a new chain should be configured.
Comment thread
krofax marked this conversation as resolved.
Outdated
Then, it runs through a deployment pipeline to actually deploy the chain.
</Callout>

```
./bin/op-deployer init --l1-chain-id 11155111 --l2-chain-ids <l2-chain-id> --workdir .deployer
```

Replace `<l2-chain-id>` with the exact value.

This command will create a directory called `.deployer` in your current working directory containing the intent file and an empty `state.json` file. `state.json` is populated with the results of your deployment, and never needs to be edited directly.

Your intent file will need to be modified to your parameters, but it will initially look something like this:
Expand All @@ -43,39 +50,40 @@ Your intent file will need to be modified to your parameters, but it will initia


```toml
deploymentStrategy = "live" # Deploying a chain to a live network i.e. Sepolia
l1ChainID = 11155111 # The chain ID of the L1 chain you'll be deploying to
configType = "standard-overrides"
l1ChainID = 11155111 # The chain ID of Sepolia (L1) you'll be deploying to.
fundDevAccounts = true # Whether or not to fund dev accounts using the test... junk mnemonic on L2.
l1ContractsLocator = "tag://op-contracts/v1.6.0" # L1 smart contracts versions
l1ContractsLocator = "tag://op-contracts/v1.8.0-rc.4" # L1 smart contracts versions
l2ContractsLocator = "tag://op-contracts/v1.7.0-beta.1+l2-contracts" # L2 smart contracts versions

# Delete this table if you are using the shared Superchain contracts on the L1
# If you are deploying your own SuperchainConfig and ProtocolVersions contracts, fill in these details
[superchainRoles]
proxyAdminOwner = "0xb9cdf788704088a4c0191d045c151fcbe2db14a4"
protocolVersionsOwner = "0x85d646ed26c3f46400ede51236d8d7528196849b"
guardian = "0x8c7e4a51acb17719d225bd17598b8a94b46c8767"
proxyAdminOwner = "0x1eb2ffc903729a0f03966b917003800b145f56e2"
protocolVersionsOwner = "0x79add5713b383daa0a138d3c4780c7a1804a8090"
guardian = "0x7a50f00e8d05b95f98fe38d8bee366a7324dcf7e"

# List of L2s to deploy. op-deployer can deploy multiple L2s at once
[[chains]]
# Your chain's ID, encoded as a 32-byte hex string
id = "0x0000000000000000000000000000000000000000000000000000000000003039"
id = "0x00000000000000000000000000000000000000000000000000000a25406f3e60"
# Update the fee recipient contract
baseFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
l1FeeVaultRecipient = "0x0000000000000000000000000000000000000000"
sequencerFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
baseFeeVaultRecipient = "0x100f829718B5Be38013CC7b29c5c62a08D00f1ff"
l1FeeVaultRecipient = "0xbAEaf33e883068937aB4a50871f2FD52e241013A"
sequencerFeeVaultRecipient = "0xd0D5D18F0ebb07B7d728b14AAE014eedA814d6BD"
eip1559DenominatorCanyon = 250
eip1559Denominator = 50
eip1559Elasticity = 6
# Various ownership roles for your chain. When you use op-deployer init, these roles are generated using the
# test... junk mnemonic. You should replace these with your own addresses for production chains.
[chains.roles]
l1ProxyAdminOwner = "0x1a66b55a4f0139c32eddf4f8c60463afc3832e76"
l2ProxyAdminOwner = "0x7759a8a43aa6a7ee9434ddb597beed64180c40fd"
systemConfigOwner = "0x8e35d9523a0c4c9ac537d254079c2398c6f3b35f"
unsafeBlockSigner = "0xbb19dce4ce51f353a98dbab31b5fa3bc80dc7769"
batcher = "0x0e9c62712ab826e06b16b2236ce542f711eaffaf"
proposer = "0x86dfafe0689e20685f7872e0cb264868454627bc"
challenger = "0xf1658da627dd0738c555f9572f658617511c49d5"
l1ProxyAdminOwner = "0xdf5a644aed1b5d6cE0DA2aDd778bc5f39d97Ac88"
l2ProxyAdminOwner = "0xC40445CD88dDa2A410F86F6eF8E00fd52D8381FD"
systemConfigOwner = "0xB32296E6929F2507dB8153A64b036D175Ac6E89e"
unsafeBlockSigner = "0xA53526b516df4eEe3791734CE85311569e0eAD78"
batcher = "0x8680d36811420359093fd321ED386a6e76BE2AF3"
proposer = "0x41b3B204099771aDf857F826015703A1030b6675"
challenger = "0x7B51A480dAeE699CA3a4F68F9AAA434452112eF7"

```

Expand All @@ -96,10 +104,12 @@ You can also do chain by chain configurations in the `chains` table.

Now that you've created your intent file, you can apply it to your chain to deploy the L1 smart contracts:

```
op-deployer apply --workdir .deployer --l1-rpc-url <rpc-url> --private-key <private key hex>
```bash
./bin/op-deployer apply --workdir .deployer --l1-rpc-url <rpc-url> --private-key <private key hex>
```

* Replace `<rpc-url>` with your `L1_RPC_URL` and `<private key>` with your private key

This command will deploy the OP Stack to L1. It will deploy all L2s specified in the intent file. Superchain
configuration will be set to the Superchain-wide defaults - i.e., your chain will be opted into the [Superchain pause](https://specs.optimism.io/protocol/superchain-config.html#pausability)
and will use the same [protocol versions](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/superchain-upgrades.md)
Expand All @@ -113,17 +123,17 @@ address as other chains on the Superchain.

Inspect the `state.json` file by navigating to your working directory. With the contracts deployed, generate the genesis and rollup configuration files by running the following commands:

```
op-deployer inspect genesis --workdir .deployer <l2-chain-id> > .deployer/genesis.json
op-deployer inspect rollup --workdir .deployer <l2-chain-id> > .deployer/rollup.json
```bash
./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
```

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:

```
op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain
op-deployer inspect l2-semvers --workdir .deployer <l2-chain-id> # outputs the semvers for all L2 chains
```bash
./bin/op-deployer inspect l1 --workdir .deployer <l2-chain-id> # outputs all L1 contract addresses for an L2 chain
./bin/op-deployer inspect deploy-config --workdir .deployer <l2-chain-id> # outputs the deploy config for an L2 chain
./bin/op-deployer inspect l2-semvers --workdir .deployer <l2-chain-id> # outputs the semvers for all L2 chains
```
</Steps>

Expand Down
Loading