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 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d4a2b6f
adding deploy section
sbvegan Jun 4, 2024
e7e762e
small refactor to tutorial page
sbvegan Jun 4, 2024
6700d4f
stopped at line 168 in config.go
sbvegan Jun 5, 2024
3dc26c5
adding remaining missing configs
sbvegan Jun 5, 2024
f412cdc
linting
sbvegan Jun 7, 2024
6b9a12e
adding standard configuration notes
sbvegan Jun 7, 2024
4e366a2
adding some details
sbvegan Jun 7, 2024
9294c2a
refactoring configuration page
sbvegan Jun 10, 2024
9fc1240
removing configuration page link
sbvegan Jun 10, 2024
eb30500
Merge branch 'main' into deploy-section
sbvegan Jun 10, 2024
6b4938b
updating current wip
sbvegan Jun 11, 2024
9e87d06
new updates
sbvegan Jun 13, 2024
e71daa2
linting
sbvegan Jun 13, 2024
df82cc4
Apply suggestions from code review
sbvegan Jun 14, 2024
33d6756
moving things around
sbvegan Jun 14, 2024
e66eb78
improving ledgibility
sbvegan Jun 14, 2024
988d681
removing examples for now
sbvegan Jun 16, 2024
c0698cb
Merge branch 'main' into deploy-section
sbvegan Jun 16, 2024
e6c28a0
linting
sbvegan Jun 16, 2024
bc86bb2
Apply suggestions from code review
sbvegan Jun 17, 2024
bfebb3b
fixing broken links
sbvegan Jun 17, 2024
3fc8c0c
adding fjord note
sbvegan Jun 17, 2024
443e21c
Apply suggestions from code review
sbvegan Jun 17, 2024
7a34dfd
Update smart-contracts.mdx
cpengilly Jun 17, 2024
9a4e84a
some coderabbit suggestions
sbvegan Jun 18, 2024
f89f2a9
fixing header
sbvegan Jun 18, 2024
d8b47e5
Merge branch 'main' into deploy-section
sbvegan Jun 18, 2024
97002d2
Update pages/builders/chain-operators/management/best-practices.mdx
sbvegan Jun 18, 2024
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
1 change: 1 addition & 0 deletions pages/builders/chain-operators/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"architecture": "Architecture",
"self-hosted": "Start a Self-Hosted Chain",
"deploy": "Deployment",
"tutorials": "Tutorials",
"management": "Chain Management",
"features": "Chain Features",
Expand Down
7 changes: 7 additions & 0 deletions pages/builders/chain-operators/deploy/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"overview": "Overview",
"smart-contracts": "L1 Contract Deployment",
"genesis": "Genesis Creation",
"off-chain": "Off Chain Components"
}

45 changes: 45 additions & 0 deletions pages/builders/chain-operators/deploy/genesis.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: OP Stack Genesis Creation
lang: en-US
description: Learn how to create a genesis file for the OP Stack.
---

import { Callout } from 'nextra/components'

# OP Stack Genesis Creation

The following guide shows you how to generate the L2 allocs. This is a JSON
file that represents the L2 genesis state.

## [develop](https://github.com/ethereum-optimism/optimism/tree/develop)

<Callout type="warning">
The primary development branch is `develop`. It contains the most up-to-date
software that remains backwards compatible with the latest experimental
netowrk deployments. **Changes to made to the smart contracts are usually
NOT considered backwards compatible.**
Comment thread
sbvegan marked this conversation as resolved.
Outdated
</Callout>

As of 2024-06-04, a foundry script is used to generate the L2 genesis allocs.
The `CONTRACT_ADDRESSES_PATH` env var represents the deployment artifact that
was generated during a contract deployment. The same deploy config JSON file
should be used for L1 contracts deployment as when generating the L2 genesis
allocs. The `STATE_DUMP_PATH` env var represents the filepath at which the
allocs will be written to on disk.

```
CONTRACT_ADDRESSES_PATH=deployments/artifact.json \
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()'
```

## [op-contracts/v1.3.0](https://github.com/ethereum-optimism/optimism/tree/op-contracts/v1.3.0)

The Multi-Chain Prep (MCP) L1 [release](https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.3.0),
cross-chain upgrades and mitigates potential exploitation risks during
emergency, multi-chain upgrades by transitioning chain-specific deployment
configuration variables from immutables into storage. It also extends
`SystemConfig` to contain the addresses of the network’s contracts.
Comment thread
sbvegan marked this conversation as resolved.
Outdated

