Movement 백서

Movement

원문

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

nodes (i.e., peers) to connect to you. There are different Movement network types, and each network type uses a different port. However, the only network type that a PFN uses is the public network, where PFNs to connect to other PFNs and VFNs. Your PFN can be configured so that the public network operates using a specific port on your node. You can configure the port settings using the node configuration YAML file. Here is an [example configuration file](https://github.com/movement-network/aptos-core/blob/movement/config/src/config/test_data/public_full_node.yaml#L16) for a PFN that configures the public network to use port `6180`. ### Port settings The recommendations described below assume the default port settings used by PFNs. If you have changed the default port settings in your configuration file, then you should adjust the recommendations accordingly. <Callout type="warning"> **Exposing ports**<br /> Unless explicitly required, we recommend that you do not expose any other ports while operating a PFN. This is because exposing additional ports can increase the attack surface of your node and make it more vulnerable to adversaries. </Callout> #### Running a PFN: Assuming default ports are used, the following should be configured for PFNs: * Open the following TCP ports: * `6182` – **Public network**: Open this port publicly to enable other PFNs to connect to your PFN. * Close the following TCP ports: * `9101` – **Inspection service**: Close this port to prevent unauthorized metric inspection. * `9102` – **Admin service**: Close this port to prevent unauthorized admin service interaction. * `80/8080` - **REST API**: Close this port to prevent unauthorized REST API access. <Callout type="warning"> **Exposing services**<br /> The inspection service port (`9101`), admin service port (`9102`) and the REST API port (`80` or `8080`) are likely useful for your internal network, e.g., application development and debugging. However, the inspection service port and the admin service port should never be exposed publicly as they can be easily abused. Similarly, if you choose to expose the REST API endpoint publicly, you should deploy an additional authentication or rate-limiting mechanism to prevent abuse. </Callout> ## Storage requirements The amount of data stored by Movement PFNs depends on the ledger history (length) of the blockchain and the number of on-chain states (e.g., accounts and resources). Both the ledger history and the number of on-chain states depend on several additional factors, including the age of the blockchain, the average transaction rate over time, and the configuration of the ledger database pruner. At the time of writing, we estimate that testnet and mainnet PFNs require several 100's of GB of storage. Note that because archival nodes store the entire history of the blockchain, the database size on archival nodes will continue to grow unbounded. As a result, we cannot provide a recommendation for archival node storage sizes. # Verify a PFN URL: /general/nodes/full-node/run/verify After deploying your PFN, you can verify that it is operating correctly by checking several of the PFN's metrics. This document describes the common types of checks that you might wish to perform. <Callout type="info"> You can learn more about Aptos metrics in the [Node Inspection Service](/network/nodes/measure/node-inspection-service) documents. </Callout> ### Verify synchronization During the initial synchronization of your PFN, there may be a lot of data to transfer. You can monitor state sync progress by querying the metrics port to see what version your node is currently synced to. Run the following example command to see the currently synced version of your node: ```shellscript filename="Terminal" curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_state_sync_version{.*\"synced\"}" | awk '{print $2}' ``` The command will output the current synced version of your node. For example: ```shellscript filename="Terminal" 71000 ``` Compare the synced version returned by this command (e.g., `71000`) with the highest version shown on the [Movement explorer page](https://explorer.movementnetwork.xyz/?network=bardock+testnet). If your node is catching up to the highest version, it is synchronizing correctly. It is fine if the explorer page differs by a few versions, as the explorer nodes may sync with some variance. <Callout type="warning"> **Using fast sync?**<br /> If your node is fast syncing, the command may show `0` until it has finally caught up. To verify that the node is fast syncing, run the following command: ```shellscript filename="Terminal" curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_state_sync_version{.*\"synced_states\"}" | awk '{print $2}' ``` This should show an increasing number of synced states. It may take several hours for your node to fast sync to the latest version. Eventually, once fast syncing is complete, the `aptos_state_sync_version{.*"synced"}` command will return the current synced version of your node. </Callout> ### (Optional) Verify outbound network connections If you wish, you can also check the outbound network connections for your PFN. The number of outbound network connections should be more than `0` for healthy PFNs. Run the following command: ```shellscript filename="Terminal" curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_connections{direction=\"outbound\"" ``` The above command will output the number of outbound network connections for your node. For example: ```shellscript filename="Terminal" curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_connections{direction=\"outbound\"" aptos_connections{direction="outbound",network_id="Public",peer_id="aabd651f",role_type="full_node"} 3 ``` If the number of outbound connections returned is `0`, then it means your node cannot connect to the Movement blockchain. If this happens to you, follow these steps to resolve the issue: 1. Update your node to the latest release. 2. Remove any `seed` peers you may have added to your configuration file. The seeds may be preventing you from connecting to the network. ### (Optional) Examine Docker ledger size If you are running your PFN using Docker, you can monitor the size of the blockchain ledger by entering the Docker container and checking the size. This will allow you to see how much storage the blockchain ledger is currently consuming. * First, run `docker container ls` on your terminal and copy the NAME field output. This will be a string similar to `public_full_node_fullnode_1`. * Next, run these commands to check the storage size consumed by the ledger, using the NAME field you copied over in place of `public_full_node_fullnode_1`: ```shellscript filename="Terminal" # Obtain the container ID: id=$(docker container ls | grep public_full_node_fullnode_1 | grep -oE "^[0-9a-zA-Z]+") # Enter the container: docker exec -it $id /bin/bash # Observe the volume (ledger) size: du -cs -BM /opt/aptos/data ``` [rest_spec]: https://github.com/movement-network/aptos-core/tree/m1/api [movement-network/aptos-core]: https://github.com/movement-network/aptos-core.git # Using Docker URL: /general/nodes/archival-node/run/deploy/docker This guide describes how to deploy an archival fullnode using Docker. <Callout type="warning"> **Supported only on x86-64 CPUs** Running aptos-core via Docker is currently only supported on x86-64 CPUs. If you have an Apple M1/M2 (ARM64) Mac, use the [source code approach](/general/nodes/archival-node/run/deploy/source) instead. </Callout> ## Prerequisites * [Docker](https://docs.docker.com/get-docker/) installed * [restic](https://restic.net/) installed for data restoration * Sufficient storage (mainnet \~700GB, testnet \~260GB) ## Step 1: Create Working Directory ```shellscript filename="Terminal" # For mainnet mkdir -p mainnet-archival && cd mainnet-archival # For testnet mkdir -p testnet-archival && cd testnet-archival ``` ## Step 2: Download Configuration Files Download the archival fullnode configuration and genesis files: ### For Mainnet ```shellscript filename="Terminal" curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis_waypoint.txt ``` ### For Testnet ```shellscript filename="Terminal" curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis_waypoint.txt ``` ## Step 3: Restore Data from Backup Restore blockchain data from Move Industries' public backups using the restore script: ```shellscript filename="Terminal" # Download the restore script curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/l1_restore.sh chmod +x l1_restore.sh # Restore data (use 'mainnet' or 'testnet') ./l1_restore.sh mainnet ./data # Move data to the correct location for Docker mv data/opt/data/aptos/* data/ rm -rf data/opt ``` <Callout type="warning"> **Restore Time** Restoring from backup can take several hours depending on your network speed. Mainnet data is approximately 700GB and testnet is approximately 260GB. </Callout> ## Step 4: Run the Archival Node Start the archival node using Docker: ```shellscript filename="Terminal" docker run --pull=always \ --rm -p 8080:8080 \ -p 9101:9101 -p 6180:6180 \ -v $(pwd):/opt/aptos \ -v $(pwd)/data:/opt/aptos/data \ --workdir /opt/aptos \ --name=aptos-archival-node \ ghcr.io/movement-network/aptos-node:f24a5bc \ -f /opt/aptos/archival-fullnode.yaml ``` <Callout type="info"> **Running in Background** To run the node in the background, add the `-d` flag: ```shellscript filename="Terminal" docker run --pull=always -d \ --rm -p 8080:8080 \ -p 9101:9101 -p 6180:6180 \ -v $(pwd):/opt/aptos \ -v $(pwd)/data:/opt/aptos/data \ --workdir /opt/aptos \ --name=aptos-archival-node \ ghcr.io/movement-network/aptos-node:f24a5bc \ -f /opt/aptos/archival-fullnode.yaml ``` View logs with: `docker logs -f aptos-archival-node` </Callout> ## Step 5: Verify the Node Verify that your archival node is running correctly: ```shellscript filename="Terminal" # Check the node is responding curl http://localhost:8080/v1 # Check the ledger version curl -s http://localhost:8080/v1 | jq '.ledger_version' # Verify historical data access (query genesis transaction) curl http://localhost:8080/v1/transactions/by_version/1 # Check oldest available ledger version (should be 0 for archival) curl -s http://localhost:8080/v1 | jq '.oldest_ledger_version' ``` <Callout type="info"> **Sync Time** After restoring from backup, your archival node will need to sync the remaining transactions from the backup point to the current chain head. This typically takes a few hours depending on how recent the backup is. </Callout> ## Managing the Node ### View Logs ```shellscript filename="Terminal" docker logs -f aptos-archival-node ``` ### Stop the Node ```shellscript filename="Terminal" docker stop aptos-archival-node ``` ### Restart the Node ```shellscript filename="Terminal" docker start aptos-archival-node ``` ## Ports | Port | Purpose | | ---- | --------------------------------------- | | 8080 | REST API | | 9101 | Metrics (Prometheus) | | 6180 | Internal use | | 6182 | P2P networking (not exposed by default) | <Callout type="warning"> **Don't want to allow inbound P2P connections?** The default configuration doesn't expose port 6182. If you want to allow other PFNs to connect to yours, add `-p 6182:6182` to the docker command. </Callout> ## Next Steps * [Verify your archival node](/general/nodes/archival-node/run/verify) # Deploy an Archival Node URL: /general/nodes/archival-node/run/deploy This section covers the different methods to deploy an archival fullnode on the Movement Network. ## Deployment Options Choose the deployment method that best fits your needs: | Method | Best For | Complexity | | ------------------------------------------------------------- | --------------------------- | ---------- | | [Docker](/general/nodes/archival-node/run/deploy/docker) | Quick setup, production use | Low | | [Source Code](/general/nodes/archival-node/run/deploy/source) | Customization, development | Medium | ## Prerequisites Regardless of deployment method, you'll need: * **Storage**: 1TB+ SSD (2TB+ recommended for mainnet) * **Memory**: 16GB+ RAM * **CPU**: 8+ cores * **Network**: Reliable internet connection * **restic**: For restoring from backups ([installation](https://restic.net/)) ### Install restic restic is used to restore blockchain data from Move Industries' public backups. ```shellscript filename="Terminal" # Ubuntu/Debian sudo apt update && sudo apt install -y restic # macOS brew install restic # Or download directly curl -LO https://github.com/restic/restic/releases/download/v0.18.1/restic_0.18.1_linux_amd64.bz2 bunzip2 restic_0.18.1_linux_amd64.bz2 chmod +x restic_0.18.1_linux_amd64 sudo mv restic_0.18.1_linux_amd64 /usr/local/bin/restic ``` ## Restore Data from Backup Before starting your archival node, restore existing blockchain data from Move Industries' public backups. This is the recommended approach as syncing from genesis would take an extremely long time. Download and run the restore script from the Movement Networks repository: ```shellscript filename="Terminal" # Download the restore script curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/l1_restore.sh chmod +x l1_restore.sh # Restore mainnet data (~700GB) ./l1_restore.sh mainnet ./data # Or restore testnet data (~260GB) ./l1_restore.sh testnet ./data ``` <Callout type="warning"> **Restore Time** Restoring from backup can take several hours depending on your network speed: * Mainnet: \~700GB * Testnet: \~260GB </Callout> ## Configuration Files Download the archival fullnode configuration and genesis files: ### For Mainnet ```shellscript filename="Terminal" mkdir -p mainnet-archival && cd mainnet-archival curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis_waypoint.txt ``` ### For Testnet ```shellscript filename="Terminal" mkdir -p testnet-archival && cd testnet-archival curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis_waypoint.txt ``` ## Next Steps After restoring data and downloading configuration files, proceed to deploy: * [Deploy with Docker](/general/nodes/archival-node/run/deploy/docker) * [Deploy from Source](/general/nodes/archival-node/run/deploy/source) # Using Source Code URL: /general/nodes/archival-node/run/deploy/source This guide describes how to deploy an archival fullnode by building from the Move Industries `aptos-core` source code. ## Prerequisites * [Rust toolchain](https://rustup.rs/) installed * [restic](https://restic.net/) installed for data restoration * Sufficient storage (mainnet \~700GB, testnet \~260GB) * Build dependencies installed ### Install Build Dependencies (Linux) ```shellscript filename="Terminal" sudo apt update sudo apt install -y binutils build-essential lld pkg-config libdw-dev ``` ## Step 1: Clone and Build ```shellscript filename="Terminal" # Clone the Movement aptos-core repository git clone https://github.com/movement-network/aptos-core.git cd aptos-core # Check out the l1-migration branch git checkout --track origin/l1-migration # Build the release binary (this will take some time) cargo build -p aptos-node --release ``` <Callout type="info"> **Build Time** The initial build can take 15-30 minutes depending on your hardware. Subsequent builds are faster due to caching. </Callout> ## Step 2: Download Configuration Files Download the archival fullnode configuration and genesis files: ### For Mainnet ```shellscript filename="Terminal" curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/mainnet/genesis_waypoint.txt ``` ### For Testnet ```shellscript filename="Terminal" curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/configs/archival-fullnode.yaml curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis.blob curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/waypoint.txt curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/testnet/genesis_waypoint.txt ``` ## Step 3: Update Configuration Paths Edit the `archival-fullnode.yaml` to use local paths: ```yaml filename="archival-fullnode.yaml" base: role: "full_node" data_dir: "./data" # Local data directory waypoint: from_file: "./waypoint.txt" execution: genesis_file_location: "./genesis.blob" genesis_waypoint: from_file: "./genesis_waypoint.txt" storage: rocksdb_configs: enable_storage_sharding: false # ARCHIVAL NODE: Disable ledger pruning storage_pruner_config: ledger_pruner_config: enable: false full_node_networks: # ... (keep network configuration as-is) api: enabled: true address: 0.0.0.0:8080 state_sync: state_sync_driver: bootstrapping_mode: DownloadLatestStates continuous_syncing_mode: ApplyTransactionOutputs ``` ## Step 4: Restore Data from Backup Restore blockchain data from Move Industries' public backups using the restore script: ```shellscript filename="Terminal" # Download the restore script curl -O https://raw.githubusercontent.com/movement-network/movement-networks/main/l1_restore.sh chmod +x l1_restore.sh # Restore data (use 'mainnet' or 'testnet') ./l1_restore.sh mainnet ./data # Or for testnet: # ./l1_restore.sh testnet ./data # Move data to the correct location mv data/opt/data/aptos/* data/ rm -rf data/opt ``` <Callout type="warning"> **Restore Time** Restoring from backup can take several hours depending on your network speed. Mainnet data is approximately 700GB and testnet is approximately 260GB. </Callout> ## Step 5: Run the Archival Node Start the archival node: ```shellscript filename="Terminal" # Using the release binary ./target/release/aptos-node -f ./archival-fullnode.yaml # Or using cargo run cargo run -p aptos-node --release -- -f ./archival-fullnode.yaml ``` <Callout type="info"> **Running in Background** To run as a background service, consider using systemd or a process manager like `pm2` or `supervisord`. Example using nohup: ```she
프로젝트로 돌아가기