How To Deploy An Aptos Node: Fullnode Setup

How To Deploy An Aptos Node: Fullnode Setup
How To Deploy An Aptos Node

Without nodes, the Aptos network cannot achieve stable performance and security. Our article will provide instructions to deploy an Aptos fullnode with Docker and requirements to run your Aptos node.

What is an Aptos Node?

An Aptos node is an entity of the Aptos network that monitors the state of the Aptos blockchain. These nodes fall into two categories: validator nodes and full nodes.

  • Validator nodes actively engage in consensus mechanisms and uphold network security. They need to stake a minimum token amount to qualify as validator nodes.
  • Full nodes are responsible for maintaining the complete history of the Aptos blockchain and furnishing data to other nodes. While they don't participate in consensus, their presence is vital for the network's proper functioning.

There is alternatively a subset of validator nodes called 'validator fullnodes.' They are required to store the entire history of the Aptos blockchain.

Aptos nodes are essential for the security and stability of the Aptos network. They help to ensure that transactions are processed accurately and that the network is resistant to attacks.

Run an Aptos Node
Run an Aptos Node

Aptos Node Requirements

Validator Node and Validator Fullnode:

  • Both are required for Aptos mainnet.
  • Strongly recommended to run on separate, independent machines for resource isolation and smooth deployment.

Public Fullnode (Optional):

  • Recommended but not required.
  • If used, run on a third machine separate from validator nodes.

Terraform Support:

  • Terraform support is available for GCP and AWS cloud providers for node deployment.

Network Ports:

  • Open the necessary network ports before connecting to the network.
  • Close these ports after being accepted or rejected from the network.

Hardware Requirements:

  • CPU: 8 cores, 16 threads, 2.8GHz or faster, Intel Xeon Skylake or newer.
  • Memory: 32GB RAM.
  • Storage: 2T SSD with at least 40K IOPS and 200MiB/s bandwidth.
  • Networking Bandwidth: 1Gbps.

Motivations for Hardware Requirements:

  • Requirements based on transaction rate and storage demands.
  • Ledger history and on-chain states affect data stored by the blockchain.
  • Hardware recommendations are set considering estimated growth up to Q1-2023.

Local SSD vs. Network Storage:

  • Cloud deployments can use local or network storage.
  • Local SSD provides lower latency and cost, especially for IOPS.
  • Network storage offers support for backup snapshots and high availability.

Port Settings:

Validator Node:

  • Open TCP ports 6180 (public) and 6181 (private).
  • Close TCP ports 6182, 9101, 80/8080.

Validator Fullnode:

  • Open TCP ports 6182 (public) and 6181 (private).
  • Close TCP ports 9101, 80/8080.
  • Public Fullnode:
  • Open TCP port 6182 (public).
  • Close TCP ports 9101, 80/8080.

Network Types:

  • Validator Network: For validator nodes.
  • Public Network: For public fullnodes (optional).
  • Validator Fullnode Network: For validator fullnodes.

Note: The configuration YAML file can be used to adjust port settings for each network type.

How To Deploy An Aptos Node: Fullnode Setup

To establish a public fullnode for Aptos, there are two approaches you can follow: building and running aptos-core from source code or using Docker. Our guide will focus on building from source.

If you want to set up Aptos fullnodes with Docker, you can check out Aptos Docs.

Step 1: Configure the fullnode

Start by checking out the mainnet branch of aptos-core using the command:

git checkout --track origin/mainnet

Alternatively, you can choose devnet or testnet.

Make sure your working directory is aptos-core.

Create a copy of the public fullnode configuration YAML template by running:

cp config/src/config/test_data/public_full_node.yaml fullnode.yaml

Edit the fullnode.yaml file you just created. Ensure that your public fullnode:

  • Contains the correct genesis blob published by the Aptos mainnet.
  • Synchronizes accurately with the mainnet using the checkpoint file waypoint.txt from the mainnet.
  • Stores the mainnet database in a location of your choice on your local machine.

Download the genesis.blob and waypoint.txt files published by the Aptos mainnet using the following commands:

curl -O curl -O

If you want to connect to networks other than the mainnet, like devnet or testnet, download the corresponding genesis.blob and waypoint.txt files from the Aptos Networks GitHub repository.

Edit the fullnode.yaml file again to:

  • Specify the correct path to the downloaded waypoint.txt by modifying base.waypoint.from_file in the YAML.
  • Provide the full path to the genesis.blob file using the genesis_file_location key.
  • Set the data_dir key in the base list to the directory on your local computer where you want to store the database.

Start your local public fullnode by executing the command:

cargo run -p aptos-node --release -- -f ./fullnode.yaml

This command launches your fullnode connected to the Aptos devnet.

If you prefer a debug binary instead of a release binary, omit the --release flag when building.

Step 2: Verify and Monitor Your Public Fullnode

Verify Initial Synchronization

During the initial synchronization of your public fullnode, monitor progress by querying the metrics port. Use the following command to check the current synced version of your node:

curl 2> /dev/null | grep "aptos_state_sync_version{.*\"synced\"}" | awk '{print $2}'

Compare the output version with the highest version displayed on the Aptos Explorer page. If your node is catching up, it's synchronizing correctly.

  • Debugging: If debugging is needed, build a binary by omitting the --release flag during compilation. You can directly run the debug binary using ./aptos-core/target/debug/aptos-node -f ./fullnode.yaml after building it using cargo build -p aptos-node --release.

These steps help you configure and run a public fullnode connected to Aptos devnet successfully. Keep in mind that slight version differences between your node and explorer nodes are acceptable due to synchronization variations.

Step 3: Upgrade Your Fullnode (from Source)

When you receive an update for your Aptos fullnode, follow these steps to minimize downtime. In all cases, you'll essentially be undoing the initial setup and restarting afresh. Ensure that your development environment is updated before proceeding.

If you set up your Aptos fullnode from source code, follow these steps for upgrading:

Stop your local public fullnode by running the following command:

cargo stop aptos-node

  • Delete the waypoint.txt, genesis.blob, and fullnode.yaml files that were previously downloaded, installed, and configured.
  • Re-install and configure these files as you did during the initial setup.

Restart your local public fullnode using the same start (run) command as before:cargo run -p aptos-node --release -- -f ./fullnode.yaml

You've successfully set you an Aptos fullnode. Apart from running a fullnode, you can stake Aptos with validators to generate impressive returns.

Read more