Gravity 백서

Gravity

원문

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

envsubst < ../../cluster/templates/reth_config_pfn.json.tpl \ > config/reth_config.json ``` Verify the rendered config: ```bash jq . config/reth_config.json >/dev/null grep -n 'public_full_node.yaml\|prune.transactionlookup.distance\|gravity/config\|gravity/data' \ config/reth_config.json grep -n 'PreferredUpstream\|mainnet-rpc-p2p-1.gravity.xyz\|mainnet-rpc-p2p-3.gravity.xyz\|/gravity/config/identity.yaml' \ config/public_full_node.yaml ``` Expected `reth_config.json` behavior: * `chain` points to `/gravity/config/genesis.json`; * `gravity_node_config` points to `/gravity/config/public_full_node.yaml`; * `datadir` points to `/gravity/data/data/reth`; * `log.file.directory` points to `/gravity/logs/execution_logs/`; * when pruning is enabled, `prune.transactionlookup.distance` is `10064`. ## 7. Pruning Mode `prune_transactionlookup_distance = 10064` starts reth with transaction-lookup pruning enabled. This keeps recent transaction-hash lookup data while allowing older lookup indexes to be pruned. Use a value **greater than or equal to `10064`** for production PFN/RPC nodes. Treat smaller values as test-only and reject them during config review. Use this pruning mode 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 transaction lookup behavior 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. ## 8. Optional: Warm Start From a Snapshot or Existing Node A new Docker PFN can sync from genesis, but that may take a long time on an established chain. To warm start, load the snapshot into the Docker data volume **before the first node start**. If the Docker PFN has already started once, stop the container and remove the old data volume before importing a snapshot. Do not merge snapshot files into an already-initialized database. The Docker container mounts its data volume at `/gravity/data`. The chain databases must live under `/gravity/data/data`, so extract snapshot contents into that `data` subdirectory. ### 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. The snapshot tar contains database directories such as `consensus_db/`, `quorumstoreDB/`, and `reth/` at the archive root. It does not contain an outer `data/` directory. For the Linux compose flow, load the snapshot into the compose data volume: ```bash docker compose run --rm --no-deps \ --user root \ --entrypoint sh \ -v /tmp:/snapshot:ro \ gravity_node \ -lc 'mkdir -p /gravity/data/data && \ tar -xf /snapshot/gravity-mainnet-latest.tar -C /gravity/data/data && \ chown -R 10001:10001 /gravity/data /gravity/logs' ``` For the macOS `docker run` flow, load the snapshot into the explicit named volume used by the start command below: ```bash set -a . ./.env set +a docker volume create gravity_node_local_pfn_data docker run --rm \ --user root \ --entrypoint sh \ -v gravity_node_local_pfn_data:/gravity/data \ -v gravity_node_local_pfn_logs:/gravity/logs \ -v /tmp:/snapshot:ro \ ${GRAVITY_IMAGE}:${IMAGE_TAG} \ -lc 'mkdir -p /gravity/data/data && \ tar -xf /snapshot/gravity-mainnet-latest.tar -C /gravity/data/data && \ chown -R 10001:10001 /gravity/data /gravity/logs' ``` After extraction, the Docker data volume should contain: ``` /gravity/data/data/consensus_db/ /gravity/data/data/quorumstoreDB/ /gravity/data/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 /tmp/pfn-data.tar consensus_db quorumstoreDB reth ``` Then load `/tmp/pfn-data.tar` into the Docker data volume with the same compose or `docker run` extraction pattern above. Mount `/tmp` as `/snapshot` and replace the extraction command with: ```bash tar -xf /snapshot/pfn-data.tar -C /gravity/data/data ``` 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. ## 9. Start the PFN Make sure the selected host ports are free: ```bash lsof -nP -iTCP:26180 -iTCP:28545 -iTCP:29001 -iTCP:30001 -iTCP:28661 -iTCP:32024 ``` On Linux, use Docker Compose: ```bash docker compose up -d docker ps --filter name=gravity_node ``` The compose file uses `network_mode: host` because p2p ports need predictable advertised addresses. On Docker Desktop for macOS, host networking behaves differently. For local validation from the macOS host, use explicit port publishing: ```bash docker rm -f gravity_node 2>/dev/null || true set -a . ./.env set +a docker run -d --name gravity_node --restart unless-stopped \ -p 26180:26180 \ -p 28545:28545 \ -p 29001:29001 \ -p 30001:30001 \ -p 28661:28661 \ -p 32024:32024 \ -v "$(pwd)/config:/gravity/config:ro" \ -v gravity_node_local_pfn_data:/gravity/data \ -v gravity_node_local_pfn_logs:/gravity/logs \ -e RUST_BACKTRACE=1 \ -e RUST_LOG=info \ --ulimit nofile=1048576:1048576 \ ${GRAVITY_IMAGE}:${IMAGE_TAG} ``` ## 10. Verify Sync Query the local Docker PFN: ```bash curl -s --noproxy '*' http://127.0.0.1:28545 \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq -r .result ``` Compare with the public RPC: ```bash curl -s --noproxy '*' https://mainnet-rpc.gravity.xyz \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq -r .result ``` Follow logs: ```bash docker logs gravity_node -f docker exec gravity_node sh -lc \ 'tail -n 200 /gravity/logs/execution_logs/*/reth.log' docker exec gravity_node sh -lc \ 'tail -n 200 /gravity/logs/consensus_log/vfn.log' ``` Confirm the prune config was accepted: ```bash docker exec gravity_node sh -lc \ 'grep -R "Pruner initialized\\|prune_config\\|transaction_lookup" /gravity/logs/execution_logs || true' ``` ## 11. Stop, Restart, or Reset For the Linux compose flow, stop the container but keep chain data: ```bash docker compose down ``` Restart: ```bash docker compose up -d ``` Delete the local PFN database and start from zero again: ```bash docker compose down -v ``` For the macOS `docker run` flow, stop the container but keep chain data: ```bash docker rm -f gravity_node ``` Delete the local PFN database and start from zero again: ```bash docker rm -f gravity_node docker volume rm gravity_node_local_pfn_data gravity_node_local_pfn_logs ``` Only remove Docker volumes when you intentionally want to delete the node database. ## Files to Keep Out of Version Control Do not commit generated runtime files: * `docker/gravity_node/.env`; * `docker/gravity_node/config/*`; * `cluster/output/<YOUR_NODE_ID>/config/identity.yaml`; * Docker volumes such as `gravity-data`, `gravity-logs`, `gravity_node_local_pfn_data`, and `gravity_node_local_pfn_logs`; * node databases and logs. The reusable materials are the public guide and SDK templates. Each operator should generate their own identity and runtime config. # Run a Gravity Mainnet VFN Run a Gravity Mainnet (L1) Validator Full Node. Covers validator VFN-network seeds, deployment, optional public listener, database warm start, and sync verification. This guide walks you through running a Validator Full Node (VFN) on Gravity Mainnet (L1, Chain ID `127001`). A VFN dials one or more validators on the VFN network and can expose a public listener for downstream PFNs. A VFN is **not** part of the validator set and does not need validator stake. Access depends on which validator seed you connect to: * Connecting to Gravity mainnet genesis validator seeds is currently **invite-only**. You need approved validator VFN-network seed information. * Connecting to validators that you deploy and operate yourself does not require a Gravity mainnet invite. {% 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 reuse another node's private identity or safety storage. ## Network Role Gravity traffic flows outward from validators to VFNs, then to PFNs: ``` validators --VFN net--> VFN --public net--> PFN / RPC ``` Use a VFN when you want: * a full node close to a validator or validator operator; * a relay point for one or more PFNs; * a node that follows validator-network data without joining consensus. ## Prerequisites 1. **A Linux x86-64 host**, preferably Ubuntu 24.04 LTS. 2. **`gravity_node` and `gravity_cli`.** ```bash git clone https://github.com/Galxe/gravity-sdk.git cd gravity-sdk git checkout v1.9.1 RUSTFLAGS="--cfg tokio_unstable" \ cargo build --profile quick-release -p gravity_node -p gravity_cli ``` 3. **Mainnet `genesis.json` and `waypoint.txt`.** Use the canonical mainnet artifacts from [`gravity-sdk/genesis/mainnet`](https://github.com/Galxe/gravity-sdk/tree/main/genesis/mainnet); do not regenerate genesis locally. 4. **Validator VFN-network seed information.** Each validator seed needs `account_address`, host, `vfn_port`, and `network_public_key`. Genesis validator seeds require approval; self-operated validator seeds do not. 5. **SSD/NVMe storage** sized for current chain data plus growth. ## 1. Gather Validator Seed Information For each validator you will dial, collect its public identity values from `identity.public.yaml`: ```yaml account_address: <VALIDATOR_PEER_ID> network_public_key: <VALIDATOR_NETWORK_PUBLIC_KEY> ``` You also need the validator host and VFN-network port, commonly `6190`. In a standalone VFN config, prefer explicit seed entries: ```toml seeds = [ { peer_id = "<YOUR_VALIDATOR_1_ACCOUNT_ADDRESS>", role = "Validator", host = "<YOUR_VALIDATOR_1_HOST>", port = 6190, network_pk = "<YOUR_VALIDATOR_1_NETWORK_PUBLIC_KEY>" }, { peer_id = "<YOUR_VALIDATOR_2_ACCOUNT_ADDRESS>", role = "Validator", host = "<YOUR_VALIDATOR_2_HOST>", port = 6190, network_pk = "<YOUR_VALIDATOR_2_NETWORK_PUBLIC_KEY>" }, ] ``` Avoid `seeds = [{ from = "<id>" }]` unless the seed validator is also defined in the same TOML. The deploy script needs that validator's `host` and `vfn_port` from the same config. ## 2. Write `cluster-vfn.toml` Download the canonical mainnet artifacts where the config below expects them: ```bash mkdir -p <YOUR_GRAVITY_SDK_PATH>/cluster/output curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/genesis.json \ -o <YOUR_GRAVITY_SDK_PATH>/cluster/output/genesis.json curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/waypoint.txt \ -o <YOUR_GRAVITY_SDK_PATH>/cluster/output/waypoint.txt ``` Create a config such as: ```toml [cluster] name = "<YOUR_VFN_CLUSTER_NAME>" base_dir = "<YOUR_DEPLOY_BASE_DIR>" [genesis_source] genesis_path = "./output/genesis.json" waypoint_path = "./output/waypoint.txt" [relayer] relayer_rpc_url = "<YOUR_L1_RPC_URL>" [[nodes]] id = "vfn-1" role = "vfn" source = { bin_path = "../target/quick-release/gravity_node" } identity = { source = "file" } host = "<YOUR_VFN_HOST>" # Deploy directory, not the database directory. # deploy.sh renders storage to <YOUR_DEPLOY_BASE_DIR>/vfn-1/data # and reth to <YOUR_DEPLOY_BASE_DIR>/vfn-1/data/reth. data_dir = "<YOUR_DEPLOY_BASE_DIR>/vfn-1" vfn_port = 6190 public_port = 6195 rpc_port = 8545 metrics_port = 9001 inspection_port = 10001 https_port = 11001 authrpc_port = 8661 reth_p2p_port = 12024 discovery_method = "none" txpool_max_account_slots = 64 seeds = [ { peer_id = "<YOUR_VALIDATOR_1_ACCOUNT_ADDRESS>", role = "Validator", host = "<YOUR_VALIDATOR_1_HOST>", port = 6190, network_pk = "<YOUR_VALIDATOR_1_NETWORK_PUBLIC_KEY>" }, ] ``` `public_port` is optional but useful if PFNs should sync from this VFN. Keep RPC private unless you intentionally expose it behind your own gateway and access controls. If you load identity from a secret manager, pin a fixed version rather than `latest`: ```toml identity = { source = "gcp_secret", secret = "projects/<YOUR_PROJECT>/secrets/<YOUR_SECRET>/versions/1", } ``` ## 3. Generate Identity and Deploy ```bash cd <YOUR_GRAVITY_SDK_PATH>/cluster just init cluster-vfn.toml just deploy cluster-vfn.toml ``` Expected layout: ``` <YOUR_DEPLOY_BASE_DIR>/vfn-1/config/ <YOUR_DEPLOY_BASE_DIR>/vfn-1/data/ <YOUR_DEPLOY_BASE_DIR>/vfn-1/script/start.sh <YOUR_DEPLOY_BASE_DIR>/vfn-1/script/stop.sh ``` The public identity generated for the VFN is written to: ``` <YOUR_GRAVITY_SDK_PATH>/cluster/output/vfn-1/config/identity.public.yaml ``` If downstream PFNs will use this VFN as a seed, share the VFN sidecar `account_address`, `network_public_key`, host, and `public_port`. ## 4. Optional: Warm Start From an Existing Node To speed up initial sync, copy only chain databases from an existing RPC/PFN or VFN you control: ```bash cd <YOUR_EXISTING_NODE_DATA_DIR> tar -cf - consensus_db quorumstoreDB reth | \ ssh <YOUR_TARGET_HOST> \ "mkdir -p <YOUR_DEPLOY_BASE_DIR>/vfn-1/data && \ cd <YOUR_DEPLOY_BASE_DIR>/vfn-1/data && tar -xf -" ``` Do **not** copy `rand_db` or `secure_storage.json` from another node. `secure_storage.json` contains node-specific safety state and can make the node behave as if it belongs to a different identity. ## 5. Start and Verify ```bash bash <YOUR_DEPLOY_BASE_DIR>/vfn-1/script/start.sh ``` Check logs: ```bash tail -n 200 <YOUR_DEPLOY_BASE_DIR>/vfn-1/consensus_log/vfn.log ls -lh <YOUR_DEPLOY_BASE_DIR>/vfn-1/execution_logs ``` Check RPC height: ```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 with the public head: ```bash curl -s https://mainnet-rpc.gravity.xyz \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ``` ## Troubleshooting | Symptom | Cause / fix | | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | | `seeds: from=<id>: missing host or vfn_port in cluster.toml` | Use explicit seed entries, or define the seed validator in the same TOML. | | VFN does not advance | Verify validator seed `peer_id`, host, `vfn_port`, and `network_public_key`; also verify genesis and waypoint. | | Downstream PFNs cannot connect | Confirm `public_port` is open, reachable, and advertised with the VFN `network_public_key`. | | Paths render as `<node>/data/<node>` | `data_dir` should be the node deploy directory, not the final database directory. | | Identity-related errors after copying data | Remove any copied `secure_storage.json`; it must not be reused across nodes. | ## See Also * [Run a Gravity Mainnet Public Full Node](/gravity-networks/run-a-mainnet-pfn) * [Run a Gravity Mainnet Validator](/gravity-networks/run-a-mainnet-validator) * [Gravity Mainnet (L1)](/gravity-networks/l1-mainnet) # Run a Gravity Mainnet Validator (Invite Only) Run an invite-only Gravity Mainnet (L1) validator. Validator onboarding is currently invite-only. Covers validator node deployment, StakePool creation, governance whitelisting, validator join, status This guide walks approved operators through adding a validator to Gravity Mainnet (L1, Chain ID `127001`). A validator participates in AptosBFT consensus and must be backed by a StakePool that has been approved through governance. Validator onboarding is currently **invite-only**. If you only need a node for reads, writes, or indexing, run a [Public Full Node](/gravity-networks/run-a-mainnet-pfn) instead. {% 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 paste private keys into shared shells or commit generated node identities. ## Network Role Validators connect to each other on the validator network and optionally expose VFN-network endpoints for VFNs: ``` validator set --validator net--> consensus validator --VFN net--> VFN --public net--> PFN / RPC ``` The onboarding flow is: 1. Prepare validator config and identity. 2. Deploy the node package. 3. Fund the validator account. 4. Create a StakePool. 5. Add the StakePool to the validator whitelist through governance. 6. Join the validator set with the node's public identity. 7. Start the node and verify status. ## Prerequisites 1. **Approval from current governance / operators.** The StakePool must be whitelisted before it can join the validator set. 2. **A Linux x86-64 host**, preferably Ubuntu 24.04 LTS. 3. **`gravity_node` and `gravity_cli`.** ```bash git clone https://github.com/Galxe/gravity-sdk.git cd gravity-sdk git checkout v1.9.1 RUSTFLAGS="--cfg tokio_unstable" \ cargo build --profile quick-release -p gravity_node -p gravity_cli ``` 4. **Mainnet `genesis.json` and `waypoint.txt`.** Use the canonical mainnet artifacts from [`gravity-sdk/genesis/mainnet`](https://github.com/Galxe/gravity-sdk/tree/main/genesis/mainnet); do not regenerate genesis locally. 5. **A fresh validator EVM account.** This account owns and operates the StakePool. Do not reuse public test keys for a long-running validator. 6. **System contract addresses** for staking, validator management, and governance. See the mainnet contract reference for current addresses. ## 1. Write `cluster-validator.toml` Download the canonical mainnet artifacts where the config below expects them: ```bash mkdir -p <YOUR_GRAVITY_SDK_PATH>/cluster/output curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/genesis.json \ -o <YOUR_GRAVITY_SDK_PATH>/cluster/output/genesis.json curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/mainnet/waypoint.txt \ -o <YOUR_GRAVITY_SDK_PATH>/cluster/output/waypoint.txt ``` Create a config such as: ```toml [cluster] name = "<YOUR_VALIDATOR_CLUSTER_NAME>" base_dir = "<YOUR_DEPLOY_BASE_DIR>" [genesis_source] genesis_path = "./output/genesis.json" waypoint_path = "./output/waypoint.txt" [relayer] relayer_rpc_url = "<YOUR_L1_RPC_URL>" [[nodes]] id = "validator-1" role = "validator" source = { bin_path = "../target/quick-release/gravity_node" } identity = { source = "file" } host = "<YOUR_VALIDATOR_HOST>" # Deploy directory, not the database directory. # deploy.sh renders storage to <YOUR_DEPLOY_BASE_DIR>/validator-1/data # and reth to <YOUR_DEPLOY_BASE_DIR>/validator-1/data/reth. data_dir = "<YOUR_DEPLOY_BASE_DIR>/validator-1" validator_port = 6180 vfn_port = 6190 rpc_port = 8545 metrics_port = 9001 inspection_port = 10001 https_port = 11001 authrpc_port = 8661 reth_p2p_port = 12024 txpool_max_account_slots = 64 ``` If identity is stored in a secret manage
프로젝트로 돌아가기