26 changes: 26 additions & 0 deletions pages/builders/chain-operators/deploy/off-chain.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: OP Stack Off Chain Components
lang: en-US
description: Learn some best practices around running the OP Stack's off chain components.
---

import { Callout } from 'nextra/components'

# OP Stack Off Chain Components

The following guide shows you some best practices around running the OP Stack's
off chain components.

## [develop](https://github.com/ethereum-optimism/optimism/tree/develop)

<Callout type="warning">
The primary development branch is `develop`. It contains the most up-to-date
software that remains backwards compatible with the latest experimental
netowrk deployments. **Changes to made to the smart contracts are usually
NOT considered backwards compatible.**
</Callout>


## latest release


123 changes: 123 additions & 0 deletions pages/builders/chain-operators/deploy/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: OP Stack Deployment Overview
lang: en-US
description: Learn about the different components of deploying the OP Stack.
---

import { Callout } from 'nextra/components'

# OP Stack Deployment Overview

When deploying an OP Stack chain, you'll be setting up four different
components. It's useful to understand what each of these components does before
you start deploying your chain. The OP Stack can be deployed as a L3 which
Comment thread
sbvegan marked this conversation as resolved.
Outdated
includes additional considerations. The following information assumes you're
deploying a L2 Rollup on Ethereum.

## Smart Contracts

The OP Stack uses a set of smart contracts on the L1 blockchain to manage
aspects of the Rollup. Each OP Stack chain has its own set of L1 smart
contracts that are deployed when the chain is created.

