Optimism 백서

Optimism

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 30쪽

ent on L2. The transaction completes in a single step. * **L1 withdrawal (`withdrawalNetwork = 0`)**: An L2-to-L1 withdrawal is initiated via the `L2ToL1MessagePasser`. After calling `withdraw()`, you must still: 1. Wait for the withdrawal to be included in an L2 output root 2. Prove the withdrawal on L1 3. Wait for the finalization period 4. Finalize the withdrawal on L1 For details on completing L1 withdrawals, see [Withdrawal flow](/op-stack/bridging/withdrawal-flow). ## Initial configuration during deployment Fee vault recipients, minimum withdrawal amounts, and withdrawal networks are configured during chain deployment with `op-deployer`. For details on setting these parameters, see the [op-deployer setup guide](/chain-operators/tutorials/create-l2-rollup/op-deployer-setup). ## Monitoring It's good practice to monitor your fee vaults regularly: * **Vault balances**: Track balances to know when withdrawals can be triggered. * **`totalProcessed`**: Monitor cumulative withdrawals over time to understand revenue trends. ## Next steps * Read the [fee vaults explainer](/op-stack/transactions/fee-vaults) to understand how vaults work at the protocol level. * See [Transaction Fees 101](/chain-operators/guides/management/transaction-fees-101) to learn how to tune fee parameters. * Review [fee components and formulas](/op-stack/transactions/fees) for detailed fee calculations. # Changing gas target/limit Source: https://docs.optimism.io/chain-operators/guides/management/gas-target-limit Learn how to change the gas target and limit on your OP Stack chain. This guide covers how to optimize block processing performance at higher gas limits, test your infrastructure before activation, and safely change the gas target and/or limit on a live chain. This guide assumes your OP Stack chain has the [Holocene features](/notices/archive/holocene-changes) activated. ## Recommended config for best performance Some known ways to improve block processing performance: * **Use NVMe for storage** instead of local SSDs or other persistent disks * **Use full nodes where possible** over archive nodes ## Pre-activation testing To ensure your chain and supporting infrastructure can consistently process blocks up to your gas limit, you should run some performance tests. You'll want to run benchmarks and perform careful analysis of the results to ensure your execution clients can handle the increased gas usage. ## Changing the gas target/limit change How to change the gas target/limit on a live chain. ### Relevant configuration parameters The gas configuration on an OP Stack chain use the same EIP-1559 parameters as Ethereum. Where the **gas target** = **gas limit** / **elasticity**. These values can be found in the `SystemConfig` contract. ### Procedure Holocene introduces the ability to change the EIP-1559 parameters `elasticity` and `denominator` via the `SystemConfig`. This will allow you to set proper values for the `elasticity` and block `gasLimit`. **Example**: to double the *target* while keeping the block *limit* at 30Mgas/block: <Steps> <Step title="Retrieve existing EIP-1559 values"> Retrieve the existing `eip1559Elasticity` and `eip1559Denominator` values: ```solidity theme={null} elasticity = SystemConfig.eip1559Elasticity() // 6 denominator = SystemConfig.eip1559Denominator() // 50 limit = SystemConfig.gasLimit() // 30_000_000 gas, 30Mgas ``` Current target = `30Mgas / 6 = 5Mgas per block` </Step> <Step title="Set new EIP-1559 params"> Use value from previous step as input to set new params and reduce the `elasticity` from `6` to `3`: ```solidity theme={null} SystemConfig.setEIP1559Params(denominator, 3) ``` New target = `30Mgas / 3 = 10Mgas per block` </Step> </Steps> ## Post-activation monitoring What to monitor after executing the gas changes. ### SystemConfig contract values * `SystemConfig.gasLimit()` * `SystemConfig.eip1559Denominator()` * `SystemConfig.eip1559Elasticity()` ### Block explorer For example, on [OP Mainnet](https://optimistic.etherscan.io/blocks): * Any block with `gasUsed > gasTarget` should cause the base fee to increase * Any block with `gasUsed < gasTarget` should cause the base fee to decrease ### Node performance * Verify nodes are processing blocks faster than the block period * Monitor CPU/memory usage and p99 tail latency of block processing # Key management Source: https://docs.optimism.io/chain-operators/guides/management/key-management Understand the key management considerations for a chain's privileged roles: which keys must stay online as hot wallets, which belong in cold wallets, and where HSMs and multisigs fit. This page explains the key management considerations behind the privileged roles on your chain. There are certain [privileged roles](/op-stack/protocol/privileged-roles) that need careful consideration. The privileged roles are categorized as hot wallets or cold wallets. ## Hot wallets The addresses for the `Batcher` and the `Proposer` need to have their private keys online somewhere for a component of the system to work. If these addresses are compromised, the system can be exploited. It is up to the chain operator to make the decision on how they want to manage these keys. One suggestion is to use a Hardware Security Module (HSM) to provide a safer environment for key management. Cloud providers oftentimes provide Key Management Systems (KMS) that can work with your developer operations configurations. This can be used in conjunction with the `eth_signTransaction` RPC method. <Info> You can take a look at the signer client [source code](https://github.com/ethereum-optimism/optimism/blob/develop/op-service/signer/client.go) if you're interested in what's happening under the hood. </Info> ## Cold wallets The addresses for the cold wallets cannot be used without human intervention. These can be set up as multisig contracts, so they can be controlled by groups of community members and avoid a single point of failure. The signers behind a multisig should probably also use a hardware wallet. <Info> Refer to the [privileged roles](/op-stack/protocol/privileged-roles) documentation for more information about these different addresses and their security concerns. </Info> # Network Design Example Source: https://docs.optimism.io/chain-operators/guides/management/network-architecture This document describes an example network configuration for an OP Stack chain deployment. This document describes an example configuration for an OP Stack network deployment, focusing on the network architecture and node configuration required for production usage. <img alt="OP Stack network design example (op-reth)" /> ## Sequencers Sequencers receive transactions from the Tx Ingress Nodes via execution-layer p2p gossip and work with the batcher and proposer to create new blocks. ### Node Configuration * **Sequencer op-reth** can be either full or archive. op-reth runs as an archive node by default; pass `--full` to run a (pruned) full node. Full nodes offer better performance but can't recover from deep L1 reorgs, so run at least one archive sequencer as a backup. * **Sequencer op-node** should have p2p discovery disabled and only be statically peered with other internal nodes (or use [peer-management-service](https://github.com/ethereum-optimism/infra/tree/main/peer-mgmt-service) to define peering network). * The **op-conductor** RPC can act as a leader-aware RPC proxy for op-batcher (proxies the necessary op-reth / op-node RPC methods if the node is the leader). * Sequencers should have local transaction backup (journalling) disabled. ### op-node Configuration ```yaml theme={null} OP_NODE_P2P_NO_DISCOVERY: "true" OP_NODE_P2P_PEER_BANNING: "false" OP_NODE_P2P_STATIC: "<static peer list>" ``` ### op-reth Configuration op-reth is configured via CLI flags rather than `GETH_*` environment variables: ```sh theme={null} # Leave --rollup.disable-tx-pool-gossip unset so transactions are gossiped to the internal network --txpool.disable-transactions-backup # disable local transaction backup/journalling --txpool.lifetime 3600 # 1h, in seconds --txpool.nolocals --netrestrict "10.0.0.0/8" # ex: restrict p2p to internal ips ``` ## Tx Ingress Nodes These nodes receive `eth_sendRawTransaction` calls from the public and then gossip the transactions to the internal execution-layer network. This allows the Sequencer to focus on block creation while these nodes handle transaction ingress. ### Node Configuration * These can be either full or archive nodes. * They participate in the internal tx pool p2p network to forward transactions to sequencers. ### Configuration ```sh theme={null} # Leave --rollup.disable-tx-pool-gossip unset so transactions are gossiped to sequencers --txpool.disable-transactions-backup --txpool.lifetime 3600 # 1h, in seconds --txpool.nolocals --netrestrict "10.0.0.0/8" # ex: restrict p2p to internal ips ``` ## Archive RPC Nodes We recommend setting up some archive nodes for internal RPC usage, primarily used by the challenger, proposer, and security monitoring tools like [monitorism](/chain-operators/tools/chain-monitoring#monitorism). ### Node Configuration * Archive nodes are essential for accessing historical state data. * You can also use these nodes for taking disk snapshots for disaster recovery. ### Configuration op-reth runs as an archive node by default, so no extra flags are required — simply do **not** pass `--full` (which enables pruning; the upstream `--minimal` flag is not supported and op-reth rejects it at startup). op-reth stores state in MDBX plus static files, so the geth-specific `GETH_DB_ENGINE` and `GETH_STATE_SCHEME` options have no equivalent. ```sh theme={null} # op-reth is archive by default; no pruning flags needed. ``` ## Full Nodes These nodes run as full (pruned) nodes. op-reth does not implement geth-style snap sync; it syncs using its own staged-sync pipeline, so the geth `GETH_SYNCMODE`, `GETH_DB_ENGINE`, and `GETH_STATE_SCHEME` options do not apply. ### Configuration ```sh theme={null} --full # run a pruned full node (--minimal is not supported by op-reth) ``` ## P2P Bootnodes (Execution Layer) These bootnodes facilitate peer discovery for public op-reth nodes. ### Node Configuration * The bootnode can be an op-reth instance or the [geth bootnode tool](https://etclabscore.github.io/core-geth/core/alltools/). * You may want to make your Full Nodes serve as your bootnodes as well. ## P2P Bootnodes (Consensus Layer) These are the op-node p2p network bootnodes. We recommend using the [geth bootnode tool](https://etclabscore.github.io/core-geth/core/alltools/) with discovery v5 enabled. ## Public RPC Public RPC design is not listed in the above diagram but can be implemented very similarly to Tx Ingress Nodes, with the following differences: ### Configuration Differences * Public RPC should **not** participate in the internal tx pool p2p network. * While it is possible to run Public RPC from the same nodes that serve Tx Ingress and participate in tx pool gossip, there have been execution-client bugs in the past that leaked tx pool details on read RPCs, so it is a possible risk to consider. * Public RPC [proxyd](https://github.com/ethereum-optimism/infra/tree/main/proxyd) should be run in `consensus_aware` routing mode and whitelist any RPCs you want to serve from op-reth. * Public RPC nodes should likely be archive nodes. ### About proxyd Proxyd is an RPC request router and proxy that provides the following capabilities: 1. Whitelists RPC methods. 2. Routes RPC methods to groups of backend services. 3. Automatically retries failed backend requests. 4. Tracks backend consensus (latest, safe, finalized blocks), peer count and sync state. 5. Re-writes requests and responses to enforce consensus. 6. Load balances requests across backend services. 7. Caches immutable responses from backends. 8. Provides metrics to measure request latency, error rates, and the like. ## Next steps * Learn more about using [proxyd](https://github.com/ethereum-optimism/infra/tree/main/proxyd) for your network. # Rollup operations Source: https://docs.optimism.io/chain-operators/guides/management/operations Learn basics of rollup operations, such as how to start and stop your rollup, get your rollup config, and how to add nodes. This guide reviews the basics of rollup operations, such as how to start your rollup, stop your rollup, get your rollup config, and add nodes. ## Stopping your rollup An orderly shutdown is done in the reverse order to the order in which components were started: <Steps> <Step title="To stop the batcher, use this command:"> ```sh theme={null} curl -d '{"id":0,"jsonrpc":"2.0","method":"admin_stopBatcher","params":[]}' \ -H "Content-Type: application/json" http://localhost:8548 | jq ``` This way the batcher knows to save any data it has cached to L1. Wait until you see `Batch Submitter stopped` in batcher's output before you stop the process. </Step> <Step title="Stop `op-proposer`"> To stop the proposer, terminate the process directly. This can be done by: * Pressing **Ctrl+C** in the terminal running the process * Using system commands like `kill -TERM <pid>` to stop the process gracefully Ensure that the proposer process has terminated completely before proceeding to stop other components. </Step> <Step title="Stop `op-node`"> This component is stateless, so you can just stop the process. </Step> <Step title="Stop `op-reth`"> Use **CTRL-C** (SIGINT) so the execution client shuts down gracefully and flushes its database. Killing the process abruptly can leave the database in an inconsistent state and cause problems on the next start. </Step> </Steps> ## Starting your rollup To restart the blockchain, use the same order of components you did when you initialized it. <Steps> <Step title="Start `op-reth`" /> <Step title="Start `op-node`" /> <Step title="Start `op-batcher`"> If `op-batcher` is still running and you just stopped it using RPC, you can start it with this command: ```sh theme={null} curl -d '{"id":0,"jsonrpc":"2.0","method":"admin_startBatcher","params":[]}' \ -H "Content-Type: application/json" http://localhost:8548 | jq ``` </Step> <Step title="Start `op-proposer`"> Start the proposer using the appropriate command. Here's an example: ```sh theme={null} ./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 ``` | Parameter | Description | | - | - | | poll-interval | How often to check for new output proposals (recommended: 12s) | | rpc.port | Local RPC port for the proposer service | | l2oo-address | The L2 Output Oracle contract address (0x-prefixed hex) | | private-key | Private key for signing proposals | | l1-eth-rpc | L1 network RPC endpoint URL | </Step> </Steps> <Info> Synchronization takes time `op-batcher` might have warning messages similar to: ``` WARN [03-21|14:13:55.248] Error calculating L2 block range err="failed to get sync status: Post \"http://localhost:8547\": context deadline exceeded" WARN [03-21|14:13:57.328] Error calculating L2 block range err="failed to get sync status: Post \"http://localhost:8547\": context deadline exceeded" ``` This means that `op-node` is not yet synchronized up to the present time. Just wait until it is. </Info> ## Getting your rollup config Use this tool to get your rollup config from `op-node`. This will only work if your chain is **already** in the [superchain-registry](https://github.com/ethereum-optimism/superchain-registry/blob/main/chainList.json) and `op-node` has been updated to pull those changes in from the registry. <Info> This script will NOT work for chain operators trying to generate this data in order to submit it to the registry. </Info> <Steps> <Step title="Get your rollup config from `op-node`"> You'll need to run this tool: ``` ./bin/op-node networks dump-rollup-config --network=op-sepolia { "genesis": { "l1": { "hash": "0x48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b", "number": 4071408 }, "l2": { "hash": "0x102de6ffb001480cc9b8b548fd05c34cd4f46ae4aa91759393db90ea0409887d", "number": 0 }, "l2_time": 1691802540, "system_config": { "batcherAddr": "0x8f23bb38f531600e5d8fddaaec41f13fab46e98c", "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", "gasLimit": 30000000 } }, "block_time": 2, "max_sequencer_drift": 600, "seq_window_size": 3600, "channel_timeout": 300, "l1_chain_id": 11155111, "l2_chain_id": 11155420, "regolith_time": 0, "canyon_time": 1699981200, "delta_time": 1703203200, "ecotone_time": 1708534800, "batch_inbox_address": "0xff00000000000000000000000000000011155420", "deposit_contract_address": "0x16fc5058f25648194471939df75cf27a2fdc48bc", "l1_system_config_address": "0x034edd2a225f7f429a63e0f1d2084b9e0a93b538", "da_challenge_address": "0x0000000000000000000000000000000000000000", "da_challenge_window": 0, "da_resolve_window": 0, "use_plasma": false } ``` </Step> <Step title="Check the flags"> Ensure that you are using the appropriate flag. The `--network=op-sepolia` flag allows the tool to pick up the appropriate data from the registry, and uses the OPChains mapping under the hood. </Step> </Steps> ## Adding nodes To add nodes to the rollup, you need to initialize `op-node` and `op-reth`, similar to what you did for the first node. You should *not* add an `op-batcher` because there should be only one. <Steps> <Step title="Configure the OS and prerequisites as you did for the first node" /> <Step title="Install `op-reth` and `op-node` as you did for the first node" /> <Step title="Copy from the first node these files:"> ```bash theme={null} ~/op-reth/genesis.json ~/optimism/op-node/rollup.json ``` </Step> <Step title="Create a new `jwt.txt` file as a shared secret:"> ```bash theme={null} cd ~/op-reth openssl rand -hex 32 > jwt.txt cp jwt.txt ~/optimism/op-node ``` </Step> <Step title="Initialize the new op-reth:"> ```bash theme={null} cd ~/op-reth op-reth init --chain=./genesis.json --datadir=./datadir ``` </Step> <Step title="Turn on peer to peer synchronization to enable L2 nodes to synchronize directly"> If you do it this way, you won't have to wait until the transactions are written to L1. If you already have peer to peer synchronization, add the new node to the `--p2p.static` list so it can synchronize. </Step> <Step title="Start `op-reth` (using the same command line you used on the initial node)"> <Info> **Important:** Make sure to configure the `--rollup.sequencer` flag (alias `--rollup.sequencer-http`) to point to your sequencer node. This endpoint is crucial because `op-reth` will route `eth_sendRawTransaction` calls to this URL. The OP Stack does not currently have a public mempool, so configuring this is required if you want your node to support transaction submission. </Info> </Step> <Step title="Start `op-node` (using the same command line you used on the initial node)" /> </Steps> ## Next steps * See the [Consensus Client Configuration](/node-operators/guides/configuration/consensus-clients) and [Execution Client Configuration](/node-operators/guides/configuration/execution-clients) guides for additional explanation or customization. * If you experience difficulty at any stage of this process, please reach out to [developer support](https://github.com/ethereum-optimism/developers/discussions). # Transaction Fees 101 Source: https://docs.optimism.io/chain-operators/guides/management/transaction-fees-101 How to check and tune the fee parameters on your OP Stack chain, with example scenarios for common situations. T
프로젝트로 돌아가기