Replies: 24 comments 86 replies
-
Explore - Fixing op-geth 'State not available' IssueClick to read moreDescription of the problemop-geth log: op-node log: Cause of the problemSolutionstep-by-step solution for the problem:protolambda's comments Testing the solutionAdditionallyI found the following content in the go-ethereum documentation, perhaps there's an alternative solution; let's consider including it in the plan.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Transactions stuck in mempoolUser transactions get stuck in the mempool due to being underpriced. This issue would affect all OP Stack chains. Cause of the problem
SolutionThis solution is generally aimed at wallet developers
|
Beta Was this translation helpful? Give feedback.
-
A Quick Way to Check if the OP Stack Chain is SynchronizedClick to read moreop-node log:
This indicates that during the synchronization process, you can get a rough idea of the synchronization progress by comparing Two common errors caused by incomplete synchronization:proposer: |
Beta Was this translation helpful? Give feedback.
-
Setting up Optimism Source Code Without Cloning the RepositoryClick to read moreWhen downloading and using the source code of Optimism (Release op-node v1.7.1) without directly pulling from the Optimism repository, you may encounter errors during the build process due to missing submodules.First and foremost, it is recommended to clone the Optimism repository and then switch to the corresponding tag. This approach avoids the issue of missing submodules. After choosing to clone the Optimism repository, the following content can be disregarded To address this issue, you can follow these steps:
|
Beta Was this translation helpful? Give feedback.
-
[Summary] Creating Your Own L2 Rollup Testnet - Temporary Solutions to Some IssuesClick to read more
if this working, go on.
|
Beta Was this translation helpful? Give feedback.
-
[Sharing] One way of adding Replica Nodes to Your Own L2 Rollup TestnetClick to read moreWarning: This article is intended for informational sharing only. It does not represent an ideal scenario, nor does it offer any recommendations, advice, or suggestions that this method should be followed. Assuming you have successfully created your own L2 Rollup Testnet following the documentation, this tutorial will focus on configuring replica nodes to achieve p2p synchronization in a specific manner. Documentation locations: Additional Notes:
Steps1. Remove
|
Beta Was this translation helpful? Give feedback.
-
[Sharing] One way of activating span
|
Beta Was this translation helpful? Give feedback.
-
[Sharing] Configuring Node Monitoring Dashboard with Prometheus and GrafanaClick to read moreThis tutorial serves as an implementation example for the documentation found at Step 1: Configure the Node for Metrics CollectionFirst, configure your node to expose metrics by running the following command:
Step 2: Create a Prometheus Configuration File LocallyNext, create a Prometheus configuration file (
Replace and with your Grafana Cloud username and API token. You can obtain these by registering at Grafana, navigating to My Account > Prometheus > Details. Start Prometheus LocallyRun Prometheus in a Docker container using the configuration file you created:
Step 4: Set Up Grafana Cloud
Example : |
Beta Was this translation helpful? Give feedback.
-
[Sharing] some possible third-party RPC provider for beacon(blob fetching) rpcClick to read moreAre you receiving missing l1.beacon, or do you want to find an option besides self-host and quicknode(which has been written in docs)? we found some RPC providers listed on chainlist, and here's the list
|
Beta Was this translation helpful? Give feedback.
-
[Share] Supporting Fault Proofs - Creating Your Own L2 Rollup Testnet-Part 1Deploying L1 ContractsThe tutorial Creating Your Own L2 Rollup Testnet does not currently provide guidance on enabling fault proof features. Two possible approaches are upgrading the testnet created through the tutorial to support fault proofs or establishing a testnet with built-in fault proof support. This discussion will focus on the latter. Relevant Resources:Note: This is a personal knowledge sharing. If you find any issues, please add a comment. Steps:
Troubleshooting:If you encounter a bytes memory initData = abi.encodeCall(
Safe.setup, (_owners, _threshold, address(0), hex"", address(0), address(0), 0, payable(address(0)))
);
addr_ = address(
safeProxyFactory.createProxyWithNonce(
address(safeSingleton), initData, uint256(keccak256(abi.encode(_name)))
)
); Follow-up content:Part 2 Part 3 |
Beta Was this translation helpful? Give feedback.
-
[Share] Supporting Fault Proofs - Creating Your Own L2 Rollup Testnet-Part 2Generate the L2 Config FilesHere, I will demonstrate how to generate the L2 configuration files using version 1.7.7 components.
Preceding content: Part 1Follow-up content:part 3 |
Beta Was this translation helpful? Give feedback.
-
[Share] Supporting Fault Proofs - Creating Your Own L2 Rollup Testnet-Part 3Start OP Stack chain testnetAfter completing Part 2, you can start
Preceding content: Part 1 Part 2Follow-up content:Additional: I would like to thank @joohhnnn for his help in debugging. |
Beta Was this translation helpful? Give feedback.
-
[Share] Blockscout with Your Own L2 Rollup TestnetClick to read moreWe'll discuss some related content from the Deploying a Block Explorer section of the documentation. My insights are based on the issues I encountered and resolved while using Blockscout. I haven't deeply investigated Blockscout, so if you find any errors, please feel free to add comments. Part 1: Modify
|
Beta Was this translation helpful? Give feedback.
-
[Share] Supporting Fault Proofs - Creating Your Own L2 Rollup Testnet-Part 4Withdrawal ProcessHere discusses the withdrawal process using the Related Documentation Resources:Step 1: Using the Optimism SDKFirst, let's set up a project and install the necessary dependencies: mkdir op-sdk-sample-project
cd op-sdk-sample-project
pnpm init
pnpm add @eth-optimism/sdk
pnpm add ethers@^5
node Next, let's set up our providers using the Optimism SDK and Ethers.js: const optimism = require("@eth-optimism/sdk")
const ethers = require("ethers")
const l1Provider = new ethers.providers.StaticJsonRpcProvider("https://rpc.ankr.com/eth_sepolia")
const l2Provider = new ethers.providers.StaticJsonRpcProvider("<Your own chain rpc>") Note:If you created an L2 testnet following the previous steps, then Find Contract Addresses does not apply. You can find contract addresses in const AddressManager = '0xA...'
const L1CrossDomainMessenger = '0x0...'
const L1StandardBridge = '0x0...'
const OptimismPortal = '0xe...'
const OptimismPortal2 ='0xe...'
const DisputeGameFactory = '0x4...'
const L2OutputOracle ='0x6...' Get the chain IDs for L1 and L2: const l1ChainId = await l1Provider.getNetwork().then(network => network.chainId)
const l2ChainId = await l2Provider.getNetwork().then(network => network.chainId)
const privateKey = "0xc..."
const l1Wallet = new ethers.Wallet(privateKey, l1Provider)
const l2Wallet = new ethers.Wallet(privateKey, l2Provider)
const messenger = new optimism.CrossChainMessenger({
l1ChainId: l1ChainId,
l2ChainId: l2ChainId,
l1SignerOrProvider: l1Wallet,
l2SignerOrProvider: l2Wallet,
// This is the only part that differs from natively included chains.
contracts: {
l1: {
AddressManager,
L1CrossDomainMessenger,
L1StandardBridge,
OptimismPortal2,
OptimismPortal,
DisputeGameFactory,
L2OutputOracle,
// Need to be set to zero for this version of the SDK.
StateCommitmentChain: ethers.constants.AddressZero,
CanonicalTransactionChain: ethers.constants.AddressZero,
BondManager: ethers.constants.AddressZero,
}
}
}) Now, start your withdrawal on L2: const withdrawal = await messenger.withdrawETH(ethers.utils.parseEther('0.004269'))
await withdrawal.wait() Wait until the withdrawal is ready to prove: await messenger.waitForMessageStatus(withdrawal.hash, optimism.MessageStatus.READY_TO_PROVE) Prove the withdrawal on L1: await messenger.proveMessage(withdrawal.hash) If successful, the withdrawal will enter the challenge period. In previous chapters, I set the challenge period to 7 days using faultGameWithdrawalDelay. Step 2: Resolving the Specified Dispute GameL2 Withdrawal Hash: 0xd68f93cdebcc04f9b4748090878494feeca5e4d56b68f87bf1422ad23a1859e9 Obtain the Withdrawal Hash from the Prove Transaction Log Example Prove Transaction Hash: 0xa78be8b5d8beff0f3841f7e1872ea84bbde4ff931f80671518816e9e8253a40b Retrieve the
Check and Resolve the Dispute Game Status
Step 3: Return to the Optimism SDK
Preceding content: Part 1 Part 2 Part 3Follow-up content: |
Beta Was this translation helpful? Give feedback.
-
[Share] Supporting Fault Proofs - Creating Your Own L2 Rollup Testnet-Part 5Configure op-challengerIn this section, we discuss how to launch the Related Documentation Resources:Steps:1. Switch to the Specified BranchIn Part 1, we referred to the configuration of "faultGameAbsolutePrestate": "0x037ef3c1a487960b0e633d3e513df020c43432769f41a634d18a9595cbf53c55" Switch to the appropriate branch: git checkout op-program/v1.0.0 2. Build the ComponentsNavigate to the cd optimism
make op-challenger op-program cannon op-dispute-mon 3. Generate the Required
|
Beta Was this translation helpful? Give feedback.
-
[Share] L3-Setting Up an L3 on op-sepolia Networkclick to read moreHere I created an L3 on Related Resources
Steps
"Many configuration values are in terms of L1 blocks. You might need to multiply them by 6, though a base config for reference is not available." -- soyboy
"What's your l1.http-poll-interval value? The default is 12, so if you change it to 2 (assuming 2 second block time for the target chain), the warning should go away” -- arshsingh
Increase the value for
Additional“The OP Stack isn't tuned for L3 support at the moment, so it's kind of a hack.” -- soyboy curl --request POST \
--url <your L3 rpc> \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": [
"finalized",
false
]
}' Glossary |
Beta Was this translation helpful? Give feedback.
-
[Share] Setting Up a Custom Gas Token Chainclick to read moreIn this post, I will share my experience of setting up a Related Resources:
Steps:The steps follow the
address _to, // your address
uint256 _mint, // for example, 500000000000000000000
uint256 _value, // for example, 500000000000000000000
uint64 _gasLimit, // for example, 100000
bool _isCreation, // false
bytes memory _data // 0x |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
[Share] An Attempt to Bridge Standard ERC-20 Tokens Using Viemclick to read moreThe References:
Notes:
The main goal here is to share relevant information. The attempt with Viem is purely for discussion and exploration; it may contain errors and should not be taken as a recommended approach. If you have any suggestions, feel free to leave a comment. require("dotenv").config();
const {
createPublicClient,
http,
createWalletClient,
formatEther,
} = require("viem");
const { sepolia, optimismSepolia } = require("viem/chains");
const { privateKeyToAccount } = require("viem/accounts");
const {
publicActionsL1,
publicActionsL2,
walletActionsL1,
walletActionsL2,
getWithdrawals
} = require("viem/op-stack");
const l1Token = "0x5589BB8228C07c4e15558875fAf2B859f678d129";
const l2Token = "0xD08a2917653d4E460893203471f0000826fb4034";
const oneToken = 1000000000000000000n
const l1Bridge = optimismSepolia.contracts.l1StandardBridge[11155111].address
const l2Bridge = optimismSepolia.contracts.l2StandardBridge.address
const PRIVATE_KEY = process.env.TUTORIAL_PRIVATE_KEY;
const account = privateKeyToAccount(PRIVATE_KEY);
const publicClientL1 = createPublicClient({
chain: sepolia,
transport: http("https://rpc.ankr.com/eth_sepolia"),
}).extend(publicActionsL1());
const walletClientL1 = createWalletClient({
account,
chain: sepolia,
transport: http("https://rpc.ankr.com/eth_sepolia"),
}).extend(walletActionsL1());
const publicClientL2 = createPublicClient({
chain: optimismSepolia,
transport: http("https://sepolia.optimism.io"),
}).extend(publicActionsL2());
const walletClientL2 = createWalletClient({
account,
chain: optimismSepolia,
transport: http("https://sepolia.optimism.io"),
}).extend(walletActionsL2());
const erc20ABI = [
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "balanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "faucet",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "spender",
type: "address"
},
{
internalType: "uint256",
name: "value",
type: "uint256"
}
],
name: "approve",
outputs: [
{
internalType: "bool",
name: "",
type: "bool"
}
],
stateMutability: "nonpayable",
type: "function"
},
];
// faucet
const tx = await walletClientL1.writeContract({
address: l1Token,
abi: erc20ABI,
functionName: 'faucet',
account,
})
const l1Balance = await publicClientL1.readContract({
address: l1Token,
abi: erc20ABI,
functionName: 'balanceOf',
args: [account.address]
});
console.log(`L1 Balance: ${formatEther(l1Balance)}`);
//approve:
const approveTx = await walletClientL1.writeContract({
address: l1Token,
abi: erc20ABI,
functionName: 'approve',
args: [l1Bridge, oneToken],
})
//deposit
const l1BridgeABI = [{
inputs: [
{
internalType: "address",
name: "_l1Token",
type: "address"
},
{
internalType: "address",
name: "_l2Token",
type: "address"
},
{
internalType: "uint256",
name: "_amount",
type: "uint256"
},
{
internalType: "uint32",
name: "_minGasLimit",
type: "uint32"
},
{
internalType: "bytes",
name: "_extraData",
type: "bytes"
}
],
name: "depositERC20",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}]
const depositTx = await walletClientL1.writeContract({
address: l1Bridge,
abi: l1BridgeABI,
functionName: 'depositERC20',
args: [l1Token, l2Token, oneToken, 200_000, '0x']
})
console.log(`Deposit Hash: ${depositTx}`)
//withdraw:
const l2Balance = await publicClientL2.readContract({
address: l2Token,
abi: erc20ABI,
functionName: 'balanceOf',
args: [account.address]
});
console.log(`L2 Balance: ${formatEther(l2Balance)}`);
const l2BridgeABI = [
{
inputs: [
{
internalType: "address",
name: "_l2Token",
type: "address"
},
{
internalType: "uint256",
name: "_amount",
type: "uint256"
},
{
internalType: "uint32",
name: "_minGasLimit",
type: "uint32"
},
{
internalType: "bytes",
name: "_extraData",
type: "bytes"
}
],
name: "withdraw",
outputs: [],
stateMutability: "payable",
type: "function"
}
]
const withdrawalTx = await walletClientL2.writeContract({
address: l2Bridge,
abi: l2BridgeABI,
functionName: 'withdraw',
args: [l2Token, oneToken, 0, '0x']
})
console.log(`Withdrawal Hash: ${withdrawalTx}`)
const receipt = await publicClientL2.getTransactionReceipt({
hash: withdrawalTx
})
const { output } = await publicClientL1.waitToProve({
receipt,
targetChain: publicClientL2.chain,
})
const [withdrawal] = getWithdrawals(receipt)
const proveArgs = await publicClientL2.buildProveWithdrawal({
output,
withdrawal,
}); |
Beta Was this translation helpful? Give feedback.
-
[Share] Create an op stack Rollup testnet with
|
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Based on the latest version of the OP Stack components, I have successfully deployed a local test chain. I am now sharing the complete deployment steps with everyone, hoping that you can avoid some of the pitfalls I encountered. As I am Chinese, many of the comments are written in Chinese. I hope you will understand. I also hope this document will be helpful to everyone. 概述本指南将帮助您在 Ubuntu 22.04 系统上部署一个 OP Stack L2 测试链。整个过程遵循 Optimism 官方文档,使用 click to read more第一步:系统准备1.1 更新系统sudo apt update && sudo apt upgrade -y 1.2 安装基础依赖# 安装基础工具
sudo apt install -y curl git build-essential
# 安装 Go 1.24.0
curl -OL https://go.dev/dl/go1.24.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz
rm go1.24.0.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# 安装 Node.js 20.x
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# 安装 foundry
curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup
# 安装 jq 1.6+
sudo apt install -y jq
# 安装 direnv 2+
sudo apt install -y direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
source ~/.bashrc
# 安装 just
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 1.3 验证安装# 检查各个工具是否正确安装
git --version # 应该显示 2.x.x 或更高
go version # 应该显示 go version go1.24.0 linux/amd64
node --version # 应该显示 v20.x.x
forge --version # 应该显示 0.2.0 或更高
make --version # 应该显示 GNU Make 3.x 或更高
jq --version # 应该显示 jq-1.6 或更高
direnv --version # 应该显示 2.x.x 或更高
just --version # 应该显示 just-1.34.0 或更高 第二步:获取 Sepolia 测试网资源2.1 获取 Sepolia RPC URL从以下服务之一获取 Sepolia RPC URL: 2.2 获取测试 ETH在 Superchain Faucet 获取 Sepolia 测试 ETH。 第三步:构建 OP Stack 组件3.1 构建 op-geth# 克隆 op-geth 仓库
cd ~
git clone https://github.com/ethereum-optimism/op-geth.git
cd op-geth
# 构建 op-geth
export PATH=/usr/local/go/bin:$PATH
source ~/.bashrc
make geth 3.2 构建 Optimism monorepo# 克隆 Optimism monorepo
cd ~
git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
# 检查依赖
./packages/contracts-bedrock/scripts/getting-started/versions.sh
# 构建核心组件
cd ~/optimism
git checkout op-node/v1.13.4
cd op-node
just
./bin/op-node --version
cd ~/optimism
git checkout op-batcher/v1.14.0
cd op-batcher
just
./bin/op-batcher --version
cd ~/optimism
git checkout op-proposer/v1.10.0
cd op-proposer
just
./bin/op-proposer --version
cd ~/optimism
git checkout op-challenger/v1.5.1
cd op-challenger
just
./bin/op-challenger --version 第四步:配置环境变量4.1 生成账户cd ~/optimism
./packages/contracts-bedrock/scripts/getting-started/wallets.sh 此命令会生成五个地址及其私钥:
4.2 编辑环境变量文件nano .envrc 填写以下变量:
保存文件(Ctrl+X, Y, Enter) 4.3 加载环境变量direnv allow 验证环境变量加载: echo "=== 环境变量检查 ==="
echo "GS_ADMIN_ADDRESS: $GS_ADMIN_ADDRESS"
echo "GS_BATCHER_ADDRESS: $GS_BATCHER_ADDRESS"
echo "GS_PROPOSER_ADDRESS: $GS_PROPOSER_ADDRESS"
echo "GS_SEQUENCER_ADDRESS: $GS_SEQUENCER_ADDRESS"
echo "GS_CHALLENGER_ADDRESS: $GS_CHALLENGER_ADDRESS"
echo "L1_RPC_KIND: $L1_RPC_KIND"
echo "L1_RPC_URL: $L1_RPC_URL"
echo "L1_BEACON_URL: $L1_BEACON_URL"
echo "L1_CHAIN_ID: $L1_CHAIN_ID"
echo "L2_CHAIN_ID: $L2_CHAIN_ID"
echo "L1_BLOCK_TIME: $L1_BLOCK_TIME"
echo "L2_BLOCK_TIME: $L2_BLOCK_TIME"
# 如果变量为空,说明没有正确加载
if [ -z "$L1_RPC_URL" ]; then
echo "警告:环境变量未正确加载,请检查 .envrc 文件"
fi 4.4 为账户充值您需要为以下地址充值 Sepolia ETH:
第五步:使用 op-deployer 部署 L1 合约5.1 获取 op-deployercd ~/optimism
git checkout op-deployer/v0.3.3
cd op-deployer
just
./bin/op-deployer --version
# 添加到PATH
echo 'export PATH=$PATH:~/optimism/op-deployer/bin' >> ~/.bashrc
source ~/.bashrc
# 验证安装
op-deployer --version 5.2 初始化 op-deployer 配置# 创建工作目录
mkdir -p ~/.deployer
# 初始化配置
op-deployer init \
--l1-chain-id $L1_CHAIN_ID \
--l2-chain-ids $L2_CHAIN_ID \
--workdir ~/.deployer 5.3 修改 intent.toml 配置nano ~/.deployer/intent.toml 确保配置中包含以下内容并替换相应的地址: deploymentStrategy = "live" # 部署策略:"live"用于实际部署,"genesis"用于生成创世文件
configType = "custom"
l1ChainID = 11155111 # Sepolia测试网的链ID
fundDevAccounts = true # 是否为开发账户提供资金
useInterop = false
l1ContractsLocator = "tag://op-contracts/v3.0.0" # L1合约版本位置
l2ContractsLocator = "tag://op-contracts/v3.0.0" # L2合约版本位置
[[chains]]
id = "0x00000000000000000000000000000000000000000000000000000000000a455" # 链ID: 42069的十六进制表示
baseFeeVaultRecipient = "YOUR_ADMIN_ADDRESS" # 基础费用接收地址(替换为您的Admin地址)
l1FeeVaultRecipient = "YOUR_ADMIN_ADDRESS" # L1费用接收地址(替换为您的Admin地址)
sequencerFeeVaultRecipient = "YOUR_ADMIN_ADDRESS" # 排序器费用接收地址(替换为您的Admin地址)
[chains.roles] # 各种角色地址
l1ProxyAdminOwner = "YOUR_ADMIN_ADDRESS" # L1代理合约管理员(负责升级L1合约)
l2ProxyAdminOwner = "YOUR_ADMIN_ADDRESS" # L2代理合约管理员(负责升级L2合约)
systemConfigOwner = "YOUR_ADMIN_ADDRESS" # 系统配置拥有者(负责更新系统配置)
unsafeBlockSigner = "YOUR_SEQUENCER_ADDRESS" # 区块签名者(Sequencer签名块)
batcher = "YOUR_BATCHER_ADDRESS" # 批处理者(负责将交易数据发布到L1)
proposer = "YOUR_PROPOSER_ADDRESS" # 提议者(负责发布L2状态根到L1)
challenger = "YOUR_CHALLENGER_ADDRESS" # 挑战者(负责质疑无效状态转换) 5.4 部署 L1 合约# 加载环境变量
cd ~/optimism
direnv allow
# 确保环境变量已正确加载
if [ -z "$L1_RPC_URL" ] || [ -z "$GS_ADMIN_PRIVATE_KEY" ]; then
echo "错误: 环境变量未设置,请确保运行了 'direnv allow'"
echo "检查: L1_RPC_URL 和 GS_ADMIN_PRIVATE_KEY 是否已设置"
fi
# 执行部署 - 此步骤将消耗 Sepolia ETH
cast gas-price --rpc-url $L1_RPC_URL
op-deployer apply \
--workdir ~/.deployer \
--l1-rpc-url $L1_RPC_URL \
--private-key $GS_ADMIN_PRIVATE_KEY 5.5 生成 L2 配置文件# 生成 genesis.json
op-deployer inspect genesis --workdir ~/.deployer $L2_CHAIN_ID > ~/.deployer/genesis.json
# 生成 rollup.json
op-deployer inspect rollup --workdir ~/.deployer $L2_CHAIN_ID > ~/.deployer/rollup.json 5.6 复制配置文件# 为 op-geth 准备目录
cp ~/.deployer/genesis.json ~/op-geth/
cp ~/.deployer/rollup.json ~/optimism/op-node/ 第六步:初始化 L2 链6.1 创建 JWT 密钥cd ~/op-geth
openssl rand -hex 32 > jwt.txt
cp jwt.txt ~/optimism/op-node/ 6.2 初始化 op-gethcd ~/op-geth
mkdir -p datadir
./build/bin/geth init --state.scheme=hash --datadir=datadir genesis.json 第七步:启动 L2 链7.1 创建启动脚本mkdir -p ~/scripts
# 创建 op-geth 启动脚本
cat > ~/scripts/start-op-geth.sh << 'EOF'
#!/bin/bash
cd ~/op-geth
L2_CHAIN_ID=42069
./build/bin/geth \
--datadir ./datadir \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.api=web3,debug,eth,txpool,net,engine,miner \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine,miner \
--syncmode=full \
--gcmode=archive \
--nodiscover \
--maxpeers=0 \
--networkid=$L2_CHAIN_ID \
--authrpc.vhosts="*" \
--authrpc.addr=0.0.0.0 \
--authrpc.port=8551 \
--authrpc.jwtsecret=./jwt.txt \
--rollup.disabletxpoolgossip=true
EOF
# 创建 op-node 启动脚本
cat > ~/scripts/start-op-node.sh << 'EOF'
#!/bin/bash
cd ~/optimism
source .envrc
cd op-node
./bin/op-node \
--l2=http://localhost:8551 \
--l2.jwt-secret=./jwt.txt \
--sequencer.enabled \
--sequencer.l1-confs=5 \
--verifier.l1-confs=4 \
--rollup.config=./rollup.json \
--rpc.addr=0.0.0.0 \
--p2p.disable \
--rpc.enable-admin \
--p2p.sequencer.key=$GS_SEQUENCER_PRIVATE_KEY \
--l1=$L1_RPC_URL \
--l1.rpckind=$L1_RPC_KIND \
--l1.http-poll-interval=2s \
--l1.beacon=$L1_BEACON_URL
EOF
# 创建 op-batcher 启动脚本
cat > ~/scripts/start-op-batcher.sh << 'EOF'
#!/bin/bash
cd ~/optimism
source .envrc
cd op-batcher
./bin/op-batcher \
--l2-eth-rpc=http://localhost:8545 \
--rollup-rpc=http://localhost:9545 \
--poll-interval=1s \
--sub-safety-margin=6 \
--num-confirmations=1 \
--safe-abort-nonce-too-low-count=3 \
--resubmission-timeout=30s \
--rpc.addr=0.0.0.0 \
--rpc.port=8548 \
--rpc.enable-admin \
--max-channel-duration=25 \
--l1-eth-rpc=$L1_RPC_URL \
--private-key=$GS_BATCHER_PRIVATE_KEY
EOF
# 创建 op-proposer 启动脚本
cat > ~/scripts/start-op-proposer.sh << 'EOF'
#!/bin/bash
cd ~/optimism
source .envrc
cd op-proposer
export OP_PROPOSER_WAIT_NODE_SYNC=true
export OP_PROPOSER_GAME_FACTORY_ADDRESS=$(cat ~/.deployer/state.json | jq -r '.opChainDeployments[0].disputeGameFactoryProxyAddress')
export OP_PROPOSER_PROPOSAL_INTERVAL=15m
export OP_PROPOSER_GAME_TYPE=1
./bin/op-proposer \
--poll-interval=12s \
--rpc.port=8560 \
--rollup-rpc=http://localhost:9545 \
--private-key=$GS_PROPOSER_PRIVATE_KEY \
--l1-eth-rpc=$L1_RPC_URL
EOF 7.2 设置脚本权限chmod +x ~/scripts/*.sh 7.3 启动各个组件# 终端 1: 启动 op-geth
./scripts/start-op-geth.sh
# 终端 2: 启动 op-node
./scripts/start-op-node.sh
# 终端 3: 启动 op-batcher
./scripts/start-op-batcher.sh
# 终端 4: 启动 op-proposer
./scripts/start-op-proposer.sh 第八步:验证部署8.1 检查 L2 链状态curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545 8.2 连接钱包到链在 MetaMask 中添加自定义网络:
第九步:获取 L2 ETH9.1 获取 L1StandardBridge 地址L1_BRIDGE=$(cat ~/.deployer/state.json | jq -r '.opChainDeployments[0].l1StandardBridgeProxyAddress')
echo "L1StandardBridge 地址: $L1_BRIDGE" 9.2 发送 ETH 到 L1StandardBridge使用您想在 L2 拥有 ETH 的钱包,向 L1StandardBridge 地址发送少量 Sepolia ETH(0.1 或更少)。这将触发一个存款交易,在您的 L2 钱包中铸造 ETH。大约需要 5 分钟才能在 L2 上看到 ETH。 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
This thread is a place to share helpful debugging and problem solving resources. When these resources are polished, we can migrate them into the documentation website.
Guidelines
A troubleshooting post should be limited to identifying a common problem for one particular product or service. To maintain consistency, please use the following structure:
[insert: Common Problem Title]
[insert: description of the problem]
Cause of the problem
[insert: describe the cause of the problem and symptom of the problem (system response, logs, screenshots etc.]
Solution
[insert: step-by-step solution for the problem]
Beta Was this translation helpful? Give feedback.
All reactions