bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 23쪽 중 7쪽
nning. Never commit private keys, generated identities, or node databases to version control.
## Network Role
Gravity L1 separates node traffic into validator, VFN, and public networks. A PFN uses the public network and syncs outward from upstream infrastructure:
```
validators --VFN net--> VFN --public net--> PFN / RPC --> app or indexer
```
Use a PFN when you want:
* a private or high-throughput JSON-RPC endpoint on testnet;
* a node close to your backend or indexer;
* independent chain data for analytics or monitoring;
* no validator-set or governance operations.
## Prerequisites
1. **A Linux x86-64 host.** Production-like nodes are built and run on Ubuntu 24.04 LTS. Build on the same OS family that you deploy to.
2. **`gravity_node` and `gravity_cli`.** Build from source:
```bash
git clone https://github.com/Galxe/gravity-sdk.git
cd gravity-sdk
git checkout v1.10.0-pre
RUSTFLAGS="--cfg tokio_unstable" \
cargo build --profile quick-release -p gravity_node -p gravity_cli
```
The binaries land in `target/quick-release/`. You can also download the [v1.10.0-pre release](https://github.com/Galxe/gravity-sdk/releases/tag/v1.10.0-pre) assets (`gravity_node`, `gravity_cli`). For `gravity_cli` command usage, see the [Gravity CLI Skill](https://github.com/Galxe/gravity-sdk/blob/main/.agents/skills/gravity-cli/SKILL.md).
3. **Testnet `genesis.json` and `waypoint.txt`.** These artifacts pin the exact chain you are joining. Download the canonical files from [`gravity-sdk/genesis/testnet`](https://github.com/Galxe/gravity-sdk/tree/main/genesis/testnet); do not regenerate genesis locally for the public testnet.
4. **An upstream public-network seed.** For the seed you need its `peer_id`, host, public port, and `network_public_key`. The current public testnet PFN seed is listed below.
5. **SSD/NVMe storage.** Chain data grows with uptime. Budget well above the current chain size.
## 1. Prepare Genesis Artifacts
Place the canonical testnet artifacts where your cluster config references them:
```bash
mkdir -p <YOUR_GRAVITY_SDK_PATH>/cluster/output
curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/testnet/genesis.json \
-o <YOUR_GRAVITY_SDK_PATH>/cluster/output/genesis.json
curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/testnet/waypoint.txt \
-o <YOUR_GRAVITY_SDK_PATH>/cluster/output/waypoint.txt
```
```
<YOUR_GRAVITY_SDK_PATH>/cluster/output/genesis.json
<YOUR_GRAVITY_SDK_PATH>/cluster/output/waypoint.txt
```
If the artifacts live elsewhere, you can point to absolute paths in `genesis_source`:
```toml
[genesis_source]
genesis_path = "<YOUR_TESTNET_ARTIFACT_DIR>/genesis.json"
waypoint_path = "<YOUR_TESTNET_ARTIFACT_DIR>/waypoint.txt"
```
The `genesis.json` and `waypoint.txt` must match each other. A wrong pair can start a node on a different chain identity and prevent it from syncing testnet.
Confirm the downloaded genesis includes the live hardfork fields (`pragueTime`, `alphaTime`, `betaTime`, `osakaTime`, `gammaTime`). See [Longevity Testnet Hardforks](/gravity-networks/testnet-hardforks).
## 2. Gather Seed Information
### Current Testnet PFN Connectivity
| Node | Host | JSON-RPC endpoint | Public-network seed port | Peer ID | Network public key |
| ------------------- | ------------------------------- | --------------------------------- | ------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `testnet-rpc-p2p-1` | `testnet-rpc-p2p-1.gravity.xyz` | `https://testnet-rpc.gravity.xyz` | `6195` | `e7ddaced105af1c4381ca670cea01b0a8e3006c7e360a4f4e40e79fe06c29433` | `86d3bd6c81fb6994bdbe8df40da28acf44433138cb09ad491c4d98637abd817a` |
For normal JSON-RPC traffic, prefer the aggregate endpoint:
```
https://testnet-rpc.gravity.xyz
```
Before using the PFN host as an upstream seed, verify from your node host that the public-network port is reachable:
```bash
nc -vz testnet-rpc-p2p-1.gravity.xyz 6195
```
Use the current public testnet PFN seed directly in `local-pfn.toml`.
```toml
seeds = [
{ peer_id = "e7ddaced105af1c4381ca670cea01b0a8e3006c7e360a4f4e40e79fe06c29433", role = "PreferredUpstream", address = "/dns/testnet-rpc-p2p-1.gravity.xyz/tcp/6195/noise-ik/86d3bd6c81fb6994bdbe8df40da28acf44433138cb09ad491c4d98637abd817a/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.
public_port = 6195
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 = "e7ddaced105af1c4381ca670cea01b0a8e3006c7e360a4f4e40e79fe06c29433", role = "PreferredUpstream", address = "/dns/testnet-rpc-p2p-1.gravity.xyz/tcp/6195/noise-ik/86d3bd6c81fb6994bdbe8df40da28acf44433138cb09ad491c4d98637abd817a/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-like PFN/RPC nodes.
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-like environments, 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 testnet.
### Option A: Download the Public Testnet Data Snapshot
Gravity publishes a public Longevity Testnet 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-testnet-data/latest.tar" \
-o /tmp/gravity-testnet-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-testnet-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
Confirm that your local node is on the testnet chain:
```bash
curl -s http://127.0.0.1:8545 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
```
The expected result is `0x7695e9`, which is decimal `7771625`.
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://testnet-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`. |
| `eth_chainId` is not `0x7695e9` | The node is not using the canonical testnet genesis or RPC target. Re-check `genesis_source` and the public RPC URL. |
| `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
* [Gravity Longevity Testnet (L1)](/gravity-networks/l1-longevity-testnet)
* [Gravity Longevity Testnet Hardforks](/gravity-networks/testnet-hardforks)
* [Run a Gravity Testnet Public Full Node With Docker](/gravity-networks/run-a-testnet-pfn-with-docker)
* [Run a Gravity Mainnet Public Full Node](/gravity-networks/run-a-mainnet-pfn)
* [Node Providers](/ecosystem-infrastructures/node-providers)
# Run a Gravity Testnet Public Full Node With Docker
Run a Gravity Longevity Testnet (L1) Public Full Node with Docker. Covers image preparation, testnet artifacts, PFN identity generation, pruning, startup, sync checks, and operational cleanup.
This guide walks you through running a Gravity Longevity Testnet 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.
Gravity Longevity Testnet is an L1 network with Chain ID `7771625`. A PFN does **not** participate in consensus, does **not** hold validator stake, and does **not** require validator invite access. If you only need occasional testnet reads or writes, you can use the public endpoint at <https://testnet-rpc.gravity.xyz> instead.
{% hint style="warning" %}
**Required version.** Longevity Testnet nodes must run [v1.10.0-pre](https://github.com/Galxe/gravity-sdk/releases/tag/v1.10.0-pre) (or newer) to follow the live tip after Gamma. See [Gravity Longevity Testnet Hardforks](/gravity-networks/testnet-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-like 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.10.0-pre
```
4. **Testnet `genesis.json` and `waypoint.txt`.** These artifacts pin the exact chain you are joining. Download the canonical files from [`gravity-sdk/genesis/testnet`](https://github.com/Galxe/gravity-sdk/tree/main/genesis/testnet).
5. **An upstream public-network seed.** The current public testnet PFN seed is 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.10.0-pre
```
To build from source instead, check out `v1.10.0-pre` and tag the image `ghcr.io/galxe/gravity_node:v1.10.0-pre` so the `.env` values below still match:
```bash
DOCKER_BUILDKIT=1 docker build --network=host \
-f docker/gravity_node/Dockerfile \
-t ghcr.io/galxe/gravity_node:v1.10.0-pre \
--build-arg CARGO_PROFILE=release \
.
```
## 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.10.0-pre
RUST_LOG=info
```
The container reads node config from `./config` and stores chain data in Docker volumes.
## 3. Prepare Testnet Artifacts
From `docker/gravity_node`:
```bash
mkdir -p ../../cluster/output
curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/testnet/genesis.json \
-o ../../cluster/output/genesis.json
curl -fsSL https://raw.githubusercontent.com/Galxe/gravity-sdk/main/genesis/testnet/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
Use the public testnet PFN host as the upstream seed.
| Node | Host | JSON-RPC endpoint | Public-network seed port | Peer ID | Network public key |
| ------------------- | ------------------------------- | --------------------------------- | ------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| `testnet-rpc-p2p-1` | `testnet-rpc-p2p-1.gravity.xyz` | `https://testnet-rpc.gravity.xyz` | `6195` | `e7ddaced105af1c4381ca670cea01b0a8e3006c7e360a4f4e40e79fe06c29433` | `86d3bd6c81fb6994bdbe8df40da28acf44433138cb09ad491c4d98637abd817a` |
Before using the seed, verify from your node host that the public-network port is reachable:
```bash
nc -vz testnet-rpc-p2p-1.gravity.xyz 6195
```
Use the current public testnet PFN seed when rendering `PFN_SEEDS_BLOCK` in the Docker config section below:
```toml
seeds = [
{ peer_id = "e7ddaced105af1c4381ca670cea01b0a8e3006c7e360a4f4e40e79fe06c29433", role = "PreferredUpstream", address = "/dns/testnet-rpc-p2p-1.gravity.xyz/tcp/6195/noise-ik/86d3bd6c81fb6994bdbe8df40da28acf44433138cb09ad491c4d98637abd817a/handshake/0" },
]
```
For normal JSON-RPC traffic, use the aggregate public RPC endpoint:
```
https://testnet-rpc.gravity.xyz
```
## 5. Generate a PFN Identity
Create a minimal cluster config file for identity generation, for example `cluster/local-testnet-pfn-docker.toml`:
```toml
[cluster]
name = "<YOUR_TESTNET_PFN_CLUSTER_NAME>"
[[nodes]]
id = "local-testnet-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-testnet-pfn-docker.toml
cd ../docker/gravity_node
cp ../../cluster/output/local-testnet-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-testnet-pfn-docker
export HOST=127.0.0.1
export PUBLIC_PORT=26195
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_IDEN프로젝트로 돌아가기