bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 62쪽
or_rpc_url: Some( // Optional conductor integration
Url::parse("http://conductor:8080").unwrap()
),
l1_conf_delay: 4, // L1 origin confirmation delay
};
// engine_config carries `mode: NodeMode::Sequencer` along with the
// L2 engine URL, JWT secret, and L1 RPC URL. A sequencer needs a block
// signer: `p2p_config.gossip_signer` must be `Some`, or `start` fails.
RollupNodeBuilder::new(
rollup_config,
l1_config_builder,
l2_trust_rpc,
engine_config,
p2p_config,
rpc_config,
)
.with_sequencer_config(sequencer_config)
.build()
.start()
.await?;
```
### Configuration Options
| Field | Description | Default |
| - | - | - |
| `sequencer_stopped` | Start sequencer in stopped state | `false` |
| `sequencer_recovery_mode` | Enable recovery mode for catch-up | `false` |
| `conductor_rpc_url` | Conductor service endpoint for leader election | `None` |
| `l1_conf_delay` | Confirmation delay for L1 origin selection | `0` |
## Next Steps
* To run a sequencer from the command line, including the required flags and example configurations, see [run a sequencer node](/node-operators/kona-node/run/sequencer).
* For the full CLI flag catalogue, see the [Kona node CLI reference](/node-operators/kona-node/configuration).
# FAQ
Source: https://docs.optimism.io/node-operators/kona-node/faq/overview
1. [Ports](/node-operators/kona-node/faq/ports) - Detailed account of ports used by the `kona-node` for P2P communication, JSON-RPC APIs, and the Engine API for execution layer communication.
# Node Ports
Source: https://docs.optimism.io/node-operators/kona-node/faq/ports
| Service | Default Port | Flag/Env |
| - | - | - |
| RPC HTTP | 9545 | `--port` / `KONA_NODE_RPC_PORT` |
| RPC WebSocket | 9545 | (same as HTTP, enabled with `--rpc.ws-enabled`) |
| P2P TCP | 9222 | `--p2p.listen.tcp` / `KONA_NODE_P2P_LISTEN_TCP_PORT` |
| P2P UDP | 9223 | `--p2p.listen.udp` / `KONA_NODE_P2P_LISTEN_UDP_PORT` |
`kona-node` does not run a supervisor RPC server: the binary has no `--supervisor.*`
flag group. Its only interop flag, `--interop.dependency-set`
(`KONA_NODE_INTEROP_DEPENDENCY_SET`), takes a path to a dependency-set JSON file
rather than a port.
`--conductor.rpc` (`KONA_NODE_CONDUCTOR_RPC`) is not a listening port either. It is
the RPC endpoint URL of an external conductor service that the node dials out to,
and it has no default value. Supplying it enables the conductor integration when the
node runs in sequencer mode (`--mode sequencer`); in validator mode it has no effect.
Every port can be changed with the flag or environment variable listed
alongside it. For the full flag catalog, see the
[Kona Node CLI Reference](/node-operators/kona-node/configuration).
# Install kona-node
Source: https://docs.optimism.io/node-operators/kona-node/install/overview
Prerequisites and the three ways to obtain kona-node: Docker images, pre-built binaries, or building from source.
## Prerequisites
Before installing Kona, ensure you have the following prerequisites:
* **Rust toolchain** (MSRV: 1.82)
* **`just`** command runner
* **Docker** (optional, for containerized builds)
### Installing Rust
If you don't have Rust installed, you can install it using [rustup](https://rustup.rs/):
```bash theme={null}
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
Rustup is an easy way to update the Rust compiler, and works on all platforms.
<Tip>
* During installation, when prompted, enter `1` for the default installation.
* After Rust installation completes, try running `cargo version` . If it cannot
be found, run `source $HOME/.cargo/env`. After that, running `cargo version` should return the version, for example `cargo 1.68.2`.
* It's generally advisable to append `source $HOME/.cargo/env` to `~/.bashrc`.
</Tip>
The Minimum Supported Rust Version (MSRV) of this project is 1.82.0. If you
already have a version of Rust installed, you can check your version by running
`rustc --version`. To update your version of Rust, run rustup update.
### Installing Just
`just` is a command runner that Kona uses for build tasks. Install it with:
```bash theme={null}
cargo install just
```
## Installation Methods
There are three ways to obtain Kona:
* [Docker images](/node-operators/kona-node/run/docker#getting-the-kona-node-image): pull a published image or build one locally
* [Pre-built binaries](https://github.com/ethereum-optimism/optimism/releases): download the latest release from GitHub, then follow the [binary guide](/node-operators/kona-node/run/binary)
* [Building from source](/node-operators/kona-node/install/source)
<Note>
If you have Docker installed, we recommend using the [Docker recipe](/node-operators/kona-node/run/docker) configuration
that will have kona-node, op-reth, Prometheus and Grafana running and syncing with just one command.
</Note>
# Building from Source
Source: https://docs.optimism.io/node-operators/kona-node/install/source
<Note>
Building from source requires that the Rust toolchain is installed, as well as the `just` command runner.
Visit the [Prerequisites](/node-operators/kona-node/install/overview) for details on installing Rust and `just`.
</Note>
First clone the repository:
```bash theme={null}
git clone https://github.com/ethereum-optimism/optimism.git
cd rust/kona
```
Then, install the `kona-node` binary into your PATH directly via:
```bash theme={null}
cargo install --locked --path bin/node --bin kona-node
```
The binary will now be accessible as `kona-node` via the command line,
and exist under your default .cargo/bin folder.
Alternatively, you can build yourself with:
```bash theme={null}
cargo build --release --bin kona-node
```
This will place the reth binary under `./target/release/kona-node`, and
you can copy it to your directory of preference after that.
## Update Kona
You can update the `kona-node` to a specific version by running the
commands below.
`${VERSION}` is the version you wish to build in the format `vX.X.X`.
```bash theme={null}
git fetch
git checkout ${VERSION}
cargo build --release --bin kona-node
```
## Troubleshooting
### Command is not found
Reth will be installed to `CARGO_HOME` or `$HOME/.cargo`.
This directory needs to be on your `PATH` before you can run the
`kona-node` binary.
See ["Configuring the PATH environment variable"][path] for more information.
[path]: https://www.rust-lang.org/tools/install
### Compilation error
Make sure you are running the latest version of Rust.
If you have installed Rust using rustup, simply run `rustup update`.
If you can't install the latest version of Rust you can instead compile
using the Minimum Supported Rust Version (MSRV) which is listed under
the `rust-version` key in kona's [Cargo.toml](https://github.com/ethereum-optimism/optimism/blob/develop/rust/kona/Cargo.toml).
If compilation fails with `(signal: 9, SIGKILL: kill)`, this could mean
your machine ran out of memory during compilation. If you are on Docker,
consider increasing the memory of the container, or use a [pre-built
binary](https://github.com/ethereum-optimism/optimism/releases).
If compilation fails with `error: linking with cc failed: exit code: 1`,
try running `cargo clean`.
## Next Steps
* Read the [design docs](/node-operators/kona-node/design/intro) to understand kona-node's architecture
* Check out the [Binaries](/node-operators/kona-node/run/binary) documentation
* Explore the [examples](https://github.com/ethereum-optimism/optimism/tree/develop/rust/kona/examples)
# Monitoring
Source: https://docs.optimism.io/node-operators/kona-node/monitoring
Set up logging, Prometheus metrics, and Grafana dashboards for kona-node.
This guide covers observability for a running `kona-node`: adjusting
log verbosity, filtering log targets, and collecting Prometheus
metrics into Grafana dashboards.
## Logging
`kona-node` provides a `-v` (or `--v`) flag as a way to set
the "verbosity" level for logs. By default, the verbosity level
is set to `3`, which is the INFO level. The level ranges from `0`
being no logs to `5` which includes trace logs. Log levels are
listed below, with each level including the one below it.
* `5`: `TRACE` - very verbose logs that provide a detailed trace
* `4`: `DEBUG` - logs meant to print debugging information
* `3`: `INFO` - informational logs
* `2`: `WARN` - includes warning and error logs
* `1`: `ERROR` - only error logs are shown
* `0`: No logs
The default verbosity level is `-vvv` which is the `3` or `INFO`
level. To set the `kona-node` to print `DEBUG` logs or level `4`,
run the node like so: `kona-node node -vvvv`.
### Filtering Log Targets
By default, the `kona-node` initializes its tracing (logging)
using the default environment variable filter [provided by the
tracing\_subscriber crate][tracing-env]. This uses the value in
the `RUST_LOG` environment variable to set the tracing level
for specific targets. Effectively, `RUST_LOG` allows you to
bypass the default log level for the whole node or specific
log targets. For example, by prepending `RUST_LOG=engine=debug`
to the `kona-node` command (or setting that as an environment
variable), only `INFO` logs will be displayed except for the
`engine` log target which will also print `DEBUG` logs.
This comes in handy say for when we would like to debug Kona's
P2P stack, we could prepend `RUST_LOG=discv5=debug,libp2p=debug`
to view debug logs from only `discv5` and `libp2p` targets.
## Metrics
The `kona-node` can serve Prometheus metrics, which are disabled
by default. To turn them on, pass the `--metrics.enabled` cli flag.
Unless otherwise specified with the `--metrics.port` flag, metrics
are exposed on port `9090`.
To grab a snapshot of the metrics, you can visit `0.0.0.0:9090`
or `curl` the url.
```
curl 0.0.0.0:9090
```
The output should be raw text mapping metrics with their values.
Remember, this is just a snapshot of the metrics at that point
in time. To record and visualize the metrics, we'll use
[Grafana and Prometheus](#grafana-and-prometheus).
## Grafana and Prometheus
Prometheus is a simple service that scrapes metrics at a predefined
interval. Grafana then uses Prometheus as a "Data Source" to
visualize the collected metrics.
The Reth book provides a great overview to setting up [Prometheus
and Grafana][setup]. Visit the Reth docs to follow along.
The `kona-node` comes shipped with a default Grafana dashboard
for the `kona-node`. To import the dashboard to grafana, click
the `+` icon > `Import Dashboard` > paste the contents of [kona's
dashboard][dashboard] in the textbox > `Load`.
[tracing-env]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#method.from_default_env
[setup]: https://reth.rs/run/monitoring#prometheus--grafana
[dashboard]: https://github.com/ethereum-optimism/optimism/blob/develop/rust/kona/docker/recipes/kona-node/grafana/dashboards/overview.json
# System Requirements
Source: https://docs.optimism.io/node-operators/kona-node/requirements
`kona-node` is an L2 consensus client, so it stores almost nothing on disk!
<Note>
Anything stored on disk is configurable, and can be disabled.
</Note>
As a rollup node, it always sends L2 blocks over to the execution client
(`op-reth` or `op-geth`) for execution. That way, chain state is entirely
handled by the execution client. In this way, the `kona-node` is incredibly
lightweight and can be run on a wide range of hardware.
That said, a stable and dependable internet connection is critical for the
peer-to-peer (P2P) part of the node. The `kona-node` relies on P2P communication
to sync the unsafe chain. If the connection is unstable, the node may
struggle to keep up, and could be banned by its peers for being too slow.
# Admin RPC Methods
Source: https://docs.optimism.io/node-operators/kona-node/rpc/admin
The `admin` api provides methods for controlling and monitoring Kona's consensus node operations.
## `admin_postUnsafePayload`
Posts an unsafe payload to the network.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_postUnsafePayload", "params": [payload]}` |
### Parameters
* `payload` (`OpExecutionPayloadEnvelope`): The execution payload envelope to post
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_postUnsafePayload","params":[{...payload...}]}
{"jsonrpc":"2.0","id":1,"result":null}
```
## `admin_sequencerActive`
Returns whether the sequencer is currently active.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_sequencerActive"}` |
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_sequencerActive","params":[]}
{"jsonrpc":"2.0","id":1,"result":true}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
## `admin_startSequencer`
Starts the sequencer.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_startSequencer"}` |
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_startSequencer","params":[]}
{"jsonrpc":"2.0","id":1,"result":null}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
## `admin_stopSequencer`
Stops the sequencer and returns the hash of the last processed block.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_stopSequencer"}` |
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_stopSequencer","params":[]}
{"jsonrpc":"2.0","id":1,"result":"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
## `admin_conductorEnabled`
Returns whether the conductor is enabled.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_conductorEnabled"}` |
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_conductorEnabled","params":[]}
{"jsonrpc":"2.0","id":1,"result":false}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
## `admin_setRecoverMode`
Sets the recovery mode for the sequencer.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_setRecoverMode", "params": [mode]}` |
### Parameters
* `mode` (`bool`): Whether to enable recovery mode (true) or disable it (false)
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_setRecoverMode","params":[true]}
{"jsonrpc":"2.0","id":1,"result":null}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
## `admin_overrideLeader`
Overrides the leader in the conductor.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "admin_overrideLeader"}` |
### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"admin_overrideLeader","params":[]}
{"jsonrpc":"2.0","id":1,"result":null}
```
**Note**: This method will return a "Method not found" error if the node is running in validator mode (sequencer not enabled).
# JSON-RPC
Source: https://docs.optimism.io/node-operators/kona-node/rpc/overview
The `kona-node` supports JSON-RPC for interacting with the node.
By default, `kona-node` exposes an HTTP JSON-RPC server. A WebSocket JSON-RPC
endpoint is also available and can be enabled with the `--rpc.ws-enabled` flag
or the `KONA_NODE_RPC_WS_ENABLED` environment variable. IPC transport is not
supported.
### Namespaces
JSON-RPC methods are grouped into namespaces, which are listed below:
| Namespace | Description | Sensitive |
| - | - | - |
| [`p2p`](/node-operators/kona-node/rpc/p2p) | The `p2p` API allows you to configure the p2p stack. | Maybe |
| [`rollup`](/node-operators/kona-node/rpc/rollup) | The `rollup` API provides OP Stack specific rpc methods. | No |
| [`admin`](/node-operators/kona-node/rpc/admin) | The `admin` API allows you to configure your node. | **Yes** |
### Interacting with the RPC
Kona enables these RPC methods by default.
You can interact with the RPC using any JSON-RPC client, such as `curl`, `httpie`, or a custom client in your preferred programming language.
# P2P RPC Methods
Source: https://docs.optimism.io/node-operators/kona-node/rpc/p2p
The `p2p` api provides methods for interacting with Kona's P2P stack.
## Peer Information Methods
### `opp2p_self`
Returns information about the local node in the form of `PeerInfo`.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "opp2p_self"}` |
#### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"opp2p_self","params":[]}
{"jsonrpc":"2.0","id":1,"result":{"peerID":"16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x","nodeID":"0x311d8222ffc44e9c86f403d57f454bd823e7dc9d3c8e97171ddd862910352f31","userAgent":"kona","protocolVersion":"","ENR":"enr:-Jm4QBAdUpUqrpTj6yQor5mwif6RRmY11dlj-Um3TqKmJiYha4SUNqdJr2eM3pRsFVCwVikYcBk__5JVTwngUeimKxcCgmlkgnY0gmlwhC36_pOHb3BzdGFja4Xc76gFAIlzZWNwMjU2azGhA2WTa6OqvnWbRmoeuhRRu-BTPgP8y4_MY6snTsNW0gHBg3RjcIIj5oN1ZHCCn7U","addresses":["/ip4/127.0.0.1/tcp/9190/p2p/16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x","/ip4/172.18.0.9/tcp/9190/p2p/16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x"],"protocols":["/ipfs/id/push/1.0.0","/meshsub/1.1.0","/ipfs/ping/1.0.0","/meshsub/1.2.0","/ipfs/id/1.0.0","/opstack/req/payload_by_number/2151908/0/","/meshsub/1.0.0","/floodsub/1.0.0"],"connectedness":1,"direction":1,"protected":false,"chainID":11155420,"latency":0,"gossipBlocks":true,"scores":{"gossip":{"total":0.0,"blocks":{"timeInMesh":0.0,"firstMessageDeliveries":0.0,"meshMessageDeliveries":0.0,"invalidMessageDeliveries":0.0},"IPColocationFactor":0.0,"behavioralPenalty":0.0},"reqResp":{"validResponses":0.0,"errorResponses":0.0,"rejectedPayloads":0.0}}}}
```
### `opp2p_peerCount`
Returns the count of connected peers for both discovery and gossip networks.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "opp2p_peerCount"}` |
#### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"opp2p_peerCount","params":[]}
{"jsonrpc":"2.0","id":1,"result":{"connectedDiscovery":15,"connectedGossip":12}}
```
### `opp2p_peers`
Returns information about peers. If `connected` parameter is true, only returns connected peers.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "opp2p_peers", "params": [connected]}` |
#### Parameters
* `connected` (boolean): If true, only returns connected peers
#### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"opp2p_peers","params":[true]}
{"jsonrpc":"2.0","id":1,"result":{"totalConnected":2,"peers":{"16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x":{"peerID":"16Uiu2HAmKVVub7edwZ3RKDnqMpZVsusYW9TKRgbwpH54nvDWLE4x","nodeID":"0x311d8222ffc44e9c86f403d57f454bd823e7dc9d3c8e97171ddd862910352f31","userAgent":"kona","protocolVersion":"","addresses":["/ip4/127.0.0.1/tcp/9190"],"protocols":["/ipfs/ping/1.0.0","/meshsub/1.1.0"],"connectedness":1,"direction":2,"protected":false,"chainID":11155420,"latency":50000000,"gossipBlocks":true,"scores":{"gossip":{"total":1.5,"blocks":{"timeInMesh":100.0,"firstMessageDeliveries":10.0,"meshMessageDeliveries":5.0,"invalidMessageDeliveries":0.0},"IPColocationFactor":0.0,"behavioralPenalty":0.0},"reqResp":{"validResponses":25.0,"errorResponses":1.0,"rejectedPayloads":0.0}}}},"bannedPeers":[],"bannedIPS":[],"bannedSubnets":[]}}
```
### `opp2p_peerStats`
Returns statistical information about peers including connection counts and topic subscriptions.
| Client | Method invocation |
| - | - |
| RPC | `{"method": "opp2p_peerStats"}` |
#### Example
```js theme={null}
// > {"jsonrpc":"2.0","id":1,"method":"opp2p_peerStats","params":[]}
{"jsonrpc":"2.0","id":1,"result":{"connected":12,"table":50,"blocksTopic":8,"blocksTopicV2":10,"blocksTopicV3":5,"blocksTopicV4":2,"banned":3,"known":75}}
프로젝트로 돌아가기