bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 66쪽
Receive Blocks
Source: https://docs.monad.xyz/node-ops/full-node-block-delivery
<Note>
See [here](/node-ops/full-node-installation) for instructions on how to set up a full node.
</Note>
The [RaptorCast](/monad-arch/consensus/raptorcast) protocol is a novel method of one-to-many
block propagation that uses an erasure-coded two-level broadcast tree to propagate large blocks
from a message originator to many listeners.
There are two usages of RaptorCast in the Monad network: primary and secondary:
* In its **primary** usage, RaptorCast is utilized by each leader to share its block proposal to all
other validators in the active set. There is one primary RaptorCast group, consisting of all
validators in the active set, with a leader that rotates.
* In its **secondary** usage, one validator from the active set supports a number of downstream full nodes,
propagating every block proposal (received by it via primary RaptorCast) to its downstream listeners.
There are many secondary RaptorCast groups - one per validator in the active set - and for each one,
the leader is static.
Secondary RaptorCast allows the network to support a huge set of full nodes. In the
recommended configuration, each validator has a secondary RaptorCast group of size 150. Given a network
of 200 active set validators, even after accounting for a redundancy factor of 2 (full nodes may register
for multiple secondary RaptorCast groups), there is still capacity for 150 \* 200 / 2 = 15,000 full nodes.
The rest of this page documents the behavior of secondary RaptorCast, as well as how full node operators
should configure it. Validators may find the configuration helpful as well, since validators usually
start as full nodes.
## Differences between primary and secondary RaptorCast
Secondary RaptorCast follows the same mechanism as primary RaptorCast.
There are some differences, however.
In Primary RaptorCast:
* The participants are all validators
* The originator changes given that the leader can change (due to leader election)
* The "weights" on the other nodes are based on stake
In Secondary RaptorCast:
* The originator of a group is fixed and always a validator
* Other than the above, the other participants are full nodes
* All nodes are equally weighted
## How full nodes register for secondary RaptorCast
1. Full nodes start by peering with some of the validators. They do this by peering with the
bootstrap peers (aka other full nodes) specified in `node.toml` (see later in this document for more details),
then asking them for their peers, and repeating until they have the name records of the full validator set.
2. If a validator has `enable_publisher = true` in its `node.toml`, it will routinely send invites to the
full nodes in its routing table (up to `max_group_size`). These invites will request the full node to
join the validator's secondary RaptorCast group.
3. A full node has the option to accept or reject. If a full node is in too many groups, it will reject.
This is controlled by the `max_num_group` parameter.
4. The validator will collect these accept/reject responses and confirm a group.
5. The group will last for `round_span` specified in the validator's `node.toml` (default: 240
rounds). As the group's age approaches `round_span`, the validator will start sending
invites for its next secondary RaptorCast group.
6. Full nodes can (and should) join multiple secondary RaptorCast groups for redundancy.
<Note>
A full node can join a group even if it hasn't finished syncing the state. Joining a group is
how a full node becomes aware of the current round. That information can, in turn, be used to adjust
the statesync target.
</Note>
## Configuring RaptorCast
### General Recommendation
It is highly suggested that operators of validators have the node:
* First be a full node with `enable_client = true`
* AND also configure the validator specific settings in `node.toml`
* Then convert to a validator via staking
### Important Considerations
* Several of the settings below only apply to nodes that are operating as a validator
* Other apply only if the node is running as a full node
* That being said, it's recommended that BOTH sets of settings be in the `node.toml`
Why do we recommend the above?
Because it's possible for a node to "begin life" as a full node, become a validator (via staking)
and then become a full node again (if staking is pulled back). Having settings for both modes
(validator and full node) ensures that the node can keep up with the chain tip.
For example, if a validator becomes a full node and is NOT part of a secondary RaptorCast group
(aka `enable_client = true`) then it will miss block updates and fall behind the ledger tip.
### `node.toml`
Below is a snippet of a `node.toml` that applies to RaptorCast.
We've grouped the settings as "full node only", "validator only" or "both"
We've also added comments to explain what each setting does
`node.toml` contains the following settings:
```
[fullnode_raptorcast]
# VALIDATOR ONLY
# "enable_publisher = true" means that if the full node becomes a validator, it will participate
# as a secondary RaptorCast originator.
enable_publisher = true
# maximum number of rounds that a validator will wait for invite response from the full node
max_invite_wait = 10
# number of rounds that a group lasts for
round_span = 240
# how far ahead (in rounds) validator sends invites to full nodes before the start of the round
# e.g. if the round_span is 240, the invites will go out at round 220
invite_lookahead = 20
# FULL NODE ONLY
# this needs to be "true" for full nodes to participate in secondary RaptorCast
enable_client = true
# upper limit on how many groups the full node will join
max_num_group = 3
# indicates the time range (in rounds) that the full node will accept group invites
invite_future_dist_min = 1
invite_future_dist_max = 600
# a heartbeat which is used to determine whether the full node is receiving proposals
invite_accept_heartbeat_ms = 10000
# BOTH MODES
# maximum number of nodes in a group
max_group_size = 150
raptor10_fullnode_redundancy_factor = 2.0
deadline_round_dist = 10
init_empty_round_span = 23
[fullnode_raptorcast.full_nodes_prioritized]
identities = []
```
## Additional options
### Prioritized secondary RaptorCast inclusion
A full node may coordinate with a validator to be explicitly and consistently invited to that
validator's secondary RaptorCast group.
To do this, the full node provides some information for the validator to include in its
`[fullnode_raptorcast.full_nodes_prioritized.identities]` section. See
[Validator Installation](/node-ops/validator-installation#configure-node-toml) for details on what needs to
be provided. Note that this means the full node doesn't have to rely on peer discovery to peer with
that validator.
### Dedicated upstream
Validators also have the option of specifying full nodes to which they wish to directly forward
all primary RaptorCast chunks.
This utilizes a lot of validator bandwidth, since each registered downstream requires another
copy of all chunks to be sent. It is potentially more reliable for the downstream node than
subscribing via secondary RaptorCast, although in practice secondary RaptorCast is quite reliable.
Note that if a full node is designated by one or more validators for dedicated chunk forwarding,
then it could be configured with `enable_client = false`. This turns off attempting to participate
in secondary RaptorCast.
### Comparison
| Configuration | Requires validator to whitelist full node | RaptorCast mode | Data Source |
| - | - | - | - |
| **Normal** | No | `enable_client = true` | Secondary RaptorCast |
| **Prioritized secondary RaptorCast** | Yes | `enable_client = true` | Secondary RaptorCast |
| **Chunk forwarding** | Yes | `enable_client = false` | Primary RaptorCast |
Note that these configurations are properties of a **relationship** between a full node and a
validator, rather than properties of the full node itself.
A full node could coordinate with multiple validators to treat it specially, while
also participating in normal secondary RaptorCast with other validators that it automatically
peers with.
## RaptorCast configurations for validators
Validators can toggle off their participation in secondary RaptorCast by setting
`enable_publisher = false`.
Although turning secondary RaptorCast off will reduce bandwidth usage,
note that the bandwidth cost of secondary RaptorCast is relatively low; for example, even at
10,000 transactions per second, the expected usage will be about 6 MB per second (3 MB of
block data with 2x redundancy). Therefore, it is recommended to keep `enable_publisher = true`.
<Tip title="RaptorCast">
For more technical details about the RaptorCast, see the
[RaptorCast documentation](/monad-arch/consensus/raptorcast).
</Tip>
# Full Node Installation
Source: https://docs.monad.xyz/node-ops/full-node-installation
## Components
Monad nodes are running services using `systemd`:
* `monad-bft` - Consensus client
* `monad-execution` - Execution client
* `monad-rpc` - RPC server
* `monad-mpt` - One-time execution for initializing the TrieDB disk
* `monad-cruft` - Cleanup service running hourly
* `otelcol` - OTEL collector service for metric collection
The systemd services are running using `monad` service user.
The configuration and data structure is:
* `/home/monad/.env` - contains the environment variables to configure monad services
* `/home/monad/monad-bft/config/node.toml` - contains configurable consensus parameters, most
notably the name of the node, typically `"<PROVIDER_NAME>-1"` and a list of upstream validators
(denoted by secp pubkey and DNS) who have been configured to republish blocks to your full node.
* `/home/monad/monad-bft/config/forkpoint/` - contains the [forkpoint](/monad-arch/consensus/forkpoint),
a saved snapshot of consensus state used to bootstrap the node on startup
* `/home/monad/monad-bft/config/validators/` - contains validator sets generated at the
[boundary block](/monad-arch/consensus/staking#epochs-and-boundaries). The newly generated
file contains the consensus validator sets for the current epoch and for the upcoming epoch.
The most recent validator set is found at `validators.toml`.
* `/home/monad/monad-bft/ledger/` - contains consensus (BFT) block headers and bodies, including the transactions
* `/dev/triedb` - TrieDB database device, contains the state of the blockchain
## Prerequisites
Please refer to the [Hardware Requirements](/node-ops/hardware-requirements) before continuing.
* Bare-metal server
* Ubuntu 24.04+ Operating system
* Disabled HyperThreading (HT) or Simultaneous MultiThreading (SMT) via BIOS settings. These features degrade the Monad node performance.
## Prepare the Node
<Info>
The following instructions assume the commands are executed as `root` user.
</Info>
### Update the system
Update the system.
```bash theme={null}
apt update
apt upgrade -y
```
Reboot the machine if required, for example if the upgrade prints `Pending kernel upgrade!`.
Install additional dependencies.
```bash theme={null}
apt install -y curl nvme-cli aria2 jq
```
### Install `monad` package
Configure the APT repository.
```bash theme={null}
cat <<EOF > /etc/apt/sources.list.d/category-labs.sources
Types: deb
URIs: https://pkg.category.xyz/
Suites: noble
Components: main
Signed-By: /etc/apt/keyrings/category-labs.gpg
EOF
curl -fsSL https://pkg.category.xyz/keys/public-key.asc \
| gpg --dearmor --yes -o /etc/apt/keyrings/category-labs.gpg
```
<Tabs>
<Tab title="Mainnet">
Install `monad` package.
<CodeBlock />
</Tab>
<Tab title="Testnet">
Install `monad` package.
<CodeBlock />
</Tab>
</Tabs>
### Create `monad` user
Create a non-privileged user named `monad` with a home directory and Bash shell.
```bash theme={null}
useradd -m -s /bin/bash monad
```
Create config directories structure in `/home/monad`.
```bash theme={null}
mkdir -p /home/monad/monad-bft/config \
/home/monad/monad-bft/ledger \
/home/monad/monad-bft/config/forkpoint \
/home/monad/monad-bft/config/validators
```
### Configure TrieDB Device
#### Create the device
Set the NVMe drive (e.g. `/dev/nvme1n1`) to be used for TrieDB device, create a new partition table and a partition that spans the
entire drive. The drive should be on a disk that has no filesystem mounted and no RAID configured.
<Warning title="IMPORTANT: Identify drives carefully">
**Formatting the wrong drive will destroy your operating system!**
Before proceeding, verify which drive to use:
```bash theme={null}
nvme list
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,MODEL
```
Look for a drive with **no mountpoints**. Your OS drive will show `/`, `/boot`, or swap partitions.
</Warning>
```bash theme={null}
TRIEDB_DRIVE=/dev/nvme1n1 # CHANGE THIS TO YOUR NVME DRIVE
parted $TRIEDB_DRIVE mklabel gpt
parted $TRIEDB_DRIVE mkpart triedb 0% 100%
```
Create a udev rule to set permissions and create a symlink for the partition.
```bash theme={null}
PARTUUID=$(lsblk -o PARTUUID $TRIEDB_DRIVE | tail -n 1)
echo "Disk PartUUID: ${PARTUUID}"
echo "ENV{ID_PART_ENTRY_UUID}==\"$PARTUUID\", MODE=\"0666\", SYMLINK+=\"triedb\"" \
| tee /etc/udev/rules.d/99-triedb.rules
```
Trigger and reload udev rules, and verify TrieDB is pointing to the NVMe device.
```bash theme={null}
udevadm trigger
udevadm control --reload
udevadm settle
ls -l /dev/triedb
```
#### Verify the LBA configuration
Verify LBA Configuration, and enable 512 byte LBA if not enabled.
Check if 512 byte LBA is enabled on `TRIEDB_DRIVE`:
```bash theme={null}
nvme id-ns -H $TRIEDB_DRIVE | grep 'LBA Format' | grep 'in use'
```
This command should return the following expected output:
```
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative Performance: 0 Best (in use)
```
<Info>
`Data Size` should be set to `512 bytes` and marked as `(in use)`. If that is **not** the case,
then you will need to set the `TRIEDB_DRIVE` to use 512 byte LBA with the following command.
```bash theme={null}
nvme format --lbaf=0 $TRIEDB_DRIVE
```
Verify that the configuration has been corrected.
```bash theme={null}
nvme id-ns -H $TRIEDB_DRIVE | grep 'LBA Format' | grep 'in use'
```
</Info>
#### Format the partition
Format the TrieDB partition by executing the `monad-mpt` one-time service.
```
systemctl start monad-mpt
journalctl -u monad-mpt -n 14 -o cat
```
This should return similar output.
```
MPT database on storages:
Capacity Used % Path
1.75 Tb 256.03 Mb 0.01% "/dev/nvme1n1p1"
MPT database internal lists:
Fast: 1 chunks with capacity 256.00 Mb used 0.00 bytes
Slow: 1 chunks with capacity 256.00 Mb used 0.00 bytes
Free: 7148 chunks with capacity 1.75 Tb used 0.00 bytes
MPT database has 1 history, earliest is 18446744073709551615 latest is 18446744073709551615.
It has been configured to retain no more than 33554432.
Latest proposed is (18446744073709551615, 0000000000000000000000000000000000000000000000000000000000000000).
Latest voted is (18446744073709551615, 0000000000000000000000000000000000000000000000000000000000000000).
Latest finalized is 18446744073709551615, latest verified is 18446744073709551615, auto expire version is 0
monad-mpt.service: Deactivated successfully.
Finished monad-mpt.service - "Service file for Monad MPT".
```
### Configure Firewall rules
Configure these firewall rules:
* block all incoming traffic and enable all outgoing (default)
* allow SSH inbound connections (remote access)
* allow inbound and outbound to port 8000 for TCP/UDP (Consensus client P2P traffic)
Setup the UFW firewall:
```bash theme={null}
ufw allow ssh
ufw allow 8000
ufw allow 8001
ufw allow 8002
ufw enable
ufw status
```
Configure the following iptables rule for improved robustness against spam:
```bash theme={null}
sudo iptables -I INPUT -p udp --dport 8000 -m length --length 0:1400 -j DROP
```
Please note that this rule will be reset upon reboot, so node operators should use their preferred mechanism, e.g. `iptables-persistent` for persisting iptables rules.
<Tip title="Hardware firewalls">
If using hardware firewalls, you may need to perform additional steps to open up port 8000 to UDP
and TCP traffic.
</Tip>
<Note title="Test outbound TCP">
To verify outbound connectivity on TCP port 8000, test a connection to remote host:
```
$ nc -vz 64.31.29.190 8000
Connection to 64.31.29.190 8000 port [tcp/*] succeeded!
```
See the `node.toml` file to test with a remote bootstrap peer.
</Note>
### Configure OTEL Collector
The monad package supports OTEL collector. Through this, you will be able to see all the
relevant Monad-specific metrics, available at `http://0.0.0.0:8889/metrics`.
```bash theme={null}
OTEL_VERSION="0.139.0"
OTEL_CHECKSUM="1a1576dde7d51fa7094f4963ceaff37c91ac7b9c9593ba735a3a328ec6f8acd9"
OTEL_PACKAGE="https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/otelcol_${OTEL_VERSION}_linux_amd64.deb"
OTEL_DEB="/tmp/otelcol_linux_amd64.deb"
curl -fsSL "$OTEL_PACKAGE" -o "$OTEL_DEB"
if echo "${OTEL_CHECKSUM} ${OTEL_DEB}" | sha256sum --check --quiet; then
dpkg -i "$OTEL_DEB"
cp /opt/monad/scripts/otel-config.yaml /etc/otelcol/config.yaml
systemctl restart otelcol
else
echo "Checksum verification failed — aborting install." >&2
fi
```
## Configure the Node
### Get configuration files
<Tabs>
<Tab title="Mainnet">
Configuration files for **full nodes**:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -o /home/monad/.env $MF_BUCKET/config/mainnet/latest/.env.example
curl -o /home/monad/monad-bft/config/node.toml $MF_BUCKET/config/mainnet/latest/full-node-node.toml
```
Configuration files for **validators**:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -o /home/monad/.env $MF_BUCKET/config/mainnet/latest/.env.example
curl -o /home/monad/monad-bft/config/node.toml $MF_BUCKET/config/mainnet/latest/node.toml
```
</Tab>
<Tab title="Testnet">
Configuration files for **full nodes**:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -o /home/monad/.env $MF_BUCKET/config/testnet/latest/.env.example
curl -o /home/monad/monad-bft/config/node.toml $MF_BUCKET/config/testnet/latest/full-node-node.toml
```
Configuration files for **validators**:
```bash theme={null}
MF_BUCKET=https://bucket.monadinfra.com
curl -o /home/monad/.env $MF_BUCKET/config/testnet/latest/.env.example
curl -o /home/monad/monad-bft/config/node.toml $MF_BUCKET/config/testnet/latest/node.toml
```
</Tab>
</Tabs>
### Define Keystore password
Set your own unique and strong password for `KEYSTORE_PASSWORD`.
This password is used to encrypt and decrypt your keystores.
It must be wrapped in single quotes (e.g. `'password'`).
Assuming `KEYSTORE_PASSWORD` in `/home/monad/.env` file is not already set, generate a secure random password.
```
sed -i "s|^KEYSTORE_PASSWORD=$|KEYSTORE_PASSWORD='$(openssl rand -base64 32)'|" /home/monad/.env
source /home/monad/.env
mkdir -p /opt/monad/backup/
echo "Keystore password: ${KEYSTORE_PASSWORD}" > /opt/monad/backup/keystore-password-backup
```
### Generate Keystores
Generate encrypted BLS and SECP keys using `monad-keystore` binary.
```bash theme={null}
bash <<'EOF'
set -e
source /home/monad/.env
if [[ -z "$KEYSTORE_PASSWORD" || \
-f /home/monad/monad-bft/config/id-secp || \
-f /home/monad/monad-bft/config/id-bls ]]; then
echo "Skipping: missing KEYSTORE_PASSWORD or keys already exist."
exit 1
fi
monad-keystore create \
--key-type secp \
--keystore-path /home/monad/monad-bft/config/id-secp \
--password "${KEYSTORE_PASSWORD}" > /opt/monad/backup/secp-backup
monad-keystore create \
--key-type bls \
--keystore-path /home/monad/monad-bft/config/id-bls \
--password "${KEYSTORE_PASSWORD}" > /opt/monad/backup/bls-backup
grep "public key" /opt/monad/backup/secp-backup /opt/monad/b프로젝트로 돌아가기