Run a PFN from Source Code
You can run your own public fullnode (PFN) to synchronize the state of the Aptos blockchain and stay up-to-date. PFNs replicate the entire state of the blockchain by syncing from other Aptos VFNs and PFNs. PFNs can be run by anyone. This tutorial explains how to deploy a PFN and connect to an Aptos network.
Hardware requirements
For running a production-grade PFN, we recommend that your hardware meet the same requirements as a validator or VFN. You can see the hardware requirements for these nodes, here: validator and VFN hardware requirements.
If you wish to run a PFN for development or testing only, lower hardware specs can be used. But, it should not be used in production. For example:
CPU: 8 cores, 16 threads (Intel Xeon Skylake or newer).
Memory: 32GB RAM.
Network requirements and ports
When you are running a PFN, you are required to open network ports on your nodes to allow other nodes (i.e., peers) to connect to you. There are different Aptos 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 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.
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 PFNs to connect to your VFN.
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.
Storage requirements
The amount of data stored by Aptos 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.
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.
Deploying a PFN
You can deploy a PFN in one of two ways: (i) building and running aptos-core from source code; or (ii) using Docker. This document describes how to deploy your PFN using both methods.
Method 1: Building and running from source
First, see Building Aptos From Source for instructions on how to download the aptos-core
repository and build the binary. Then, follow the steps below:
Make sure your current working directory is
aptos-core
.Check out the
mainnet
branch usinggit checkout --track origin/mainnet
; remember, you may instead usedevnet
ortestnet
if you wish to run your PFN in a different network.Next, download the
genesis.blob
andwaypoint.txt
files for the network your PFN will connect to:Run this command to download the genesis blob (for mainnet):
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/mainnet/genesis.blob
Run this command to download the waypoint file (for mainnet):
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/mainnet/waypoint.txt
Next, run the command below to create a copy of the PFN configuration YAML template:
cp config/src/config/test_data/public_full_node.yaml fullnode.yaml
Finally, edit the
fullnode.yaml
configuration file to ensure that your PFN: (i) contains the genesis blob and waypoint file you just downloaded; and (ii) saves the synchronized blockchain data to the location of your choice (on your local machine). To do this:Specify the correct path to the
genesis.blob
file you just downloaded by editingexecution.genesis_file_location
in thefullnode.yaml
configuration. By default, it points togenesis.blob
in the current working directory. fullnode.yamlexecution: genesis_file_location: "./genesis.blob"
Specify the correct path to the
waypoint.txt
file you just downloaded by editingbase.waypoint.from_file
in thefullnode.yaml
configuration. By default, it points towaypoint.txt
in the current working directory. For example: fullnode.yamlbase: waypoint: from_file: "./waypoint.txt"
Specify the directory on your local machine that you want to store the blockchain database by editing the
base.data_dir
in thefullnode.yaml
configuration. For example, you can create a directorymy-full-node/data
in your home directory and specify it as: fullnode.yamlbase: data_dir: "</path/to/my/homedir/my-full-node/data>"
Start your local public fullnode by running the below command:
cargo run -p aptos-node --release -- -f ./fullnode.yaml
You have now successfully configured and started running a PFN in the Aptos mainnet.
Last updated
Was this helpful?