<Callout type="warning">
Standard OP Stack chains should only use governance approved and audited
smart contracts. The monorepo has them tagged with the following pattern
`op-contracts/vX.X.X` and you can review the release notes for details on the
changes. Read more about the details on our [Smart Contract Release Section](/stack/protocol/rollup/smart-contracts#releases).
</Callout>

## Sequencer Node

OP Stack chains use a Sequencer node to gather proposed transactions from users
and publish them to the L1 blockchain. OP Stack chains rely on at least one of
these Sequencer nodes. You can also run additional replica (non-Sequencer)
nodes.

### Consensus Client

OP Stack Rollup nodes, like Ethereum nodes, have a consensus client. The
consensus client is responsible for determining the list and ordering of blocks
and transactions that are part of your blockchain. Several implementations of
the OP Stack consensus client exist, including `op-node` (maintained by the
Optimism Foundation), [`magi`](https://github.com/a16z/magi) (maintained by
a16z) and [`hildr`](https://github.com/optimism-java/hildr) (maintained by OptimismJ).

### Execution Client

OP Stack nodes, like Ethereum nodes, also have an execution client. The
execution client is responsible for executing transactions and maintaining the
state of the blockchain. Various implementations of the OP Stack execution
client exist, including `op-geth` (maintained by Optimism Foundation),
[`op-erigon`](https://github.com/testinprod-io/op-erigon)
(maintained by Test in Prod), and [`op-nethermind`](https://docs.nethermind.io/get-started/installing-nethermind/#supported-networks).

## Batcher

The Batcher is a service that publishes transactions from the Rollup to the L1
blockchain. The Batcher runs continuously alongside the Sequencer and publishes
transactions in batches (hence the name) on a regular basis.
Comment thread
sbvegan marked this conversation as resolved.
Outdated

## Proposer

The Proposer is a service responsible for publishing transactions *results* (in
the form of L2 state roots) to the L1 blockchain. This allows smart contracts
on L1 to read the state of the L2, which is necessary for cross-chain
communication and reconciliation between state changes.

## Software Dependencies

| Dependency | Version | Version Check Command |
| ------------------------------------------------------------- | -------- | --------------------- |
| [git](https://git-scm.com/) | `^2` | `git --version` |
| [go](https://go.dev/) | `^1.21` | `go version` |
| [node](https://nodejs.org/en/) | `^20` | `node --version` |
| [pnpm](https://pnpm.io/installation) | `^8` | `pnpm --version` |
| [foundry](https://github.com/foundry-rs/foundry#installation) | `^0.2.0` | `forge --version` |
| [make](https://linux.die.net/man/1/make) | `^3` | `make --version` |
| [jq](https://github.com/jqlang/jq) | `^1.6` | `jq --version` |
| [direnv](https://direnv.net) | `^2` | `direnv --version` |

### Notes on Specific Dependencies

#### `node`

We recommend using the latest LTS version of Node.js (currently v20).
[`nvm`](https://github.com/nvm-sh/nvm) is a useful tool that can help you
manage multiple versions of Node.js on your machine. You may experience
unexpected errors on older versions of Node.js.

#### `foundry`

It's recommended to use the scripts in the monorepo's `package.json` for
managing `foundry` to ensure you're always working with the correct version.
This approach simplifies the installation, update, and version checking
process.

#### `direnv`

Parts of our tutorial use [`direnv`](https://direnv.net) as a way of loading
environment variables from `.envrc` files into your shell. This means you won't
have to manually export environment variables every time you want to use them.
`direnv` only ever has access to files that you explicitly allow it to see.

After [installing `direnv`](https://direnv.net/docs/installation.html), you
will need to **make sure that [`direnv` is hooked into your shell](https://direnv.net/docs/hook.html)**.
Make sure you've followed [the guide on the `direnv` website](https://direnv.net/docs/hook.html),
then **close your terminal and reopen it** so that the changes take effect (or
`source` your config file if you know how to do that).

<Callout>
Make sure that you have correctly hooked `direnv` into your shell by modifying
your shell configuration file (like `~/.bashrc` or `~/.zshrc`). If you haven't
edited a config file then you probably haven't configured `direnv` properly
(and things might not work later).
</Callout>

## Next Steps

* Check out what goes into [configuring](/builders/chain-operators/management/configuration)
Comment thread
sbvegan marked this conversation as resolved.
Outdated
an OP Stack Chain before you deploy.
* Learn how to create a rollup [genesis file](/builders/chain-operators/deploy/genesis).
* See what considrations need to be made when running the [off chain
components](/builders/chain-operators/deploy/off-chain).
73 changes: 73 additions & 0 deletions pages/builders/chain-operators/deploy/smart-contracts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: OP Stack Smart Contract Deployment
lang: en-US
description: Learn how to deploy the OP Stack L1 smart contracts.
---

import { Callout } from 'nextra/components'

# OP Stack Smart Contract Deployment

The following guide shows you how to deploy the OP Stack L1 smart contracts.
The primary development branch is `develop`. It contains the most up-to-date
software that remains backwards compatible with the latest experimental
network deployments. **Changes to made to the smart contracts are usually
Comment thread
sbvegan marked this conversation as resolved.
Outdated
NOT considered backwards compatible.**

<Callout>
Standard OP Stack chains should use governance approved and audited versions
of the smart contract code.
</Callout>

## Deployment Configuration

https://github.com/ethereum-optimism/optimism/blob/develop/op-chain-ops/genesis/config.go
Comment thread
sbvegan marked this conversation as resolved.
Outdated

## [develop](https://github.com/ethereum-optimism/optimism/tree/develop)

<Callout type="warning">
The primary development branch is `develop`. It contains the most up-to-date
software that remains backwards compatible with the latest experimental
netowrk deployments. **Changes to made to the smart contracts are usually
NOT considered backwards compatible.**
Comment thread
sbvegan marked this conversation as resolved.
Outdated
</Callout>

As of 2024-06-04, the smart contracts are deployed using `foundry`. The
`DEPLOYMENT_OUTFILE` env var will determine the filepath that the deployment
artifact is written to on disk after the deployment. It comes in the form of a
JSON file where keys are the names of the contracts and the values are the
addresses the contract was deployed to.

The `DEPLOY_CONFIG_PATH` is a filepath to a deploy config file, see the
deploy-config directory for examples and the DeployConfig definition for
descriptions of the values.

```
DEPLOYMENT_OUTFILE=deployments/artifact.json \
DEPLOY_CONFIG_PATH=<PATH_TO_MY_DEPLOY_CONFIG> \
forge script scripts/Deploy.s.sol:Deploy \
--broadcast --private-key $PRIVATE_KEY \
--rpc-url $ETH_RPC_URL
```

The `IMPL_SALT` env var can be used to set the create2 salt for deploying the
implementation contracts.

This will deploy an entire new system of L1 smart contracts including a new
SuperchainConfig. In the future there will be an easy way to deploy only
proxies and use shared implementations for each of the contracts as well as a
shared SuperchainConfig contract.

Comment thread
sbvegan marked this conversation as resolved.
Outdated
### Deploying a single contract
All of the 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.

## [op-contracts/v1.3.0](https://github.com/ethereum-optimism/optimism/tree/op-contracts/v1.3.0)

The Multi-Chain Prep (MCP) L1 [release](https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.3.0),
cross-chain upgrades and mitigates potential exploitation risks during
emergency, multi-chain upgrades by transitioning chain-specific deployment
configuration variables from immutables into storage. It also extends
`SystemConfig` to contain the addresses of the network’s contracts.
Comment thread
sbvegan marked this conversation as resolved.
Outdated

Loading