OP Stack L2 Chain
Sunrise's Data Availability Layer supports Layer 2 blockchains created using OP Stack This is a guide to connecting an L2 chain created using OP Stack to Sunrise chain with Sunrise Data. Data Availability layer is supported in Sunrise v0.3.0 and later.
This version of the OP Stack requires the L1 EVM chain for operation. Use some kind of testnet or local chain.
How to set up OP Stack
As an example, here is how to use OP Stack to create an L2 chain and run it on the Sunrise's Data Availability Layer.
This guide uses the Ethereum Sepolia testnet to meet the OP Stack requirements, but a local EVM chain will also work.
Dependencies
Dependencies and general installation instructions for Ubuntu 22.04.
node
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejscurl -fsSL https://get.pnpm.io/install.sh | sh -curl -L https://foundry.paradigm.xyz | bashjust
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list sudo apt update sudo apt install just
Set up Optimism Rollup Testnet
Optimism
Clone the optimism repo
Check out the correct branch
γWe have confirmed the operation with the latest version at the time of document update. If you use other versions, please check the differences.
Run the following to check you have all dependencies
Build all packages associated with Optimism
If you are having issues with this step, make sure your versions match those in the optimism docs. Specifically, you may have to downgrade your go version.
Clone and build op-geth
γ For more information on supported `op-geth, please check the Production Releases in the optimism repository.
Fill out environment variables
Run the script to generate addresses with the following command in the optimism repo:
./packages/contracts-bedrock/scripts/getting-started/wallets.shThe output will look like the following which will you need to paste into the environment file as well:
API key for RPC URL can be found in Infura or other providers.
Fund the addresses with enough Sepolia ETH, the optimism docs recommend the following:
Admin β 0.5 Sepolia ETH
Proposer β 0.2 Sepolia ETH
Batcher β 0.1 Sepolia ETH
Ref: Sepolia PoW Faucet
Load environment variables with direnv
direnv allowYou should see something similar to this after:If you do not see any output, try
nano ~/.zshrcnano ~/.bashrcAdd the following line depending on whether you use bash or zsh
Save the changes with
source ~/.zshrcsource ~/.bashrcConfigure the network
You can view the config in the
deploy-config/getting-started.jsonfile Add the following at the bottom of the config generatedDeploy the L1 contracts
L2 Allocs
Use your L2 chain id in
--chain.If you see a nondescript error that includes
EvmError: RevertandScript failedthen you likely need to change theIMPL_SALTenvironment variable. This variable determines the addresses of various smart contracts that are deployed via CREATE2(opens in a new tab). If the sameIMPL_SALTis used to deploy the same contracts twice, the second deployment will fail. You can generate a newIMPL_SALTby runningdirenv allowanywhere in the Optimism Monorepo.Generate the L2 config files
Check the end of the generated
rollup.jsonCreate an authentication key
Copy genesis files into op-geth directory
Initialize
op-geth
Start L2
Before optimism start, set up sunrised & sunrise-data, etc.
Start
op-gethStart
op-node--altda.da-server is your da-sererβs http URL
Start
op-batcherStart
op-proposerWork
Last updated