### Clone and Navigate to Code Directory Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/create-l2-rollup.mdx Clone the repository and navigate to the example directory to begin the setup process. ```bash git clone https://github.com/ethereum-optimism/docs.git cd docs/create-l2-rollup-example ``` -------------------------------- ### Supersim Vanilla Mode Startup Logs Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/reference/tools/supersim/vanilla.mdx Example output from starting Supersim in vanilla mode. It displays available accounts, their private keys, and the configuration details for the L1 and L2 chains, including their IDs, RPC endpoints, and log paths. ```text Available Accounts ----------------------- (0): 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (1): 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (2): 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (3): 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (4): 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (5): 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (6): 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (7): 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (8): 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (9): 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 Private Keys ----------------------- (0): 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 (1): 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d (2): 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a (3): 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 (4): 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a (5): 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba (6): 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e (7): 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 (8): 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 (9): 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 Orchestrator Config: L1: Name: L1 Chain ID: 900 RPC: http://127.0.0.1:8545 LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-900 L2: Name: OPChainA Chain ID: 901 RPC: http://127.0.0.1:9545 LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-901 Name: OPChainB Chain ID: 902 RPC: http://127.0.0.1:9546 LogPath: /var/folders/0w/ethers-phoenix/T/anvil-chain-902 ``` -------------------------------- ### Initialize Node Project and Install Dependencies Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/interoperability/manual-relay.mdx Sets up a new Node.js project and installs necessary libraries like viem and @eth-optimism/viem. ```sh mkdir -p manual-relay/offchain cd manual-relay/offchain npm init -y npm install --save-dev viem @eth-optimism/viem mkdir src ``` -------------------------------- ### Install OP Deployer from Source Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tools/op-deployer/installation.mdx Clone the repository, navigate to the op-deployer directory, build the binary, and copy it to your PATH. Ensure you have Go, just, and git installed. ```shell git clone git@github.com:ethereum-optimism/optimism.git # you can skip this if you already have the repo cd optimism/op-deployer just build cp ./bin/op-deployer /usr/local/bin/op-deployer # or any other directory in your $PATH ``` -------------------------------- ### Initialize and Start the Challenger Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/configuration/op-challenger-config-guide.mdx Commands to navigate to the challenger-node directory, make the startup script executable, and then run the script to start the challenger. ```bash # Make sure you're in the challenger-node directory cd challenger-node # Make script executable chmod +x scripts/start-challenger.sh # Start challenger ./scripts/start-challenger.sh ``` -------------------------------- ### Install viem Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-estimate-costs.mdx Install the viem library using pnpm. ```bash pnpm add viem ``` -------------------------------- ### Make and Start the Proposer Script Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-proposer-setup.mdx Make the proposer startup script executable and then run it to start the proposer service. This should be done after configuring the script and environment variables. ```bash # Make the script executable chmod +x scripts/start-proposer.sh # Start the proposer ./scripts/start-proposer.sh ``` -------------------------------- ### Start Node REPL Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-estimate-costs.mdx Start the Node.js REPL to interact with Viem. ```bash node ``` -------------------------------- ### Start Sequencer Scripts Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-geth-setup.mdx Make the sequencer start scripts executable and then run them to start the op-geth and op-node services. ```bash chmod +x scripts/start-op-geth.sh chmod +x scripts/start-op-node.sh ./scripts/start-op-geth.sh ``` ```bash ./scripts/start-op-node.sh ``` -------------------------------- ### Install viem Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-trace-txns.mdx Installs the viem library as a project dependency. ```bash pnpm add viem ``` -------------------------------- ### Verify OP Challenger Installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-challenger-setup.mdx After building from source, verify the installation by running the challenger binary with the `--help` flag. This command should output the available commands and flags for the op-challenger. ```bash ./op-challenger/bin/op-challenger --help ``` -------------------------------- ### Op-geth Snap Sync Start Logs Source: https://github.com/ethereum-optimism/docs/blob/mintlify/node-operators/tutorials/run-node-from-source.mdx These logs indicate the start of the snap sync process in op-geth. Observe the 'Starting EL sync' message and the subsequent 'Sync progress' and 'Optimistically inserting unsafe L2 execution payload' logs. ```text INFO [03-06|10:56:55.602] Starting EL sync INFO [03-06|10:56:55.615] Sync progress reason="unsafe payload from sequencer while in EL sync" l2_finalized=000000..000000:0 l2_safe=000000..000000:0 l2_pending_safe=000000..000000:0 l2_unsafe=4284ab..7e7e84:117076319 l2_time=1,709,751,415 l1_derived=000000..000000:0 INFO [03-06|10:56:57.567] Optimistically inserting unsafe L2 execution payload to drive EL sync id=4ac160..df4d12:117076320 ``` -------------------------------- ### Start Legacy Geth Node Source: https://github.com/ethereum-optimism/docs/blob/mintlify/node-operators/tutorials/run-node-from-source.mdx Use this command to start a legacy Geth node. Ensure you are in the directory where the `l2geth` binary was built. This is an optional step if you need to run a legacy Geth node alongside your OP Mainnet node. ```bash USING_OVM=true \ ETH1_SYNC_SERVICE_ENABLE=false \ RPC_API=eth,rollup,net,web3,debug \ RPC_ENABLE=true \ RPC_PORT=8546 \ ./build/bin/geth --datadir /path/to/l2geth-datadir ``` -------------------------------- ### Start op-proposer Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/management/operations.mdx Start the `op-proposer` service with specified configuration parameters. Ensure all required environment variables and addresses are correctly set. ```sh ./bin/op-proposer \ --poll-interval=12s \ --rpc.port=8560 \ --rollup-rpc=http://localhost:8547 \ --l2oo-address=0xYourL2OutputOracleAddress \ --private-key=$PROPOSER_PRIVATE_KEY \ --l1-eth-rpc=$L1_RPC_URL ``` -------------------------------- ### Start the proxyd Service Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tools/proxyd.mdx Once the configuration file is ready, start the proxyd service using this command, providing the path to your TOML configuration file. ```bash proxyd ``` -------------------------------- ### Proposer Initialization Log Example Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-proposer-setup.mdx Example log messages observed during the initialization phase of the OP Proposer service, indicating successful connection to the DisputeGameFactory. ```text lvl=info msg="Initializing L2Output Submitter" lvl=info msg="Connected to DisputeGameFactory" ``` -------------------------------- ### Install Actions SDK with bun Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/quickstarts/actions.mdx Install the Actions SDK using bun. bun is a new, fast JavaScript runtime and toolkit. ```bash bun add @eth-optimism/actions-sdk ``` -------------------------------- ### Install Mise and Required Tools Source: https://github.com/ethereum-optimism/docs/blob/mintlify/create-l2-rollup-example/README.md Use mise to manage tool versions for a consistent development environment. Run 'mise install' after cloning the repository to set up all necessary tools. ```bash curl https://mise.jdx.dev/install.sh | bash cd docs/create-l2-rollup-example mise install ``` -------------------------------- ### Verify op-challenger Installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/configuration/op-challenger-config-guide.mdx Verify that the op-challenger component has been installed correctly by running the --help command. This will display the available commands and flags for the challenger. ```bash # Make sure you're in the optimism directory ./op-challenger/bin/op-challenger --help # You should see the challenger help output with available commands and flags ``` -------------------------------- ### Example Task Configuration Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/l1-contract-upgrades/superchain-ops-guide.mdx This is an example of a task configuration file (`config.toml`) generated after creating a new task. It specifies the L2 chains to be upgraded and the template used for the upgrade. ```toml l2chains = [] # e.g. [{name = "OP Mainnet", chainId = 10}] templateName = "OPCMUpgradeV200" ``` -------------------------------- ### Example Batcher Configuration Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/configuration/batcher.mdx A basic example of batcher configuration. Optimal settings vary per chain. Key variables for batch generation, submission, and transaction management are shown. ```env OP_BATCHER_WAIT_NODE_SYNC: true OP_BATCHER_CHECK_RECENT_TXS_DEPTH: 5 OP_BATCHER_POLL_INTERVAL: "5s" OP_BATCHER_BATCH_TYPE: "1" # span OP_BATCHER_COMPRESSION_ALGO: brotli-10 OP_BATCHER_DATA_AVAILABILITY_TYPE: auto OP_BATCHER_MAX_CHANNEL_DURATION: "150" # up to 30 min to fill blobs OP_BATCHER_TARGET_NUM_FRAMES: "5" # 5 blobs, can go to 6 with Pectra activated on L1 OP_BATCHER_SUB_SAFETY_MARGIN: "300" # 1h safety margin to prevent seq window elapse OP_BATCHER_NUM_CONFIRMATIONS: "4" OP_BATCHER_NETWORK_TIMEOUT: "10s" OP_BATCHER_TXMGR_MIN_BASEFEE: "2.0" OP_BATCHER_TXMGR_MIN_TIP_CAP: "2.0" OP_BATCHER_TXMGR_FEE_LIMIT_MULTIPLIER: 16 # allow up to 4 doublings OP_BATCHER_MAX_PENDING_TX: "10" OP_BATCHER_RESUBMISSION_TIMEOUT: "180s" # wait 3 min before bumping fees OP_BATCHER_ACTIVE_SEQUENCER_CHECK_DURATION: 5s ``` -------------------------------- ### Run Automated L2 Rollup Setup Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/code-setup.mdx Execute these commands to copy environment configuration, download tools, deploy contracts, and start services for the L2 Rollup setup. ```bash # Copy and configure environment cp .example.env .env # Edit .env with your values # Run the automated setup make init # Download tools make setup # Deploy and configure make up # Start services ``` -------------------------------- ### Get Op-Node Version (cast) Source: https://github.com/ethereum-optimism/docs/blob/mintlify/node-operators/reference/op-node-json-rpc.mdx This `cast` command fetches the op-node's software version. It's a quick way to verify the running version if you have `cast` installed. ```sh cast rpc optimism_version --rpc-url http://localhost:9545 ``` -------------------------------- ### Build op-deployer from Source Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-deployer-setup.mdx Instructions for installing op-deployer by building it from source. Requires Go, just, and git. Includes verification. ```bash git clone https://github.com/ethereum-optimism/optimism.git # you can skip this if you already have the repo cd optimism/op-deployer just build cp ./bin/op-deployer /usr/local/bin/op-deployer # or any other directory in your $PATH # Verify installation op-deployer --version ``` -------------------------------- ### Configure op-proposer Startup Script Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-proposer-setup.mdx This script initializes and runs the op-proposer binary with specified configuration parameters. Ensure all environment variables are set in the .env file. ```bash #!/bin/bash source .env # Path to the op-proposer binary we built ../../optimism/op-proposer/bin/op-proposer \ --poll-interval=$POLL_INTERVAL \ --rpc.port=$PROPOSER_RPC_PORT \ --rpc.enable-admin \ --rollup-rpc=$ROLLUP_RPC_URL \ --l1-eth-rpc=$L1_RPC_URL \ --private-key=$PRIVATE_KEY \ --game-factory-address=$GAME_FACTORY_ADDRESS \ --game-type=$GAME_TYPE \ --proposal-interval=$PROPOSAL_INTERVAL \ --num-confirmations=1 \ --resubmission-timeout=30s \ --wait-node-sync=true \ --log.level=info ``` -------------------------------- ### Example Intent File Configuration Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tools/op-deployer/usage/init.mdx This TOML file defines the configuration for an OP Stack deployment. Ensure all zero-value addresses are updated to appropriate values for your specific chain setup. For development, EOAs are acceptable; for production, use secure multisigs or HSMs. ```toml configType = "standard" l1ChainID = 11155420 fundDevAccounts = false useInterop = false l1ContractsLocator = "tag://op-contracts/v1.8.0-rc.4" l2ContractsLocator = "tag://op-contracts/v1.7.0-beta.1+l2-contracts" [superchainRoles] proxyAdminOwner = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570" protocolVersionsOwner = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570" guardian = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570" [[chains]] id = "0x0000000000000000000000000000000000000000000000000000000000002390" baseFeeVaultRecipient = "0x0000000000000000000000000000000000000000" l1FeeVaultRecipient = "0x0000000000000000000000000000000000000000" sequencerFeeVaultRecipient = "0x0000000000000000000000000000000000000000" operatorFeeVaultRecipient = "0x0000000000000000000000000000000000000000" eip1559DenominatorCanyon = 250 eip1559Denominator = 50 eip1559Elasticity = 6 # Revenue Sharing Configuration useRevenueShare = true chainFeesRecipient = "0x0000000000000000000000000000000000000000" [chains.roles] l1ProxyAdminOwner = "0x0000000000000000000000000000000000000000" l2ProxyAdminOwner = "0x0000000000000000000000000000000000000000" systemConfigOwner = "0x0000000000000000000000000000000000000000" unsafeBlockSigner = "0x0000000000000000000000000000000000000000" batcher = "0x0000000000000000000000000000000000000000" proposer = "0x0000000000000000000000000000000000000000" challenger = "0x0000000000000000000000000000000000000000" ``` -------------------------------- ### Withdraw ETH from L2 to L1 using Viem OP Stack Actions Source: https://context7.com/ethereum-optimism/docs/llms.txt Use this snippet to withdraw ETH from OP Sepolia back to Sepolia. This process requires three L1 transactions and a 7-day challenge period. Ensure the client setup from the deposit example is available. ```typescript // Uses same client setup as the deposit example above // Step 1: Build and send withdrawal on L2 const withdrawalArgs = await publicClientL1.buildInitiateWithdrawal({ value: parseEther('0.005'), to: account.address, }); const withdrawalHash = await walletClientL2.initiateWithdrawal(withdrawalArgs); console.log(`L2 withdrawal tx: ${withdrawalHash}`); // Step 2: Wait for L2 confirmation const withdrawalReceipt = await publicClientL2.waitForTransactionReceipt({ hash: withdrawalHash }); // Optional: Check withdrawal status before waiting const status = await publicClientL1.getWithdrawalStatus({ receipt: withdrawalReceipt, targetChain: walletClientL2.chain, }); console.log(`Withdrawal status: ${status}`); // Possible values: "waiting-to-prove" | "ready-to-prove" | "waiting-to-finalize" | "ready-to-finalize" | "finalized" // Step 3: Wait until withdrawal is ready to prove, then prove it const { output, withdrawal } = await publicClientL1.waitToProve({ receipt: withdrawalReceipt, targetChain: walletClientL2.chain, }); const proveArgs = await publicClientL2.buildProveWithdrawal({ output, withdrawal }); const proveHash = await walletClientL1.proveWithdrawal(proveArgs); await publicClientL1.waitForTransactionReceipt({ hash: proveHash }); // Step 4: Wait for 7-day challenge period, then finalize await publicClientL1.waitToFinalize({ targetChain: walletClientL2.chain, withdrawalHash: withdrawal.withdrawalHash, }); const finalizeHash = await walletClientL1.finalizeWithdrawal({ targetChain: walletClientL2.chain, withdrawal, }); const finalizeReceipt = await publicClientL1.waitForTransactionReceipt({ hash: finalizeHash }); console.log('Withdrawal finalized:', finalizeReceipt.status); // Expected output: Withdrawal finalized: success ``` -------------------------------- ### Start and Verify OP-Challenger Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-challenger-setup.mdx After creating the startup script, make it executable and run it from the `rollup/challenger` directory. Monitor the `challenger.log` file to ensure the challenger connects successfully to L1 and L2, loads configurations, and begins monitoring dispute games. ```bash # Make sure you're in the rollup/challenger directory cd rollup/challenger # Make script executable chmod +x scripts/start-challenger.sh # Start challenger ./scripts/start-challenger.sh ``` ```bash # Check challenger logs tail -f challenger-data/challenger.log # Or if running in foreground, monitor the output ``` -------------------------------- ### Install Supersim with Homebrew Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/development/supersim/installation.mdx Use Homebrew to install Supersim after tapping the Optimism repository. Ensure Homebrew is installed on your system. ```bash brew tap ethereum-optimism/tap brew install supersim ``` -------------------------------- ### Create Cross-DOM Project with viem Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/bridging/cross-dom-solidity.mdx Initializes a new project directory, navigates into it, and installs viem using pnpm. ```bash mkdir cross-dom cd cross-dom pnpm init pnpm add viem ``` -------------------------------- ### Install @eth-optimism/viem Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/bridging/cross-dom-bridge-erc20.mdx Install the @eth-optimism/viem package using pnpm. ```bash pnpm add @eth-optimism/viem ``` -------------------------------- ### Create OP-Challenger Startup Script Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/configuration/op-challenger-config-guide.mdx This bash script initializes environment variables and starts the op-challenger binary with various configuration flags. Ensure all required environment variables are set in the .env file. ```bash #!/bin/bash source .env # Path to the challenger binary ../optimism/op-challenger/bin/op-challenger \ --trace-type permissioned,cannon \ --l1-eth-rpc=$L1_RPC_URL \ --l2-eth-rpc=$L2_RPC_URL \ --l1-beacon=$L1_BEACON \ --rollup-rpc=$ROLLUP_RPC_URL \ --game-factory-address $GAME_FACTORY_ADDRESS \ --datadir=$DATADIR \ --cannon-bin=$CANNON_BIN \ --cannon-rollup-config=$CANNON_ROLLUP_CONFIG \ --cannon-l2-genesis=$CANNON_L2_GENESIS \ --cannon-server=$CANNON_SERVER \ --cannon-prestate=$CANNON_PRESTATE \ --mnemonic "$MNEMONIC" \ --hd-path "$HD_PATH" ``` -------------------------------- ### Configure Environment Variables for Deployment Source: https://github.com/ethereum-optimism/docs/blob/mintlify/create-l2-rollup-example/README.md Set up your deployment environment by copying the example .env file and filling in your specific L1 RPC URLs, private key, and optional configurations like P2P_ADVERTISE_IP and L2_CHAIN_ID. ```bash # L1 Configuration (Sepolia testnet) # Option 1: Public endpoint (no API key required) L1_RPC_URL="https://ethereum-sepolia-rpc.publicnode.com" L1_BEACON_URL="https://ethereum-sepolia-beacon-api.publicnode.com" # Option 2: Private endpoint (requires API key) # L1_RPC_URL="https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY" # L1_BEACON_URL="https://ethereum-sepolia-beacon-api.publicnode.com" # Private key for deployment and operations # IMPORTANT: Never commit this to version control PRIVATE_KEY="YOUR_PRIVATE_KEY_WITHOUT_0x_PREFIX" # Optional: Public IP for P2P networking (defaults to 127.0.0.1 for local testing) P2P_ADVERTISE_IP="127.0.0.1" # Optional: Custom L2 Chain ID (default: 16584) L2_CHAIN_ID="16584" ``` -------------------------------- ### Create .env Configuration File Source: https://github.com/ethereum-optimism/docs/blob/mintlify/node-operators/tutorials/node-from-docker.mdx Copy the example environment file to create your node's configuration. This file will store all necessary settings for your node. ```bash cp .env.example .env ``` -------------------------------- ### Start and Monitor OP Batcher Service Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-batcher-setup.mdx Commands to start the batcher service in detached mode using docker-compose and to continuously monitor its logs. Ensure the sequencer network is active before starting. ```bash # Make sure your sequencer network exists # Start the batcher docker-compose up -d # View logs docker-compose logs -f op-batcher ``` -------------------------------- ### Verify op-proposer Installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-proposer-setup.mdx Run this command to verify that the op-proposer has been installed correctly. ```bash ./bin/op-proposer --version ``` -------------------------------- ### Create project folder and navigate Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-estimate-costs.mdx Use these bash commands to create a new directory for your project and change into it. ```bash mkdir op-est-cost-tutorial cd op-est-cost-tutorial ``` -------------------------------- ### Verify OP Batcher Installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-batcher-setup.mdx Run this command to confirm that the op-batcher binary has been successfully installed. ```bash ./bin/op-batcher --version ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/create-l2-rollup.mdx Run this command to verify that Docker is installed and running correctly on your system. ```bash docker run hello-world ``` -------------------------------- ### Create Working Directory Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/l1-contract-upgrades/upgrade-op-contracts-1-3-1-8.mdx Sets up the necessary directories for the upgrade process. Ensure you are in the desired parent directory before running these commands. ```shell mkdir upgrade-dir cd upgrade-dir ``` ```shell mkdir outputs ``` -------------------------------- ### Run Automated Setup Commands Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/create-l2-rollup.mdx Execute these commands to initialize, set up, and launch all services for the OP Stack testnet. ```bash make init # Download op-deployer make setup # Deploy contracts and generate configs make up # Start all services make test-l1 # Verify L1 connectivity make test-l2 # Verify L2 functionality ``` -------------------------------- ### Verify Foundry and Supersim installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/interoperability/message-passing.mdx Verify that Foundry and Supersim are installed correctly by checking their versions. ```sh forge --version ./supersim --version ``` -------------------------------- ### Initialize Node.js project Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-estimate-costs.mdx Initialize your project with npm or pnpm. ```bash pnpm init ``` -------------------------------- ### Start op-geth Services Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-geth-setup.mdx Starts the op-geth and op-node services defined in the docker-compose.yml file in detached mode. ```bash # Start both services docker-compose up -d # View logs ``` -------------------------------- ### Verify op-node and op-geth installation Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-geth-setup.mdx Check that the op-node and op-geth binaries have been installed correctly by verifying their versions. ```bash # Make sure you're in the right directory ./bin/op-node --version ./build/bin/geth version ``` -------------------------------- ### Set Up Environment Variables for Challenger Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/guides/configuration/op-challenger-config-guide.mdx Create a .env file to store all necessary configuration values, including network access URLs, wallet details, and game factory address. Replace placeholder values with your actual configuration. ```bash # Create .env file with your actual values cat > .env << 'EOF' # L1 Configuration - Replace with your actual RPC URLs L1_RPC_URL=https://sepolia.infura.io/v3/YOUR_ACTUAL_INFURA_KEY # L2 Configuration - Replace with your actual node endpoints L2_RPC_URL=http://localhost:8545 ROLLUP_RPC_URL=http://localhost:8547 L1_BEACON=http://sepolia-cl-1:5051 # Wallet configuration - Choose either mnemonic + HD path OR private key MNEMONIC="test test test test test test test test test test test junk" HD_PATH="m/44'/60'/0'/0/0" # PRIVATE_KEY=0xYOUR_ACTUAL_PRIVATE_KEY # Alternative to mnemonic # Network configuration NETWORK=op-sepolia GAME_FACTORY_ADDRESS=0xYOUR_GAME_FACTORY_ADDRESS # Trace configuration TRACE_TYPE=permissioned,cannon # Data directory DATADIR=./challenger-data # Cannon configuration # Path to the cannon binary (built from optimism repo) CANNON_BIN=/cannon/bin/cannon # Configuration files CANNON_ROLLUP_CONFIG= CANNON_L2_GENESIS= CANNON_SERVER=/op-program/bin/op-program CANNON_PRESTATE= EOF ``` -------------------------------- ### Create Challenger Startup Script Source: https://github.com/ethereum-optimism/docs/blob/mintlify/chain-operators/tutorials/create-l2-rollup/op-challenger-setup.mdx This script configures and launches the OP-Challenger. Ensure all environment variables like L1_RPC_URL, L2_RPC_URL, etc., are set in your .env file. The script requires paths to the challenger binary and various configuration files for Cannon. ```bash #!/bin/bash source .env # Path to the challenger binary ../../optimism/op-challenger/bin/op-challenger \ --trace-type permissioned,cannon \ --l1-eth-rpc=$L1_RPC_URL \ --l2-eth-rpc=$L2_RPC_URL \ --l1-beacon=$L1_BEACON \ --rollup-rpc=$ROLLUP_RPC_URL \ --game-factory-address $GAME_FACTORY_ADDRESS \ --datadir=$DATADIR \ --cannon-bin=$CANNON_BIN \ --cannon-rollup-config=$CANNON_ROLLUP_CONFIG \ --cannon-l2-genesis=$CANNON_L2_GENESIS \ --cannon-server=$CANNON_SERVER \ --cannon-prestate=$CANNON_PRESTATE \ --private-key="$PRIVATE_KEY" ``` -------------------------------- ### Install Optimism Solidity Libraries Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/interoperability/message-passing.mdx Install the necessary Optimism contracts library and configure remappings for use in your project. ```sh cd lib npm install @eth-optimism/contracts-bedrock cd .. echo @eth-optimism/=lib/node_modules/@eth-optimism/ >> remappings.txt ``` -------------------------------- ### Install Actions SDK with npm Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/quickstarts/actions.mdx Install the Actions SDK using npm. This is the standard package manager for Node.js. ```bash npm install @eth-optimism/actions-sdk ``` -------------------------------- ### Set up account from private key Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/transactions/sdk-estimate-costs.mdx Create an account object from your private key stored in an environment variable. ```javascript const privateKey = process.env.TUTORIAL_PRIVATE_KEY const account = privateKeyToAccount(privateKey) ``` -------------------------------- ### Automated Full L2 Rollup Deployment with create-l2-rollup-example Source: https://context7.com/ethereum-optimism/docs/llms.txt Clone and run the `create-l2-rollup-example` script for a complete automated setup of OP Stack services using Docker. This includes op-deployer, op-geth, op-node, and more. ```bash # Clone the repository git clone https://github.com/ethereum-optimism/docs.git cd docs/create-l2-rollup-example # Configure environment cp .example.env .env # Edit .env with: # L1_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY # PRIVATE_KEY=0xYOUR_DEPLOYER_PRIVATE_KEY # L2_CHAIN_ID=your_chosen_chain_id # Run the full deployment pipeline make init # Download op-deployer binary make setup # Deploy L1 contracts + generate genesis.json + rollup.json make up # Start all OP Stack services via Docker Compose # Verify the deployment make test-l1 # Check L1 RPC connectivity make test-l2 # Verify L2 block production and RPC # Monitoring make logs # Stream logs from all services make status # Health check of running containers # Expected directory layout after setup: # rollup/ # ├── deployer/ # intent.toml, state.json, contract artifacts # ├── sequencer/ # genesis.json, rollup.json, op-geth + op-node config # ├── batcher/ # op-batcher config # ├── proposer/ # op-proposer config # └── challenger/ # op-challenger config ``` -------------------------------- ### Example Relayed Message Log Source: https://github.com/ethereum-optimism/docs/blob/mintlify/app-developers/tutorials/development/supersim/first-steps.mdx An example log output indicating a successful `RelayedMessage` for an ERC20 transfer between chains. ```log INFO [08-30|14:30:14.698] SuperchainTokenBridge#RelayERC20 token=0x420beeF000000000000000000000000000000001 from=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 to=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 amount=1000 source=901 ```