Here are the required software dependencies:
Dependency | Version | Version Check Command |
---|---|---|
git | ^2 | git --version |
go | ^1.21 | go version |
node | ^20 | node --version |
pnpm | ^8 | pnpm --version |
foundry | ^0.2.0 | forge --version |
make | ^3 | make --version |
jq | ^1.6 | jq --version |
direnv | ^2 | direnv --version |
-
Clone the repo:
git clone https://github.com/ethereum-optimism/optimism.git cd optimism
-
Checkout to "tutorials/chain" branch:
git checkout tutorials/chain
-
Check software dependencies:
./packages/contracts-bedrock/scripts/getting-started/versions.sh
-
Install dependencies:
pnpm install
-
Build packages:
make op-node op-batcher op-proposer pnpm build
Note: If you encounter an error related to
runtime.stopTheWorld
, change your Go version to 1.21.6.
-
Clone the repo:
git clone https://github.com/ethereum-optimism/op-geth.git cd op-geth
-
Build op-geth:
make geth
Open the .envrc
file and fill out these variables:
L1_RPC_URL
: URL for your L1 node (Sepolia node)L1_RPC_KIND
: Kind of L1 RPC (options: alchemy, quicknode, infura, parity, nethermind, debug_geth, erigon, basic, any)
You'll need four addresses and their private keys:
- Admin address (can upgrade contracts)
- Batcher address (publishes Sequencer transaction data to L1)
- Proposer address (publishes L2 transaction results to L1)
- Sequencer address (signs blocks on the p2p network)
Generate addresses:
cd optimism
./packages/contracts-bedrock/scripts/getting-started/wallets.sh
Warning: Do not use wallets.sh
for production deployments. Use hardware security modules and hardware wallets instead.
Copy the generated addresses to your .envrc
file.
Fund the generated addresses:
- Admin: 0.5 Sepolia ETH
- Batcher: 0.1 Sepolia ETH
- Proposer: 0.2 Sepolia ETH
-
Navigate to the optimism monorepo:
cd optimism
-
Allow direnv:
direnv allow
Troubleshooting direnv:
- Run
eval "$(direnv hook bash)"
- Uninstall and reinstall direnv
- Build direnv from source
- Re-execute
.envrc
file withsource .envrc
-
Navigate to the optimism monorepo:
cd optimism cd packages/contracts-bedrock
-
Install Foundry dependencies:
forge install
-
Generate configuration file:
./scripts/getting-started/config.sh
-
Deploy using op-deployer:
forge script scripts/deploy/Deploy.s.sol:Deploy --private-key $GS_ADMIN_PRIVATE_KEY --broadcast --rpc-url $L1_RPC_URL --slow
-
Install op-deployer:
cd ~ git clone https://github.com/ethereum-optimism/optimism.git op-deployer-source cd op-deployer-source/op-deployer go build -o ~/op-deployer/bin/op-deployer ./cmd/op-deployer chmod +x ~/op-deployer/bin/op-deployer
-
Initialize and configure
intent.toml
:cd ~/op-deployer ./bin/op-deployer init --l1-chain-id <L1_CHAIN_ID> --l2-chain-ids <L2_CHAIN_ID> --workdir .deployer
-
Deploy L1 contracts:
./bin/op-deployer apply --workdir .deployer --l1-rpc-url <RPC_URL_FOR_L1> --private-key <DEPLOYER_PRIVATE_KEY_HEX>
-
Generate L2 genesis and rollup files:
./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
-
Navigate to op-geth:
cd optimism/op-geth
-
Create data directory and build:
mkdir datadir make geth cp ~/op-deployer/.deployer/genesis.json ./ build/bin/geth init --state.scheme=hash --datadir=datadir genesis.json
-
Start op-geth (command provided in original guide)
-
Install
just
:sudo snap install just --classic
-
Navigate to op-node and build:
cd ~/op-deployer/op-node just op-node cp ~/op-deployer/.deployer/rollup.json ./
-
Start op-node (command provided in original guide)
-
Navigate to op-batcher:
cd ~/op-deployer/op-batcher
-
Build and start op-batcher (command provided in original guide)
-
Navigate to op-proposer:
cd ~/op-deployer/op-proposer
-
Build and start op-proposer (command provided in original guide)
- Use https://chainid.link/?network=opstack-getting-started to connect your wallet
-
Navigate to contracts-bedrock:
cd ~/op-deployer/packages/contracts-bedrock
-
Get L1StandardBridgeProxy address:
cat deployments/getting-started/.deploy | jq -r .L1StandardBridgeProxy
-
Send Sepolia ETH to the L1StandardBridgeProxy contract address
You can now interact with your Rollup like any other EVM chain. Send transactions, deploy contracts, and explore!