Gravity 백서

Gravity

원문

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

formation ### Current Mainnet PFN Connectivity At the moment, public internet access is intended for the mainnet RPC/PFN fleet. Other validator and VFN hosts should be treated as private/internal unless the Gravity team explicitly shares invite-only seed information. Public full-node (PFN) operators should dial **direct per-node p2p DNS** on port `6180`. Each seed entry must use that node's own `peer_id` and `network_public_key`. Do not point a noise-ik multiaddr at a load-balanced VIP: the peer identity is per-node and will not match an arbitrary backend. | Node | Host | JSON-RPC | Public-network seed port | Peer ID | Network public key | | ------- | ------------------------------- | -------- | ------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `rpc-1` | `mainnet-rpc-p2p-1.gravity.xyz` | `8545` | `6180` | `38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077` | `234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f` | | `rpc-3` | `mainnet-rpc-p2p-3.gravity.xyz` | `8545` | `6180` | `2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4` | `0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365` | `rpc-2` is internal-only (no public p2p address). It is not a published seed for external PFN operators. For normal JSON-RPC traffic, prefer the aggregate endpoint: ``` https://mainnet-rpc.gravity.xyz ``` Before using a PFN host as an upstream seed, verify from your node host that the public-network port is reachable: ```bash nc -vz mainnet-rpc-p2p-1.gravity.xyz 6180 nc -vz mainnet-rpc-p2p-3.gravity.xyz 6180 ``` Validator and VFN joining is currently invite-only for Gravity-operated mainnet seeds. A PFN does not need validator access, but it still needs a reachable public-network upstream seed plus that seed's public identity values. Use the current public PFN seeds directly in `local-pfn.toml`. Configure both entries for redundancy; either seed alone is enough to sync if the other is temporarily unreachable. ```toml seeds = [ { peer_id = "38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-1.gravity.xyz/tcp/6180/noise-ik/234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f/handshake/0" }, { peer_id = "2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-3.gravity.xyz/tcp/6180/noise-ik/0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365/handshake/0" }, ] ``` For an explicit PFN seed, fill these values from the upstream node's public identity: | Value | Meaning | | ------------------------------------ | ------------------------------------------------------- | | `<YOUR_UPSTREAM_PEER_ID>` | Upstream sidecar `account_address`. | | `<YOUR_UPSTREAM_HOST>` | DNS name or IP address of the upstream public listener. | | `<YOUR_UPSTREAM_PUBLIC_PORT>` | Public-network port exposed by the upstream node. | | `<YOUR_UPSTREAM_NETWORK_PUBLIC_KEY>` | Upstream sidecar `network_public_key`. | Prefer explicit seed entries over `seeds = [{ from = "<id>" }]` for a standalone PFN config. The `{ from = ... }` form only works when the seed node is also defined in the same TOML file. ## 3. Write `local-pfn.toml` Create a config such as: ```toml [cluster] name = "<YOUR_PFN_CLUSTER_NAME>" base_dir = "<YOUR_DEPLOY_BASE_DIR>" [genesis_source] genesis_path = "./output/genesis.json" waypoint_path = "./output/waypoint.txt" [[nodes]] id = "local-pfn" role = "pfn" source = { bin_path = "../target/quick-release/gravity_node" } identity = { source = "file" } # Deploy directory, not the database directory. # deploy.sh renders storage to <YOUR_DEPLOY_BASE_DIR>/local-pfn/data # and reth to <YOUR_DEPLOY_BASE_DIR>/local-pfn/data/reth. data_dir = "<YOUR_DEPLOY_BASE_DIR>/local-pfn" host = "127.0.0.1" # Example local public-network port for this PFN. If other nodes should sync # from this node, expose and publish the chosen public listener; PFN/VFN public # listeners commonly use 6195. public_port = 6180 rpc_port = 8545 metrics_port = 9001 inspection_port = 10001 authrpc_port = 8661 reth_p2p_port = 12024 txpool_max_account_slots = 64 prune_transactionlookup_distance = 10064 seeds = [ { peer_id = "38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-1.gravity.xyz/tcp/6180/noise-ik/234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f/handshake/0" }, { peer_id = "2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-3.gravity.xyz/tcp/6180/noise-ik/0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365/handshake/0" }, ] ``` Port choices can be changed if you run multiple nodes on one host. Keep the RPC port private unless you intentionally expose it behind your own gateway, authentication, rate limiting, and monitoring. `prune_transactionlookup_distance = 10064` starts reth with `--full --prune.transactionlookup.distance 10064`. This keeps recent transaction-hash lookup data while allowing older transaction lookup indexes to be pruned. Use a value **greater than or equal to `10064`** for production PFN/RPC nodes. Treat smaller values, such as short test-only distances, as invalid for mainnet PFN configs and reject them during config review. Use transaction-lookup pruning when you want lower execution database growth and do not need arbitrary old `eth_getTransactionByHash` lookups from this node. If you omit `prune_transactionlookup_distance`, the generated PFN reth config uses archive-style storage for transaction lookups and keeps historical lookup indexes instead of pruning them. That is simpler for indexers or debugging flows that need old transaction hashes, but it uses more disk over time. Do not set `prune_transactionlookup_distance = 0` to disable pruning. A distance of `0` is still a pruning mode and can prune transaction lookup data aggressively. To run without transaction-lookup pruning, leave the field out. The example above generates and stores identity files locally. In production, you can also load the node identity from a secret manager. For example: ```toml identity = { source = "gcp_secret", secret = "projects/<YOUR_PROJECT>/secrets/<YOUR_PFN_IDENTITY_SECRET>/versions/1", } ``` Pin a fixed secret version instead of `latest` when you want reproducible deployments and safer rollbacks. ## 4. Generate Identity and Deploy From the SDK cluster directory: ```bash cd <YOUR_GRAVITY_SDK_PATH>/cluster just init local-pfn.toml just deploy local-pfn.toml ``` Expected layout: ``` <YOUR_DEPLOY_BASE_DIR>/local-pfn/config/ <YOUR_DEPLOY_BASE_DIR>/local-pfn/data/ <YOUR_DEPLOY_BASE_DIR>/local-pfn/script/start.sh <YOUR_DEPLOY_BASE_DIR>/local-pfn/script/stop.sh ``` If the package is generated on a build host, copy it to the runtime host while preserving the node directory layout. ## 5. Optional: Warm Start From a Snapshot or Existing Node A new PFN can sync from genesis, but that may take a long time on an established chain. ### Option A: Download the Public Mainnet Data Snapshot Gravity publishes a public mainnet PFN data snapshot at a stable URL. Download the current `latest` cut to your node host (the file is large; resume is supported): ```bash curl -L --fail --continue-at - \ "https://gravity-snapshots.b-cdn.net/gravity-mainnet-data/latest.tar" \ -o /tmp/gravity-mainnet-latest.tar ``` The snapshot is a point-in-time cut. After start, the node syncs forward to the chain tip. Before the first start, replace the generated empty data directory with the snapshot data: ```bash tar -xf /tmp/gravity-mainnet-latest.tar \ -C <YOUR_DEPLOY_BASE_DIR>/local-pfn/data ``` After extraction, the data directory should contain the snapshot databases while preserving the node directory layout: ``` <YOUR_DEPLOY_BASE_DIR>/local-pfn/data/consensus_db/ <YOUR_DEPLOY_BASE_DIR>/local-pfn/data/quorumstoreDB/ <YOUR_DEPLOY_BASE_DIR>/local-pfn/data/reth/ ``` ### Option B: Copy From an Existing Node You Control If you already run a trusted RPC/PFN, you can copy only the chain databases from that node: ```bash cd <YOUR_EXISTING_NODE_DATA_DIR> tar -cf - consensus_db quorumstoreDB reth | \ ssh <YOUR_TARGET_HOST> \ "mkdir -p <YOUR_DEPLOY_BASE_DIR>/local-pfn/data && \ cd <YOUR_DEPLOY_BASE_DIR>/local-pfn/data && tar -xf -" ``` Do **not** copy `rand_db` or `secure_storage.json` from another node. Those files carry node-specific randomness or safety state and should not be reused. ## 6. Start the Node ```bash bash <YOUR_DEPLOY_BASE_DIR>/local-pfn/script/start.sh ``` Check the logs under the node directory: ```bash tail -n 200 <YOUR_DEPLOY_BASE_DIR>/local-pfn/consensus_log/pfn.log ls -lh <YOUR_DEPLOY_BASE_DIR>/local-pfn/execution_logs ``` ## 7. Verify Sync Query your local node: ```bash curl -s http://127.0.0.1:8545 \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ``` Compare it with the public chain head: ```bash curl -s https://mainnet-rpc.gravity.xyz \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ``` When the two heights are close and your local height keeps advancing, the node is caught up. Gravity has BFT-final blocks: once a block is returned by your node, there is no EVM-style reorg to wait for. ## Troubleshooting | Symptom | Cause / fix | | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `seeds: from=<id>: missing host or public_port in cluster.toml` | Use an explicit `peer_id` / `address` seed, or define the seed node in the same TOML. | | Node stays at a low height | Re-check seed `peer_id`, host, port, network public key, `genesis.json`, and `waypoint.txt`. | | Height only advances right after each epoch change and stays about one epoch behind | Another node is likely using the same `identity.yaml`. See [Sharing One Network Identity Across Nodes](/gravity-networks/node-operation-anti-patterns#sharing-one-network-identity-across-nodes). | | `net_peerCount` returns `0` | Usually expected. Gravity syncs through AptosBFT/VFN/public networks, not EVM devp2p gossip. Watch block height instead. | | RPC unavailable | Confirm `rpc_port` is free, the process is running, and logs exist under the deploy directory. | | Database paths look nested incorrectly | `data_dir` should be the deploy directory. Storage is rendered to `$data_dir/data`. | ## See Also * [Run a Gravity Mainnet VFN](/gravity-networks/run-a-mainnet-vfn) * [Run a Gravity Mainnet Validator](/gravity-networks/run-a-mainnet-validator) * [Gravity Mainnet (L1)](/gravity-networks/l1-mainnet) * [Node Providers](/ecosystem-infrastructures/node-providers) # Run a Gravity Mainnet Public Full Node With Docker Run a Gravity Mainnet (L1) Public Full Node with Docker. Covers image preparation, mainnet artifacts, PFN identity generation, pruning, startup, sync checks, and operational cleanup. This guide walks you through running a Gravity Mainnet Public Full Node (PFN) with the `gravity_node` Docker image. A PFN syncs from an upstream public-network seed and can serve EVM JSON-RPC for applications, indexers, or internal services. A PFN does **not** participate in consensus, does **not** hold validator stake, and does **not** require validator invite access. {% hint style="warning" %} **Required version.** Mainnet nodes must run [v1.9.1](https://github.com/Galxe/gravity-sdk/releases/tag/v1.9.1) before **2026-08-18 02:00:00 UTC**. See [Gravity Mainnet Hardforks](/gravity-networks/mainnet-hardforks). {% endhint %} > **Placeholders.** Commands below use `<YOUR_...>` placeholders. Replace each value before running. Never commit generated identities, private keys, `.env` files, rendered node config, logs, or node databases to version control. ## Prerequisites 1. **Docker and Docker Compose v2.** Production nodes should run on Linux. Docker Desktop on macOS is useful for local validation, but it handles host networking differently from Linux. 2. **Local command-line tools.** Install `just`, `envsubst` from GNU gettext, `jq`, `curl`, `nc`, and `lsof`. 3. **The Gravity SDK repository.** The Docker image and config templates live in [`gravity-sdk`](https://github.com/Galxe/gravity-sdk). ```bash git clone https://github.com/Galxe/gravity-sdk.git cd gravity-sdk git checkout v1.9.1 ``` 4. **Mainnet `genesis.json` and `waypoint.txt`.** These artifacts pin the exact chain you are joining. Download the canonical files from [`gravity-sdk/genesis/mainnet`](https://github.com/Galxe/gravity-sdk/tree/main/genesis/mainnet). 5. **An upstream public-network seed.** The current public PFN seeds are shown below. 6. **SSD/NVMe storage.** Chain data grows with uptime. Budget well above the current chain size. ## 1. Pull the Docker Image ```bash docker pull ghcr.io/galxe/gravity_node:v1.9.1 ``` To build from source instead, check out `v1.9.1` and tag the image `ghcr.io/galxe/gravity_node:v1.9.1` so the `.env` values below still match. ## 2. Prepare the Docker Workspace ```bash cd docker/gravity_node cp .env.example .env mkdir -p config ``` Edit `.env`: ```dotenv GRAVITY_IMAGE=ghcr.io/galxe/gravity_node IMAGE_TAG=v1.9.1 RUST_LOG=info ``` The container reads node config from `./config` and stores chain data in Docker volumes. ## 3. Prepare Mainnet Artifacts From `docker/gravity_node`: ```bash mkdir -p ../../cluster/output curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/genesis.json \ -o ../../cluster/output/genesis.json curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/waypoint.txt \ -o ../../cluster/output/waypoint.txt ``` Copy these artifacts into the Docker config directory: ```bash cp ../../cluster/output/genesis.json config/genesis.json cp ../../cluster/output/waypoint.txt config/waypoint.txt ``` ## 4. Gather Seed Information At the moment, public internet access is intended for the mainnet RPC/PFN fleet. Other validator and VFN hosts should be treated as private/internal unless the Gravity team explicitly shares invite-only seed information. Public full-node (PFN) operators should dial **direct per-node p2p DNS** on port `6180`. Each seed entry must use that node's own `peer_id` and `network_public_key`. Do not point a noise-ik multiaddr at a load-balanced VIP: the peer identity is per-node and will not match an arbitrary backend. | Node | Host | Public-network seed port | Peer ID | Network public key | | ------- | ------------------------------- | ------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `rpc-1` | `mainnet-rpc-p2p-1.gravity.xyz` | `6180` | `38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077` | `234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f` | | `rpc-3` | `mainnet-rpc-p2p-3.gravity.xyz` | `6180` | `2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4` | `0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365` | `rpc-2` is internal-only (no public p2p address). It is not a published seed for external PFN operators. Before using the seeds, verify from your node host that the public-network ports are reachable: ```bash nc -vz mainnet-rpc-p2p-1.gravity.xyz 6180 nc -vz mainnet-rpc-p2p-3.gravity.xyz 6180 ``` Use the current public PFN seeds when rendering `PFN_SEEDS_BLOCK` in the Docker config section below. Configure both entries for redundancy; either seed alone is enough to sync if the other is temporarily unreachable. ```toml seeds = [ { peer_id = "38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-1.gravity.xyz/tcp/6180/noise-ik/234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f/handshake/0" }, { peer_id = "2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4", role = "PreferredUpstream", address = "/dns/mainnet-rpc-p2p-3.gravity.xyz/tcp/6180/noise-ik/0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365/handshake/0" }, ] ``` ## 5. Generate a PFN Identity Create a minimal cluster config file for identity generation, for example `cluster/local-pfn-docker.toml`: ```toml [cluster] name = "<YOUR_PFN_CLUSTER_NAME>" [[nodes]] id = "local-pfn-docker" role = "pfn" identity = { source = "file" } ``` The Docker flow uses this TOML only to generate node identity material. It does not read ports, seeds, `base_dir`, or `data_dir` from the TOML during container startup. Docker runtime storage is controlled by the volume or bind mount in the start command, and by the container paths rendered in the next section. Generate the PFN identity: ```bash cd ../../cluster just init local-pfn-docker.toml cd ../docker/gravity_node cp ../../cluster/output/local-pfn-docker/config/identity.yaml config/identity.yaml ``` The generated `identity.yaml` contains private node identity material. Keep it on the runtime host only. ## 6. Render Container Config The container sees config at `/gravity/config` and data at `/gravity/data`, so the rendered files must use container paths, not host paths. `DATA_DIR`, `STORAGE_DIR`, and `LOG_DIR` are intentionally separate: ``` /gravity/data/ # Docker data volume root └── data/ # STORAGE_DIR, chain databases ├── consensus_db/ ├── quorumstoreDB/ └── reth/ /gravity/logs/ # Docker logs volume root ├── consensus_log/ └── execution_logs/ ``` To place data on a specific host disk, mount that host path to `/gravity/data`. To place logs on a specific host disk, mount that host path to `/gravity/logs`. Do not change the TOML `data_dir` for Docker runtime storage. From `docker/gravity_node`: ```bash export NODE_ID=local-pfn-docker export HOST=127.0.0.1 export PUBLIC_PORT=26180 export RPC_PORT=28545 export METRICS_PORT=29001 export INSPECTION_PORT=30001 export AUTHRPC_PORT=28661 export P2P_PORT_RETH=32024 export TXPOOL_MAX_ACCOUNT_SLOTS=64 export PRUNE_TRANSACTIONLOOKUP_DISTANCE=10064 export CONFIG_DIR=/gravity/config export DATA_DIR=/gravity/data export STORAGE_DIR=/gravity/data/data export LOG_DIR=/gravity/logs export GENESIS_PATH=/gravity/config/genesis.json export RPC_HTTP_CORSDOMAIN='*' export RPC_HTTP_API='debug,eth,net,trace,txpool,web3,rpc' export NETWORK_IDENTITY_TYPE=from_file export NETWORK_IDENTITY_FIELD=path export NETWORK_IDENTITY_VALUE=/gravity/config/identity.yaml export SAFETY_RULES_IDENTITY_VARIANT=from_file export SAFETY_RULES_IDENTITY_KEY=identity_blob_path export SAFETY_RULES_IDENTITY_VALUE=/gravity/config/identity.yaml export DISCOVERY_METHOD_FULLNODE_BLOCK='' export PFN_SEEDS_BLOCK=' seeds: "0x38013b46c21388c3fd08ab32b86b478b3109125566d63c2da8fdc941dc474077": addresses: - "/dns/mainnet-rpc-p2p-1.gravity.xyz/tcp/6180/noise-ik/234aee14677a3d2198208ea72ca5e95ed75520df27f01f0c36220303ff78642f/handshake/0" role: PreferredUpstream "0x2d30cf69303d40e0efcdb0f3a6545d43b055e86729287f2f1328c001caeb2be4": addresses: - "/dns/mainnet-rpc-p2p-3.gravity.xyz/tcp/6180/noise-ik/0a71ef75482f617203f64b0d5e9e3a66361b5f35e9d709ef873c494cd76d2365/handshake/0" role: PreferredUpstream' envsubst < ../../cluster/templates/public_full_node.yaml.tpl \ > config/public_full_node.yaml envsubst < ../../cluster/templates/reth_config_pfn_prune.json.tpl \ > config/reth_config.json ``` If you do not want transaction-lookup pruning, do not set `PRUNE_TRANSACTIONLOOKUP_DISTANCE`, and render `reth_config.json` from the non-prune template instead: ```bash
프로젝트로 돌아가기