bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 44쪽
your sequencer setup.
<Info>
This guide uses `op-batcher/v1.16.11`, the latest release at the time of writing, alongside op-node/v1.19.3 and op-reth/v2.4.0 from the sequencer setup.
Always check the [release notes](https://github.com/ethereum-optimism/optimism/releases) for compatibility information.
</Info>
<Steps>
<Step title="Clone and build op-batcher">
```bash theme={null}
# If you don't already have the optimism repository from the sequencer setup
git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
# Checkout the latest release tag
git checkout op-batcher/v1.16.11
# Generate the embedded superchain config bundle (initializes the
# superchain-registry submodule; op-batcher embeds this file at compile time)
just build-superchain-go
# Build op-batcher
cd op-batcher
just
# Binary will be available at ./bin/op-batcher
```
</Step>
<Step title="Verify installation">
Run this command to verify the installation:
```bash theme={null}
./bin/op-batcher --version
```
</Step>
<Step title="Configuration setup">
<Info>
For advanced configuration options and fine-tuning your batcher, including:
* Batch submission policies
* Channel duration settings
* Data availability types (blobs vs calldata)
* Transaction throttling
* Network timeouts
Check out the [Batcher configuration reference](/chain-operators/reference/batcher-configuration).
This will help you optimize your batcher's performance and cost-efficiency.
</Info>
<Steps>
<Step title="Organize your workspace">
Create your batcher working directory:
```bash theme={null}
# Create batcher directory inside rollup
cd ../ # Go back to rollup directory
mkdir batcher
cd batcher
# Create scripts directory
mkdir scripts
```
Your final directory structure should look like:
```bash theme={null}
rollup/
├── deployer/ # From previous step
│ └── .deployer/ # Contains state.json
├── optimism/ # Contains op-batcher binary
├── sequencer/ # From previous step
└── batcher/ # You are here
├── state.json # Copied from deployer
├── .env # Environment variables
└── scripts/ # Startup scripts
└── start-batcher.sh
```
</Step>
<Step title="Extract BatchInbox address">
Extract the `BatchInbox` contract address from your op-deployer output:
```bash theme={null}
# Make sure you're in the rollup/batcher directory
cd rollup/batcher
# Copy the deployment state file from deployer
cp ../deployer/.deployer/state.json .
# Extract the BatchInbox address
BATCH_INBOX_ADDRESS=$(cat state.json | jq -r '.opChainDeployments[0].systemConfigProxyAddress')
echo "BatchInbox Address: $BATCH_INBOX_ADDRESS"
```
<Info>
The batcher submits transaction batches to the `BatchInbox` contract on L1. This contract is responsible for accepting and storing L2 transaction data.
</Info>
</Step>
<Step title="Set up environment variables">
Create your `.env` file with the actual values:
```bash theme={null}
# Create .env file with your actual values
# L1 Configuration - Replace with your actual RPC URL
L1_RPC_URL=https://sepolia.infura.io/v3/YOUR_ACTUAL_INFURA_KEY
# L2 Configuration - Should match your sequencer setup
L2_RPC_URL=http://localhost:8545
ROLLUP_RPC_URL=http://localhost:8547
# Contract addresses - Extract from your op-deployer output
BATCH_INBOX_ADDRESS=YOUR_ACTUAL_BATCH_INBOX_ADDRESS
# Private key - Replace with your actual private key
BATCHER_PRIVATE_KEY=YOUR_ACTUAL_PRIVATE_KEY
# Batcher configuration
POLL_INTERVAL=1s
SUB_SAFETY_MARGIN=6
NUM_CONFIRMATIONS=1
SAFE_ABORT_NONCE_TOO_LOW_COUNT=3
RESUBMISSION_TIMEOUT=30s
MAX_CHANNEL_DURATION=25
# RPC configuration
BATCHER_RPC_PORT=8548
```
**Important**: Replace ALL placeholder values (`YOUR_ACTUAL_*`) with your real configuration values!
</Step>
<Step title="Get your private key">
Get a private key from your wallet that will be used for submitting batches to L1. This account needs sufficient ETH to pay for L1 gas costs.
<Info>
The batcher account needs to be funded with ETH on L1 to pay for batch submission transactions. Monitor this account's balance regularly as it will consume ETH for each batch submission.
</Info>
</Step>
</Steps>
### Batcher configuration
Create `scripts/start-batcher.sh` in the same directory:
```bash theme={null}
#!/bin/bash
source .env
# Path to the op-batcher binary we built
../../optimism/op-batcher/bin/op-batcher \
--l2-eth-rpc=$L2_RPC_URL \
--rollup-rpc=$ROLLUP_RPC_URL \
--poll-interval=$POLL_INTERVAL \
--sub-safety-margin=$SUB_SAFETY_MARGIN \
--num-confirmations=$NUM_CONFIRMATIONS \
--safe-abort-nonce-too-low-count=$SAFE_ABORT_NONCE_TOO_LOW_COUNT \
--resubmission-timeout=$RESUBMISSION_TIMEOUT \
--rpc.addr=0.0.0.0 \
--rpc.port=$BATCHER_RPC_PORT \
--rpc.enable-admin \
--max-channel-duration=$MAX_CHANNEL_DURATION \
--l1-eth-rpc=$L1_RPC_URL \
--private-key=$BATCHER_PRIVATE_KEY \
--batch-type=1 \
--data-availability-type=blobs \
--log.level=info
```
### Batcher parameters explained
* **`--poll-interval`**: How frequently the batcher checks for new L2 blocks to batch
* **`--sub-safety-margin`**: Number of confirmations to wait before considering L1 transactions safe
* **`--max-channel-duration`**: Maximum time (in L1 blocks) to keep a channel open
* **`--batch-type`**: Type of batch encoding (1 for span batches, 0 for singular batches)
* **`--data-availability-type`**: Whether to use blobs or calldata for data availability
### Starting the batcher
### Start the batcher
```bash theme={null}
# Make the script executable
chmod +x scripts/start-batcher.sh
# Start the batcher
./scripts/start-batcher.sh
```
<Info>
For detailed cost analysis and optimization strategies, refer to the [Transaction fees documentation](/op-stack/transactions/fees).
</Info>
Your batcher is now operational and will continuously submit L2 transaction batches to L1!
</Step>
</Steps>
</Tab>
</Tabs>
<Info>
**Understanding common startup messages**
When starting your batcher, you might see various log messages:
* `Added L2 block to local state`: Normal operation, shows the batcher processing blocks
* `SetMaxDASize RPC method unavailable`: Expected if the execution client version used doesn't support this method.
* `context canceled` errors during shutdown: Normal cleanup messages
* `Failed to query L1 tip`: Can occur during graceful shutdowns
Most of these messages are part of normal operation. For detailed explanations of configuration options and troubleshooting, see the [Batcher configuration reference](/chain-operators/reference/batcher-configuration).
</Info>
## What's Next?
Excellent! Your batcher is publishing transaction data to L1. The next step is to set up the proposer to submit state root proposals.
<Card title="Spin up proposer →" href="./op-proposer-setup">
**Next**: Configure and start op-proposer to submit L2 state roots to L1 for withdrawal verification.
</Card>
***
## Need Help?
* **Batcher Configuration**: [Batcher configuration reference](/chain-operators/reference/batcher-configuration)
* **Monitoring Guide**: [Chain Monitoring](/chain-operators/tools/chain-monitoring)
* **Support**: Open an issue in the [Optimism monorepo](https://github.com/ethereum-optimism/optimism/issues)
# Spin up challenger
Source: https://docs.optimism.io/chain-operators/tutorials/create-l2-rollup/op-challenger-setup
Learn how to configure challenger for your OP Stack chain.
After you have spun up your sequencer, batcher, and proposer, the final step is to configure a challenger to monitor and respond to disputes.
<Info>
**Step 5 of 5**: This tutorial is designed to be followed step-by-step.
Each step builds on the previous one, and this is the last part of the tutorial.
</Info>
<Info>
**Automated Setup Available**
For a complete working setup with all components including automated prestate generation, check out the [automated approach](https://github.com/ethereum-optimism/optimism/tree/develop/docs/public-docs/create-l2-rollup-example/) in the code directory.
</Info>
The challenger is a critical fault proofs component that monitors dispute games and challenges invalid claims to protect your OP Stack chain. See the [op-challenger explainer](/op-stack/fault-proofs/challenger) for a general overview of this fault proofs feature.
The challenger is responsible for:
* Monitoring dispute games created by the fault proof system
* Challenging invalid claims in dispute games
* Defending valid state transitions
* Resolving games when possible
## Prerequisites
### Essential requirements
Complete these prerequisites before wiring up the challenger:
<Steps>
<Step title="Deploy OP Stack chain with fault proofs enabled">
<Accordion title="Generate absolute prestate (Required)">
The challenger needs the absolute prestate to participate in dispute games. The prestate is the on-chain commitment to a specific build of `kona-client`, the maintained fault proof program. (`op-program`, which previously filled this role, has reached end-of-support; see [End of Support for op-geth and op-program](/notices/archive/op-geth-deprecation).) Here's how to generate it:
1. **Clone and checkout the correct version**:
```bash theme={null}
git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
git checkout kona-node/v1.6.1 # Use the latest release
```
2. **Stage your chain configuration**:
Because your chain is not in the public Superchain Registry, the prestate build must embed your chain's configuration. Create the two staging files (`chainList.json` and `configs.json`) from your `rollup.json`, L2 genesis, and `op-deployer` state by following [Generating a custom kona-client absolute prestate](/chain-operators/tutorials/kona-custom-prestate), then point the build at them:
```bash theme={null}
# Assuming you're in rollup/challenger/optimism directory
export KONA_CUSTOM_CONFIGS_DIR="$PWD/rust/kona/crates/protocol/registry/etc/custom-configs/<YOUR-CHAIN-NAME>"
```
3. **Generate the prestate**:
```bash theme={null}
just reproducible-prestate-kona
jq -r .pre rust/kona/prestate-artifacts-cannon/prestate-proof.json
```
The build runs in Docker and writes artifacts to `rust/kona/prestate-artifacts-cannon/`, including a preimage file named by its hash (`0x<PRESTATE_HASH>.bin.gz`). The hash printed by the `jq` command is your chain's absolute prestate.
4. **Verify your chain is embedded in the prestate**:
```bash theme={null}
gunzip -c rust/kona/prestate-artifacts-cannon/prestate.bin.gz | strings | grep "<YOUR-CHAIN-NAME>"
```
Zero matches means the custom configuration was not merged (the build silently produces the standard prestate instead); see the [custom prestate tutorial](/chain-operators/tutorials/kona-custom-prestate) for troubleshooting.
<Info>
* Keep the `0x<PRESTATE_HASH>.bin.gz` file accessible - you'll need it for the challenger setup
* For Superchain registry chains, you can find official `cannon64-kona` prestates in the [registry](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-prestates.toml)
</Info>
</Accordion>
</Step>
<Step title="Set up required infrastructure access">
Your sequencer stack from the previous steps already provides the L2 endpoints the challenger needs (op-reth and op-node). In addition, the challenger needs:
* An L1 RPC endpoint for your settlement layer (Sepolia in this tutorial)
* An L1 beacon API endpoint, used to fetch blobs
</Step>
<Step title="Prepare configuration files">
* `0x<PRESTATE_HASH>.bin.gz` - The absolute prestate preimage file generated in step 1
* `rollup.json` - Rollup configuration file from the `op-deployer` guide
</Step>
</Steps>
## Software installation
For challenger deployment, we recommend using Docker as it provides a consistent and isolated environment. Building from source is also available for more advanced users.
<Tabs>
<Tab title="Use docker">
### Docker Setup
The Docker setup provides a containerized environment for running the challenger. This method uses the official Docker image that includes the embedded `kona` server and Cannon executable.
<Steps>
<Step title="Create challenger directory">
```bash theme={null}
# Create your challenger directory inside rollup
cd ../ # Go back to rollup directory if you're in proposer
mkdir challenger
cd challenger
```
</Step>
<Step title="Create environment file">
<Info>
**OP Stack Standard Variables**
The challenger uses OP Stack standard environment variables following the OP Stack conventions. These are prefixed with `OP_CHALLENGER_` for challenger-specific settings.
</Info>
```bash theme={null}
# Create .env file with your actual values
cat > .env << 'EOF'
# Core configuration (required)
OP_CHALLENGER_L1_RPC_URL=https://sepolia.infura.io/v3/YOUR_ACTUAL_INFURA_KEY
OP_CHALLENGER_L1_BEACON_URL=https://ethereum-sepolia-beacon-api.publicnode.com
OP_CHALLENGER_PRIVATE_KEY=YOUR_ACTUAL_PRIVATE_KEY
# L2 Configuration - Replace with your actual node endpoints
OP_CHALLENGER_L2_ETH_RPC=http://op-reth:8545
OP_CHALLENGER_ROLLUP_RPC=http://op-node:8547
# OP Stack challenger configuration (optional - defaults provided)
OP_CHALLENGER_GAME_FACTORY_ADDRESS=YOUR_GAME_FACTORY_ADDRESS
OP_CHALLENGER_CANNON_KONA_L2_GENESIS=/workspace/genesis.json
OP_CHALLENGER_CANNON_KONA_ROLLUP_CONFIG=/workspace/rollup.json
# Prestate configuration - Replace with the file from 'just reproducible-prestate-kona'
OP_CHALLENGER_CANNON_KONA_PRESTATE=/workspace/${PRESTATE_HASH}.bin.gz
EOF
```
**Important:** Replace every `YOUR_ACTUAL_*` placeholder with the real values from your deployment.
</Step>
<Step title="Set up Docker Compose">
Define the challenger service in a `docker-compose.yml`. It mounts several important files:
* `${PRESTATE_HASH}.bin.gz`: The absolute prestate required for dispute games, replace `PRESTATE_HASH` with the actual hash (the `.pre` field of `prestate-proof.json`, written by `just reproducible-prestate-kona`)
```yaml theme={null}
services:
challenger:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-challenger:v1.9.4
user: "1000"
volumes:
- ./challenger-data:/data
- ./rollup.json:/workspace/rollup.json:ro
- ./genesis-l2.json:/workspace/genesis-l2.json:ro
- ./${PRESTATE_HASH}.bin.gz:/workspace/${PRESTATE_HASH}.bin.gz:ro
command: >
op-challenger run-trace
--trace-type=cannon-kona
--datadir=/data
--log.level=info
--log.format=json
restart: unless-stopped
networks:
- sequencer-node_default
networks:
sequencer-node_default:
external: false
```
</Step>
<Step title="Launch the challenger">
Start the challenger service and follow its logs:
```bash theme={null}
# Start the challenger service
docker-compose up -d
# View logs
docker-compose logs -f challenger
```
</Step>
</Steps>
</Tab>
<Tab title="Build from source">
The generic build-from-source walkthrough lives in the "Build from source" tab of the
[challenger configuration guide](/chain-operators/guides/configuration/op-challenger-config-guide#software-installation):
it covers picking the release, building `op-challenger`, Cannon, and `kona-host`,
verifying the binaries, the environment file, and the startup script. Follow it end
to end, then adapt it to this tutorial series as follows:
* **Workspace**: create the working directory as `rollup/challenger`, next to the
`deployer`, `sequencer`, `batcher`, and `proposer` directories from the previous
steps. With the monorepo checkout at `rollup/optimism`, the binaries are then
reachable from the startup script as `../../optimism/op-challenger/bin/op-challenger`
and `CANNON_BIN=../../optimism/cannon/bin/cannon`.
* **kona-host**: build it in the checkout you generated the prestate from in the
prerequisites (`kona-node/v1.6.1`), so the server matches your chain's absolute
prestate, and point `CANNON_KONA_SERVER` at the resulting binary.
* **Configuration files**: copy `rollup.json` and `genesis-l2.json` from the
op-deployer step into `rollup/challenger`, set `CANNON_ROLLUP_CONFIG=./rollup.json`
and `CANNON_L2_GENESIS=./genesis-l2.json` (the guide's startup script passes these
to `--cannon-kona-rollup-config` and `--cannon-kona-l2-genesis`), and set
`CANNON_KONA_PRESTATE=./0x<PRESTATE_HASH>.bin.gz`, the preimage file generated
in the prerequisites.
* **Trace type and wallet**: this chain is not in the superchain-registry, so keep
`GAME_FACTORY_ADDRESS` explicit, use `--trace-type cannon-kona`, and sign with the
funded private key you used for the other components (`--private-key` instead of
the guide's mnemonic example).
</Tab>
</Tabs>
### Monitoring with op-dispute-mon
Consider running [`op-dispute-mon`](/chain-operators/tools/chain-monitoring#dispute-mon) for enhanced security monitoring:
* Provides visibility into all game statuses for the last 28 days
* Essential for production challenger deployments
## Congratulations
You've successfully completed the entire L2 rollup testnet tutorial! Your rollup is now fully operational with all components running:
* **op-deployer** - L1 contracts deployed
* **Sequencer** - Processing transactions
* **Batcher** - Publishing data to L1
* **Proposer** - Submitting state roots
* **Challenger** - Monitoring disputes
## Connect your wallet to your chain
You now have a fully functioning OP Stack Rollup with a Sequencer node running on `http://localhost:8545`. You can connect your wallet to this chain the same way you'd connect your wallet to any other EVM chain.
## Get ETH on your chain
Once you've connected your wallet, you'll probably notice that you don't have any ETH to pay for gas on your chain.
The easiest way to deposit Sepolia ETH into your chain is to send ETH directly to the `L1StandardBridge` contract.
### Get the L1StandardBridge address
The `L1StandardBridge` proxy address can be found in your deployment state file. To get it, run:
```bash theme={null}
# From your project root
jq -r .l1StandardBridgeProxyAddress <PATH_TO_YOUR_OP_DEPLOYER_FOLDER>/.deployer/state.json
```
This will output the `L1StandardBridge` proxy address that you should use for deposits. Make sure to use the proxy address, not the implementation address.
### Deposit ETH to your L2
Once you have the `L1StandardBridge` address, send a small amount of Sepolia ETH (0.1 or less) to that address from the wallet you want to use on L2.
This will trigger a deposit that will mint ETH into your wallet on L2.
<Info>
It may take up to 5 minutes for the ETH to appear in your wallet on L2.
This delay is due to the time needed for the deposit transaction to be processed and finalized.
</Info>
## See your rollup in action
You can interact with your Rollup the same way you'd interact with any other EVM chain.
Send some transactions, deploy some contracts, and see what happens!
You now have a working testnet. Here is what the distance to production looks like:
<Info>
**Running this in production**
<OpEnterpriseCalloutBody />
</Info>
## Need Help?
* **OP Challenger Explainer**: [Fault Proofs Overview](/op-stack/fault-proofs/challenger)
* **Technical Specs**: [Honest Challenger Specification](https://specs.optimism.io/fault-proof/stage-one/honest-challenger-fdg.html)
# Deploy L1 contracts with op-deployer
Source: https://docs.optimism.io/chain-operators/tutorials/create-l2-rollup/op-deployer-setup
Install op-deployer, prepare your environment, and deploy the L1 smart contracts for your rollup.
Welcome to the first step of creating your own L2 rollup testnet! In this section, you'll install the op-deployer tool and deploy the necessary L1 smart contracts for your rollup.
<Info>
**Step 1 of 5**: This tutorial is designed to be followed step-by-step. Each step builds on the previous one.
</Info>
<Info>
**Quick Setup Available**
For a complete automated setup that includes op-deployer deployment, check out the [`code/`](https://github프로젝트로 돌아가기