Optimism 백서

Optimism

원문

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

``` ### `opp2p_discoveryTable` Returns the discovery table entries as a list of ENR strings. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_discoveryTable"}` | #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_discoveryTable","params":[]} {"jsonrpc":"2.0","id":1,"result":["enr:-Jm4QBAdUpUqrpTj6yQor5mwif6RRmY11dlj-Um3TqKmJiYha4SUNqdJr2eM3pRsFVCwVikYcBk__5JVTwngUeimKxcCgmlkgnY0gmlwhC36_pOHb3BzdGFja4Xc76gFAIlzZWNwMjU2azGhA2WTa6OqvnWbRmoeuhRRu-BTPgP8y4_MY6snTsNW0gHBg3RjcIIj5oN1ZHCCn7U","enr:-Km4QBqBrKNq7F5L1dSrWW8Y1k8k4V2L2nTsNtGuKPpPwp3L_rBVMaQCQpnc2sBB-c2yV_n4qgM2_2yfcNjVXr4OFgCgmlkgnY0gmlwhH8AAAGHb3BzdGFja4OFAoAE"]} ``` ## Peer Blocking Methods ### `opp2p_blockPeer` Blocks a specific peer by peer ID, preventing any connections to or from that peer. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_blockPeer", "params": [peerID]}` | #### Parameters * `peerID` (string): The peer ID to block #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_blockPeer","params":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_unblockPeer` Unblocks a previously blocked peer by peer ID. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_unblockPeer", "params": [peerID]}` | #### Parameters * `peerID` (string): The peer ID to unblock #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_unblockPeer","params":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_listBlockedPeers` Returns a list of all blocked peer IDs. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_listBlockedPeers"}` | #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_listBlockedPeers","params":[]} {"jsonrpc":"2.0","id":1,"result":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x","16Uiu2HAm7Th3s3C1VHmKrYzA9nPzV4b3vqL8z1x8WZzGk2t9DjRK"]} ``` ## Address Blocking Methods ### `opp2p_blockAddr` Blocks connections from a specific IP address. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_blockAddr", "params": [address]}` | #### Parameters * `address` (string): The IP address to block (IPv4 or IPv6) #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_blockAddr","params":["192.168.1.100"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_unblockAddr` Unblocks a previously blocked IP address. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_unblockAddr", "params": [address]}` | #### Parameters * `address` (string): The IP address to unblock (IPv4 or IPv6) #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_unblockAddr","params":["192.168.1.100"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_listBlockedAddrs` Returns a list of all blocked IP addresses. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_listBlockedAddrs"}` | #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_listBlockedAddrs","params":[]} {"jsonrpc":"2.0","id":1,"result":["192.168.1.100","10.0.0.50","2001:db8::1"]} ``` ## Subnet Blocking Methods ### `opp2p_blockSubnet` Blocks connections from an entire IP subnet using CIDR notation. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_blockSubnet", "params": [subnet]}` | #### Parameters * `subnet` (string): The subnet to block in CIDR notation (e.g., "192.168.1.0/24") #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_blockSubnet","params":["192.168.1.0/24"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_unblockSubnet` Unblocks a previously blocked IP subnet. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_unblockSubnet", "params": [subnet]}` | #### Parameters * `subnet` (string): The subnet to unblock in CIDR notation #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_unblockSubnet","params":["192.168.1.0/24"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_listBlockedSubnets` Returns a list of all blocked IP subnets. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_listBlockedSubnets"}` | #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_listBlockedSubnets","params":[]} {"jsonrpc":"2.0","id":1,"result":["192.168.1.0/24","10.0.0.0/16","2001:db8::/32"]} ``` ## Peer Protection Methods ### `opp2p_protectPeer` Protects a peer from being disconnected due to connection limits or other automatic pruning mechanisms. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_protectPeer", "params": [peerID]}` | #### Parameters * `peerID` (string): The peer ID to protect #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_protectPeer","params":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_unprotectPeer` Removes protection from a peer, allowing it to be disconnected by automatic pruning mechanisms. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_unprotectPeer", "params": [peerID]}` | #### Parameters * `peerID` (string): The peer ID to unprotect #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_unprotectPeer","params":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ## Connection Management Methods ### `opp2p_connectPeer` Attempts to establish a connection to a specific peer using a multiaddress. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_connectPeer", "params": [multiaddr]}` | #### Parameters * `multiaddr` (string): The multiaddress of the peer to connect to #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_connectPeer","params":["/ip4/127.0.0.1/tcp/9190/p2p/16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` ### `opp2p_disconnectPeer` Disconnects from a specific peer by peer ID. | Client | Method invocation | | - | - | | RPC | `{"method": "opp2p_disconnectPeer", "params": [peerID]}` | #### Parameters * `peerID` (string): The peer ID to disconnect from #### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"opp2p_disconnectPeer","params":["16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"]} {"jsonrpc":"2.0","id":1,"result":null} ``` # Rollup RPC Methods Source: https://docs.optimism.io/node-operators/kona-node/rpc/rollup The `optimism` API provides methods for interacting with Kona's rollup state and configuration. ## `optimism_outputAtBlock` Returns the output root at a specific block number, including the L2 block reference, withdrawal storage root, state root, and sync status. | Client | Method invocation | | - | - | | RPC | `{"method": "optimism_outputAtBlock", "params": [blockNumber]}` | ### Parameters * `blockNumber` (`BlockNumberOrTag`): The block number to get the output for. Can be a number, "latest", "earliest", "pending", "safe", or "finalized". ### Returns `OutputResponse` - An object containing: * `version` (`string`): The output version hash * `outputRoot` (`string`): The output root hash * `blockRef` (`L2BlockInfo`): Reference to the L2 block * `withdrawalStorageRoot` (`string`): The withdrawal storage root * `stateRoot` (`string`): The state root * `syncStatus` (`SyncStatus`): The current sync status of the node ### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"optimism_outputAtBlock","params":["latest"]} { "jsonrpc": "2.0", "id": 1, "result": { "version": "0x0000000000000000000000000000000000000000000000000000000000000000", "outputRoot": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "blockRef": { "hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", "number": 12345, "parentHash": "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba", "timestamp": 1699123456, "l1Origin": { "hash": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321", "number": 18123456 }, "sequenceNumber": 42 }, "withdrawalStorageRoot": "0x567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234", "stateRoot": "0xcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab", "syncStatus": { "current_l1": { "hash": "0x1111111111111111111111111111111111111111111111111111111111111111", "number": 18123456 }, "current_l1_finalized": { "hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "number": 18123400 }, "head_l1": { "hash": "0x3333333333333333333333333333333333333333333333333333333333333333", "number": 18123460 }, "safe_l1": { "hash": "0x4444444444444444444444444444444444444444444444444444444444444444", "number": 18123450 }, "finalized_l1": { "hash": "0x5555555555555555555555555555555555555555555555555555555555555555", "number": 18123400 }, "unsafe_l2": { "hash": "0x6666666666666666666666666666666666666666666666666666666666666666", "number": 12350, "parentHash": "0x7777777777777777777777777777777777777777777777777777777777777777", "timestamp": 1699123500, "l1Origin": { "hash": "0x8888888888888888888888888888888888888888888888888888888888888888", "number": 18123460 }, "sequenceNumber": 47 }, "safe_l2": { "hash": "0x9999999999999999999999999999999999999999999999999999999999999999", "number": 12345, "parentHash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "timestamp": 1699123456, "l1Origin": { "hash": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "number": 18123456 }, "sequenceNumber": 42 }, "finalized_l2": { "hash": "0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "number": 12340, "parentHash": "0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", "timestamp": 1699123400, "l1Origin": { "hash": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "number": 18123400 }, "sequenceNumber": 37 }, "local_safe_l2": { "hash": "0x0000000000000000000000000000000000000000000000000000000000000003", "number": 12345, "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000004", "timestamp": 1699123456, "l1Origin": { "hash": "0x0000000000000000000000000000000000000000000000000000000000000005", "number": 18123456 }, "sequenceNumber": 42 } } } } ``` ## `optimism_syncStatus` Returns the current synchronization status of the rollup node, including information about L1 and L2 block states. | Client | Method invocation | | - | - | | RPC | `{"method": "optimism_syncStatus", "params": []}` | ### Returns `SyncStatus` - An object containing detailed sync information: * `current_l1` (`BlockInfo`): The current L1 block that derivation is idled at * `current_l1_finalized` (`BlockInfo`): The current L1 finalized block (legacy/deprecated) * `head_l1` (`BlockInfo`): The L1 head block reference * `safe_l1` (`BlockInfo`): The L1 safe head block reference * `finalized_l1` (`BlockInfo`): The finalized L1 block reference * `unsafe_l2` (`L2BlockInfo`): The unsafe L2 block reference (absolute tip) * `safe_l2` (`L2BlockInfo`): The safe L2 block reference (derived from L1) * `finalized_l2` (`L2BlockInfo`): The finalized L2 block reference * `local_safe_l2` (`L2BlockInfo`): Local safe L2 block derived from L1, not yet cross-verified ### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"optimism_syncStatus","params":[]} { "jsonrpc": "2.0", "id": 1, "result": { "current_l1": { "hash": "0x1111111111111111111111111111111111111111111111111111111111111111", "number": 18123456 }, "current_l1_finalized": { "hash": "0x2222222222222222222222222222222222222222222222222222222222222222", "number": 18123400 }, "head_l1": { "hash": "0x3333333333333333333333333333333333333333333333333333333333333333", "number": 18123460 }, "safe_l1": { "hash": "0x4444444444444444444444444444444444444444444444444444444444444444", "number": 18123450 }, "finalized_l1": { "hash": "0x5555555555555555555555555555555555555555555555555555555555555555", "number": 18123400 }, "unsafe_l2": { "hash": "0x6666666666666666666666666666666666666666666666666666666666666666", "number": 12350, "parentHash": "0x7777777777777777777777777777777777777777777777777777777777777777", "timestamp": 1699123500, "l1Origin": { "hash": "0x8888888888888888888888888888888888888888888888888888888888888888", "number": 18123460 }, "sequenceNumber": 47 }, "safe_l2": { "hash": "0x9999999999999999999999999999999999999999999999999999999999999999", "number": 12345, "parentHash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "timestamp": 1699123456, "l1Origin": { "hash": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "number": 18123456 }, "sequenceNumber": 42 }, "finalized_l2": { "hash": "0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "number": 12340, "parentHash": "0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", "timestamp": 1699123400, "l1Origin": { "hash": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "number": 18123400 }, "sequenceNumber": 37 }, "local_safe_l2": { "hash": "0x0000000000000000000000000000000000000000000000000000000000000003", "number": 12345, "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000004", "timestamp": 1699123456, "l1Origin": { "hash": "0x0000000000000000000000000000000000000000000000000000000000000005", "number": 18123456 }, "sequenceNumber": 42 } } } ``` ## `optimism_rollupConfig` Returns the rollup configuration parameters that define the rollup chain's behavior and properties. | Client | Method invocation | | - | - | | RPC | `{"method": "optimism_rollupConfig", "params": []}` | ### Returns `RollupConfig` - An object containing the complete rollup configuration: * `genesis` (`ChainGenesis`): The genesis state of the rollup * `blockTime` (`number`): The block time of the L2 in seconds * `maxSequencerDrift` (`number`): Maximum sequencer drift in seconds * `seqWindowSize` (`number`): The sequencer window size * `channelTimeout` (`number`): Number of L1 blocks between channel open/close * `graniteChannelTimeout` (`number`): Channel timeout after Granite hardfork * `l1ChainId` (`number`): The L1 chain ID * `l2ChainId` (`number`): The L2 chain ID * `batchInboxAddress` (`string`): L1 address where batches are sent * `depositContractAddress` (`string`): L1 address for deposits * `l1SystemConfigAddress` (`string`): L1 address for system config * `protocolVersionsAddress` (`string`): L1 address for protocol versions * Additional configuration fields for hardforks, fees, and interoperability ### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"optimism_rollupConfig","params":[]} { "jsonrpc": "2.0", "id": 1, "result": { "genesis": { "l1": { "hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "number": 18000000 }, "l2": { "hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", "number": 0, "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": 1699000000, "l1Origin": { "hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "number": 18000000 }, "sequenceNumber": 0 }, "l2Time": 1699000000, "systemConfig": { "batcherAddr": "0x1234567890123456789012345678901234567890", "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", "gasLimit": 30000000 } }, "blockTime": 2, "maxSequencerDrift": 600, "seqWindowSize": 3600, "channelTimeout": 300, "graniteChannelTimeout": 50, "l1ChainId": 1, "l2ChainId": 10, "batchInboxAddress": "0xff00000000000000000000000000000000000010", "depositContractAddress": "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed", "l1SystemConfigAddress": "0x229047fed2591dbec1eF1118d64F7aF3dB9EB290", "protocolVersionsAddress": "0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935", "superchainConfigAddress": "0x95703e0982140D16f8ebA6d158FccEde42f04a4C", "blobs_data": 1710374400, "interopMessageExpiryWindow": 3600, "chainOpConfig": { "canyon_denominator": 250, "canyon_elasticity": 6 } } } ``` ## `optimism_version` Returns the software version of the Kona rollup node. | Client | Method invocation | | - | - | | RPC | `{"method": "optimism_version", "params": []}` | ### Returns `string` - The version string of the Kona software (e.g., "0.1.0") ### Example ```js theme={null} // > {"jsonrpc":"2.0","id":1,"method":"optimism_version","params":[]} { "jsonrpc": "2.0", "id": 1, "result": "0.1.0" } ``` ## Deprecated Methods ### `optimism_safeHeadAtL1Block` This RPC endpoint is **not supported** in Kona. It was used to track the safe head for every L1 block, but this is no longer necessary post-interop. Calling this method will return a "Method not found" error. | Client | Method invocation | | - | - | | RPC | `{"method": "optimism_safeHeadAtL1Block", "params": [blockNumber]}` | ### Returns This method returns an error with code `-32601` (Method not found). # Run Kona Node as a Binary Source: https://docs.optimism.io/node-operators/kona-node/run/binary Run the kona-node binary against an op-reth execution client, from starting both clients to watching the node sync. <Note> If you don't have a `kona-node` binary yet, download the latest pre-built binary from the [GitHub releases page](https://github.com/ethereum-optimism/optimism/releases), or head over to the [Installation](/node-operators/kona-node/install/overview) guide to build one yourself. </Note> `kona-node` is an L2 consensus client (also called a "rollup node"). This means that the node is a *consensus*-layer client, which needs a corresponding execution-layer client in order to sync and follow the L2 chain. The OP Stack uses a minimal diff approach to L1 execution clients, and [`op-reth`][op-reth] is the primary L2 execution layer client. This section will illustrate running the `kona-node` with an instance of [`op-reth`][op-reth]. Out of the box, the `kona-node` can be used for any `OP Stack` chain that is part of the [`superchain-registry`][scr]. In order to use an out-of-band `OP Stack` chain, for example a new devnet, you'll need to specify the rollup config using the custom `--l2-config-file` cli flag. See [rollup configuration loading](/node-operators/kona-node/configuration#rollup-configuration-loading) for details. <Info> This tutorial walks through running the `kona-node` as a binary. To use docker, head over to the [Docker Guide](/node-operators/kona-node/run/docker) which uses a `docker-compose` setup provided by `kona`. The `docker-compose` setup automatically bootstraps the `kona-node` with `op-reth`, provisioning grafana dashboards and a default Prometheus configuration. It is encouraged to follow the [Docker Guide](/node-operators/kona-node/run/docker) to avoid misconfigurations. </Info> The `kona-node` requires a few CLI flags. * `--l1-eth-rpc <L1_ETH_RPC>` URL of the L1 execution client RPC API. * `--l1-beacon <L1_BEACON>` URL of the L1 beacon API. * `--l2-engine-rpc <L2_ENGINE_RPC>` URL of the engine API endpoint of an L2 execution client. The L2 engine RPC points to the execution layer client's engine API, [`op-reth`][op-reth]. An L1 beacon endpoint and rpc endpoint are also required to fetch the L1 chain data that the L2 chain is derived from. First, start an instance of [`op-reth`][op-reth]. The [`op-reth` docs][op-reth-docs] provide very detailed instructions for running `op-reth` nodes for OP Stack chains (L2). For this demo,
프로젝트로 돌아가기