You can run your own public fullnode to synchronize with the state of the Aptos blockchain and stay up-to-date. Public fullnodes replicate the entire state of the blockchain by querying other Aptos fullnodes (public fullnodes or validator fullnodes) or validators.
Alternatively, you can use the public fullnodes provided by Aptos Labs. However, such Aptos Labs-provided public fullnodes have rate limits, which can impede your development. By running your own public fullnode you can directly synchronize with the Aptos blockchain and avoid such rate limits.
Public fullnodes can be run by anyone. This tutorial explains how to configure a public fullnode to connect to an Aptos network.
CHOOSE A NETWORK
This document describes how to start a public fullnode in the Aptos mainnet
network yet can easily be used to do the same in the devnet
and testnet
networks. To do so, instead check out the desired branch and use the genesis.blob
and waypoint.txt
node files for the respective branch: mainnet
, devnet
, and testnet
.
Hardware requirements
We recommend the following hardware resources:
- For running a production grade public fullnode:
- CPU: 8 cores, 16 threads (Intel Xeon Skylake or newer).
- Memory: 32GB RAM.
- For running the public fullnode for development or testing:
- CPU: 2 cores.
- Memory: 4GB RAM.
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). These values depend on several factors, including: the age of the blockchain, the average transaction rate and the configuration of the ledger pruner. Follow the storage requirements described in Validator Hardware Requirements.
DEVNET BLOCKCHAIN STORAGE
The Aptos devnet is currently reset on a weekly basis. Hence we estimate that if you are connecting to the devnet, then the Aptos blockchain will not require more than several GBs of storage. See the #devnet-release
channel on Aptos Discord.
Configuring a public fullnode
You can configure a public fullnode in one of two ways:
- Building and running aptos-core from source code.
- Using Docker.
This document describes how to configure your public fullnode using both methods.
Method 1: Building and running from source
- Check out the
mainnet
branch usinggit checkout --track origin/mainnet
; remember, you may instead usedevnet
ortestnet
. - Make sure your current working directory is
aptos-core
.Run:
cp config/src/config/test_data/public_full_node.yaml fullnode.yaml
to create a copy of the public fullnode configuration YAML template. You will edit this file to ensure that your public fullnode:
- Contains the correct genesis blob that is published by the Aptos mainnet.
- Synchronizes correctly with the mainnet, by using the checkpoint file
waypoint.txt
published by the mainnet. - Stores the mainnet database at a location of your choice on your local machine.
- Make sure your current working directory is
aptos-core
. The Aptos mainnet publishes thegenesis.blob
andwaypoint.txt
files. Download them:
- Run the below command on your terminal to download the file:
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/mainnet/genesis.blob
- Run the below command on your terminal to download the file:
curl -O https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/mainnet/waypoint.txt
DON’T WANT TO CONNECT TO MAINNET?
To connect to other networks (e.g., devnet
and testnet
), you can find genesis and waypoint here ➜ GitHub - aptos-labs/aptos-networks. Be sure to download the genesis.blob
and waypoint.txt
for those networks, instead of using the genesis and waypoint pointed to by the curl
commands above.
- Edit the
fullnode.yaml
file in your current working directory as follows.
- Specify the correct path to the
waypoint.txt
you just downloaded by editing thebase.waypoint.from_file
in thefullnode.yaml
. By default it points towaypoint.txt
in the current working directory.For example:
base:
waypoint:
from_file: "./waypoint.txt"
- For the
genesis_file_location
key, provide the full path to thegenesis.blob
file. For example:
genesis_file_location: "./genesis.blob"
- For the
data_dir
key in thebase
list, specify the directory where on your local computer you want to store the devnet database. This can be anywhere on your computer. For example, you can create a directorymy-full-node/data
in your home directory and specify it as:
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 fullnode connected to Aptos devnet.
DEBUGGING?
This will build a release binary: aptos-core/target/release/aptos-node
. The release binaries tend to be substantially faster than debug binaries but lack debugging information useful for development. To build a debug binary, omit the --release
flag.
You can also run this directly as ./aptos-core/target/release/aptos-node -f ./fullnode.yaml
after running cargo build -p aptos-node --release