bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 68쪽
a bare metal server provides predictability and determinism, which are crucial for maintaining synchronization and throughput across the network. Cloud-hosted VMs may work under light loads, but they cannot guarantee consistent real-time performance required by Monad consensus at scale.
# Node Operations
Source: https://docs.monad.xyz/node-ops/index
## Setup
<CardGroup>
<Card title="Hardware Requirements" href="/node-ops/hardware-requirements">
High performance on commodity hardware
</Card>
<Card title="Full Node Installation" href="/node-ops/full-node-installation">
How to run a full node
</Card>
<Card title="Validator Installation" href="/node-ops/validator-installation">
How to run a validator
</Card>
</CardGroup>
## Operations
<CardGroup>
<Card title="General Operations" href="/node-ops/general-operations">
Command-line tools for debugging or checking node status
</Card>
<Card title="Upgrade Instructions" href="/node-ops/upgrade-instructions">
Instructions for specific upgrade sequences
</Card>
<Card title="Recovering a node" href="/node-ops/node-recovery">
Procedures for recovering node operation
</Card>
</CardGroup>
## Advanced
<CardGroup>
<Card title="How Full Nodes Receive Blocks" href="/node-ops/full-node-block-delivery">
How to configure node.toml to receive blocks from validators
</Card>
<Card title="Execution Events and WebSockets" href="/node-ops/events-and-websockets">
Additional setup instructions if you need real-time data
</Card>
<Card title="Archive Data Setup" href="/node-ops/archive-data">
How to configure your node to serve historical transactional data
</Card>
<Card title="Validator Delegation Program" href="/node-ops/validator-delegation-program">
Foundation delegation framework for validators
</Card>
</CardGroup>
# Full Replay
Source: https://docs.monad.xyz/node-ops/node-recovery/full-replay
Full Replay allows a node to catch up on missed blocks by simply retrieving and replaying them
serially. This is helpful for nodes that want all intermediary state and transactional artifacts
to be generated. For example, an RPC provider would probably want this to ensure that they can
respond to requests like `eth_call`, `eth_getBalance`, or `eth_estimateGas` for blocks
that were skipped.
## Context
A node that has not locally executed block `forkpoint.root - delay` will statesync on startup (see [forkpoint startup sync](/monad-arch/consensus/forkpoint#startup-sync)). Also, nodes don’t serve blocksync requests more than statesync\_threshold (600) blocks ago. Statesync is the only in-protocol way for that node to recover.
This document describes an *alternate* way to recover a node while backfilling historical state in the event that a node has been down for longer than the blocksync provision window (600 blocks).
Note that if `statesync_threshold` in `node.toml` is set to a value larger than that, blocksync will fail.
<Warning title="Access to a healthy node required">
In order to recover the faulty node with complete historical state, the below
procedure *requires SSH access to a node that was healthy* throughout the faulty node's downtime.
Let `REMOTE_HOST` be the healthy node that can be used for recovery.
</Warning>
## Procedure
1. SSH into the faulty node as `monad` user.
2. Ensure `statesync_threshold = 600` in `node.toml`
```bash theme={null}
$ grep statesync_threshold /home/monad/monad-bft/config/node.toml
statesync_threshold = 600
```
1. Stop the monad services
```bash theme={null}
sudo systemctl stop monad-bft monad-execution monad-rpc
```
1. Run this script to copy missing blocks, then run execution up to that point. You will need to run it several times since the tip of the chain will continue advancing while this script is executing.
1. NOTE: You will need to manually interrupt the process (Ctrl - C) once output stops.
2. Copy this script and name it `manual-sync.sh`
```bash theme={null}
#!/usr/bin/env bash
set -euo pipefail
# Load config first so SSH_PORT, REMOTE_HOST, CHAIN etc are set
source .env
: "${SSH_PORT:?SSH_PORT must be set}"
: "${REMOTE_HOST:?REMOTE_HOST must be set}"
: "${CHAIN:?CHAIN must be set}"
echo "Reading files from $REMOTE_HOST"
echo "Using ssh port: $SSH_PORT"
# Copy proposed and finalized header symlinks first
rsync -avP -e "ssh -p $SSH_PORT" \
"monad@$REMOTE_HOST:/home/monad/monad-bft/ledger/headers/*_head" \
/home/monad/monad-bft/ledger/headers/
# Copy new headers and bodies, but don't overwrite existing ones
rsync -avP --ignore-existing -e "ssh -p $SSH_PORT" \
"monad@$REMOTE_HOST:/home/monad/monad-bft/ledger/" \
/home/monad/monad-bft/ledger/
# Note: the --state-sync flag is NOT present
/usr/local/bin/monad \
--chain "$CHAIN" \
--db /dev/triedb \
--block_db /home/monad/monad-bft/ledger \
--sq_thread_cpu 1 \
--log_level INFO
```
3. Run the script
```bash theme={null}
REMOTE_HOST=node1.<provider>.com SSH_PORT=22 CHAIN=monad_mainnet bash manual-sync-step-1.sh
```
2. Once the first script completes in under 1 min, run this script:
1. Copy this and name it `manual-sync-step-2.sh`
```bash theme={null}
#!/usr/bin/env bash
set -euo pipefail
# Load config first so SSH_PORT, REMOTE_HOST, CHAIN etc are set
source .env
: "${SSH_PORT:?SSH_PORT must be set}"
: "${REMOTE_HOST:?REMOTE_HOST must be set}"
: "${CHAIN:?CHAIN must be set}"
# Copy current forkpoint
rsync -av -e "ssh -p $SSH_PORT" \
"monad@$REMOTE_HOST:/home/monad/monad-bft/config/forkpoint/forkpoint.rlp" \
/home/monad/monad-bft/config/forkpoint/
rsync -av -e "ssh -p $SSH_PORT" \
"monad@$REMOTE_HOST:/home/monad/monad-bft/config/forkpoint/forkpoint.toml" \
/home/monad/monad-bft/config/forkpoint/forkpoint.toml
rsync -av -e "ssh -p $SSH_PORT" \
"monad@$REMOTE_HOST:/home/monad/monad-bft/config/validators/validators.toml" \
/home/monad/monad-bft/config/validators/validators.toml
systemctl start monad-bft monad-execution monad-rpc
```
2. Run the script
```bash theme={null}
REMOTE_HOST=node1.<provider>.com SSH_PORT=22 CHAIN=monad_mainnet bash manual-sync-step-2.sh
```
## Check
To check that statesync has been avoided, send an `eth_getBlockByNumber` RPC request
for blocks finalized while the node was down.
```bash theme={null}
curl http://localhost:8080 \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0xdedbeef", false],"id":1}'
```
# Hard Reset Instructions
Source: https://docs.monad.xyz/node-ops/node-recovery/hard-reset
Hard reset wipes the local state and downloads the most recent chain snapshot. After the snapshot
is applied, the node catches up using [statesync](/monad-arch/consensus/statesync) and
[blocksync](/monad-arch/consensus/blocksync).
Hard reset is the most powerful means of resetting a node. Steps are:
1. Download a recent snapshot of the network state.
2. Initialize the DB from the snapshot (this can take up to an hour on testnet and a few minutes on mainnet)
3. Catch up to the tip of the chain via statesync / blocksync (typically \< 5 minutes assuming
snapshot is a few hours old)
<Warning title="Snapshot Restore">
**Monad Foundation** and **Category Labs** are snapshot providers.
If there is an issue, please refer to Discord validator channels for more snapshot providers.
</Warning>
## Prerequisite
* `aria2` must be installed on the node
## Instructions
1. SSH into the node as `root` user.
2. Stop the monad services and reset the workspace to delete all runtime data.
```bash theme={null}
bash /opt/monad/scripts/reset-workspace.sh
```
3. Download and import TrieDB database snapshot.
<Tabs>
<Tab title="Mainnet">
<Info>
On mainnet, database snapshot restoration **takes from 1 to 5 minutes**.
As the blockchain grows over time, snapshot restoration takes longer.
</Info>
Using Monad Foundation provider:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -sSL $MF_BUCKET/scripts/mainnet/restore-from-snapshot.sh | bash
```
Using Category Labs provider:
```
CL_BUCKET=https://pub-b0d0d7272c994851b4c8af22a766f571.r2.dev
curl -sSL $CL_BUCKET/scripts/mainnet/restore_from_snapshot.sh | bash
```
</Tab>
<Tab title="Testnet">
<Info>
On testnet, database snapshot restoration **takes under 5 minutes**.
As the blockchain grows over time, snapshot restoration takes longer.
</Info>
Using Monad Foundation provider:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -sSL $MF_BUCKET/scripts/testnet/restore-from-snapshot.sh | bash
```
Using Category Labs provider:
```
CL_BUCKET=https://pub-b0d0d7272c994851b4c8af22a766f571.r2.dev
curl -sSL $CL_BUCKET/scripts/testnet/restore_from_snapshot.sh | bash
```
</Tab>
</Tabs>
4. Fetch latest [`forkpoint.toml`](/monad-arch/consensus/forkpoint) and `validators.toml` runtime files.
<Info title="Automatic Fetch">
This step is optional if automatic remote config fetching is configured (v0.12.1+).
Ensure `REMOTE_VALIDATORS_URL` and `REMOTE_FORKPOINT_URL` are defined in `/home/monad/.env` file.
See [Full Node Installation](/node-ops/full-node-installation#remote-configuration-fetching-v0-12-1+) for configuration details.
If not configured, you may run the below commands.
</Info>
<Tabs>
<Tab title="Mainnet">
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
VALIDATORS_FILE=/home/monad/monad-bft/config/validators/validators.toml
curl -sSL $MF_BUCKET/scripts/mainnet/download-forkpoint.sh | bash
curl $MF_BUCKET/validators/mainnet/validators.toml -o $VALIDATORS_FILE
chown monad:monad $VALIDATORS_FILE
```
</Tab>
<Tab title="Testnet">
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
VALIDATORS_FILE=/home/monad/monad-bft/config/validators/validators.toml
curl -sSL $MF_BUCKET/scripts/testnet/download-forkpoint.sh | bash
curl $MF_BUCKET/validators/testnet/validators.toml -o $VALIDATORS_FILE
chown monad:monad $VALIDATORS_FILE
```
</Tab>
</Tabs>
5. Start all services
```bash theme={null}
systemctl start monad-bft monad-execution monad-rpc
```
# Recovering a Node
Source: https://docs.monad.xyz/node-ops/node-recovery/index
When a node is stopped (e.g. due to an upgrade or network outage), it may miss some blocks
and fall out of sync with the network. The pages below describe a few options for recovering
and rejoining the tip of the chain.
Each option has tradeoffs:
* **[soft reset](/node-ops/node-recovery/soft-reset)** is fast but only works if the node tip is close to the network tip. It skips execution
of the intervening blocks, so no artifacts (logs, receipts, traces) will be produced locally for
those blocks
* **[hard reset](/node-ops/node-recovery/hard-reset)** is slow but works even if the node tip is far from the network tip. It skips everything
before the snapshot, so no artifacts (logs, receipts, traces) will be produced locally for those
blocks.
* **[full replay](/node-ops/node-recovery/full-replay)** is more expensive, but it ensures the local archive has no gaps that would have to
be served by [S3](/node-ops/archive-data/data-waterfall). Full replay may be desirable
for RPC providers.
* **[node migration](/node-ops/node-recovery/node-migration)** allows validators to achieve high availability by promoting a synced full node
to validator status. This is useful for planned or unplanned maintenance with minimal downtime.
<CardGroup>
<Card title="Soft Reset" href="/node-ops/node-recovery/soft-reset">
Utilizes statesync to catch up to the tip of the chain, skipping
execution of blocks in between.
</Card>
<Card title="Hard Reset" href="/node-ops/node-recovery/hard-reset">
Restores state from a snapshot before resyncing.
</Card>
<Card title="Full Replay" href="/node-ops/node-recovery/full-replay">
Fetches and replays all missing blocks serially so that all transactional
artifacts are available.
</Card>
<Card title="Node Migration" href="/node-ops/node-recovery/node-migration">
Promotes a synced full node to a validator by migrating configuration files
and keys with minimal downtime.
</Card>
</CardGroup>
# Node Migration (Promoting a Full Node to Validator)
Source: https://docs.monad.xyz/node-ops/node-recovery/node-migration
Backup Recommendation:
We highly recommend backing up all validator configuration files and keys. This ensures you can recover quickly in the event of a node crash or unexpected failure.
There are several ways to achieve high availability for your validator node. This document specifically provides instructions for running a full node and promoting it to a validator using the proper configuration files and keys.
In situations of planned or unplanned maintenance, validators can migrate their node keys with minimal downtime by running a full node. This node can be seamlessly converted into a validator, allowing for continuous participation in consensus.
At the moment downtime results in the loss of rewards for validators and their delegators. However there is **no slashing** live on the chain as of now.
Follow these steps to safely migrate your validator role, minimize downtime, and maintain network health.
## Prerequisites
1. Monad version >= `0.12.x`.
2. `id-secp` and `id-bls` keys of the validator.
3. `node.toml` configuration file of the validator.
4. `KEYSTORE_PASSWORD` value from the `.env` file.
## Instructions
1. Follow the [full node instructions](/node-ops/full-node-installation) to sync a full node to the tip of the network.
2. Backup existing configuration files on the full node from `/home/monad/monad-bft/config` and move them to `/opt/monad/backup`.
* `/home/monad/monad-bft/config/node.toml`
* `/home/monad/monad-bft/config/id-secp`
* `/home/monad/monad-bft/config/id-bls`
3. Copy `id-secp`,`id-bls` and `node.toml` from the validator to the full node.
4. From the full node, run the `monad-sign-name-record` utility to generate a name-record signature for the new IP address.
```bash theme={null}
# Source the .env file to load the keystore password env variable
source /home/monad/.env
# Generate a name record and signature
monad-sign-name-record --ip $(curl -s4 ifconfig.me) \
--tcp-port 8000 \
--udp-port 8000 \
--node-config /home/monad/monad-bft/config/node.toml \
--authenticated-udp-port 8001 \
--self-record-seq-num 1 \
--keystore-path /home/monad/monad-bft/config/id-secp \
--password "$KEYSTORE_PASSWORD"
```
**Example Output:**
```bash theme={null}
self_address = "<IP>:8000"
self_record_seq_num = 1 # Incremented by 1 from the previous value
self_name_record_sig = "<HEX SIG>"
```
1. From the full node, replace the `[peer_discovery]` block in `node.toml` with the output of the above command (3 lines).
<Info>
* The `self_record_seq_num` is incremented each time the node undergoes a migration process.
* This value is crucial as it is directly linked to the `self_name_record_sig`, ensuring
consistency and integrity of the node's identity during transitions.
</Info>
1. If the original validator had (other) custom configuration related to dedicated full nodes, e.g. `[[fullnode_dedicated.identities]]`, those will need to be added to the full node's `node.toml`. To maintain connectivity with downstream nodes all downstream peers must update the name record for the validator in their `node.toml` configuration.
2. Ensure `enable_publisher = true`, `enable_client = true` and `expand_to_group = true`. In `expand_to_group = true` mode, full nodes support relies on secondary raptorcast peers specified in the full node's `node.toml`
3. Double-check and ensure if the **`beneficiary = `** values are copied from the validator's `node.toml` to full node's `node.toml`.
4. From the validator node, run `systemctl` commands to stop the services.
```bash theme={null}
systemctl stop monad-bft monad-rpc monad-execution
```
1. Verify the validator services are stopped.
```bash theme={null}
systemctl status monad-bft monad-rpc monad-execution
```
1. Stop the **full node** services and restart the services as a **validator**.
```bash theme={null}
systemctl stop monad-bft monad-rpc monad-execution
sleep 1
systemctl start monad-bft monad-rpc monad-execution
```
1. Verify the systemd services are running:
```bash theme={null}
systemctl status monad-bft monad-execution monad-rpc
# Check logs for each service
journalctl -fu monad-bft
journalctl -fu monad-execution
journalctl -fu monad-rpc
```
## Restoring the original validator
If you would like to restore the original validator (A) to its original role, you will need to perform one of two procedures:
1. Re-sync A - this will result in some downtime based on the time to statesync / blocksync
1. Copy the `node.toml` from node B to node A
2. From A, run `monad-sign-name-record` using node B's `node.toml` with incremented `self_record_seq_num`
3. Update the corresponding two fields in `node.toml`
4. From the temporary validator (B), stop the services.
5. Soft or hard reset (A)
2. Run A as a full node, then perform steps above
1. For A, generate [new keys](/node-ops/full-node-installation#generate-keystores)
2. Sign a new name record (see instructions above) and [setup as a dedicated node](/node-ops/full-node-installation) to a validator, e.g. your temporary validator (B)
3. Perform the steps above with roles reversed.
<Warning title="Node Name Management">
Always ensure that each node maintains distinct `node_name` values in their respective `node.toml` files.
* If node B was originally a full node with `node_name = "node_B"`, it should retain this name when returning to full node operation
* Node B should only temporarily use node A's `node_name` during the migration procedure
* After restoration, each node must return to its original `node_name` to avoid conflicts
</Warning>
# Soft Reset Instructions
Source: https://docs.monad.xyz/node-ops/node-recovery/soft-reset
A soft reset is typically required when node is (re-)joining the network and the node tip is close to the network tip. Soft reset utilizes [statesync](/monad-arch/consensus/statesync) to
determine the difference between the current state and the chain tip and to skip ahead.
<Note title="Automated Remote Configuration Fetching (v0.12.1+)">
In v0.12.1+, the node will automatically attempt to fetch remote configuration files on startup if env variables are defined:
* [`forkpoint.toml`](/monad-arch/consensus/forkpoint): Changes every round
* `validators.toml`: Changes every epoch
This simplifies node operations by automating configuration updates. The remote fetching includes threshold logic to determine when remote configs should be used.
**Note**: For automatic remote config fetching (v0.12.1+), ensure `REMOTE_VALIDATORS_URL` and `REMOTE_FORKPOINT_URL` are defined in `/home/monad/.env` file. See [Full Node Installation](/node-ops/full-node-installation#remote-configuration-fetching-v0-12-1+) for configuration details.
</Note>
## Automated Soft Reset (v0.12.1+)
Starting with v0.12.1, soft resets are largely automated if the appropriate variables are defined in `.env`:
1. SSH into the node as `root` user
2. Restart monad-related services (`monad-bft` will auto-fetch configs on startup):
```bash theme={null}
systemctl restart monad-bft monad-execution monad-rpc
```
3. Verify the systemd services are running:
```bash theme={null}
systemctl list-units --type=service monad-bft.service monad-execution.service monad-rpc.service
UNIT LOAD ACTIVE SUB DESCRIPTION
monad-bft.service loaded active running "Service file for Monad BFT"
monad-execution.service loaded active running "Service file for Monad Execution"
monad-rpc.service loaded active running "Service file for Monad RPC"
# Check logs for a specific process to verify config fetching
journalctl -u monad-bft
```
## Manual Soft Reset
To disable the automated fetching, remove any existing definitions (and remove from `/home/monad/.env` if desired)
```bash theme={null}
unset REMOTE_VALIDATORS_URL
unset REMOTE프로젝트로 돌아가기