Run testnet full node [addendum to the official guide]

Hi Aptos fam! We hope these additions will help you avoid some of the issues we had when installing public full node in Aptos testnet.

This guide is an addition to the official guide to running Public Fullnode on a testnet.

Step 1. We described server configuration and protection here.

Step 2. Install Docker

Step 3. Setup a node

mkdir testnet && cd testnet

mkdir data

wget -O fullnode.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/testnet/docker/compose/aptos-node/fullnode.yaml

wget -O genesis.blob https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/testnet/genesis.blob

wget -O waypoint.txt https://raw.githubusercontent.com/aptos-labs/aptos-networks/main/testnet/waypoint.txt

Editing the fullnode.yaml file:

base:
  role: "full_node"
  data_dir: "/opt/aptos/data"
  waypoint:
    from_file: "/opt/aptos/etc/waypoint.txt"

execution:
  genesis_file_location: "/opt/aptos/etc/genesis.blob"

full_node_networks:
- network_id: "public"
  discovery_method: "onchain"
  listen_address: "/ip4/0.0.0.0/tcp/6182"

api:
  enabled: true
  address: "0.0.0.0:8080"

Since the node will not be able to start synchronization with the genesis block, before launching, you should download the database by any means and place it in the
~/testnet/data/db/ directory.

You can use a snapshot (Bootstrap Fullnode from Snapshot | Aptos Docs) or backup/restore (Bootstrap Fullnode from Backup | Aptos Docs) and that should give your node more up-to-date seed peer information.

note: In the next release (1.7), we’ll automatically be injecting seeds to testnet and mainnet nodes, meaning these nodes should always be able to connect (even if they only have the genesis blob). https://github.com/aptos-labs/aptos-core/tree/aptos-release-v1.7.

Step 4. Starting the node:

docker run -d --pull=always \
    --rm -p 8080:8080 \
    -p 9101:9101 -p 6180:6180 \
    -v $(pwd):/opt/aptos/etc -v $(pwd)/data:/opt/aptos/data \
    --workdir /opt/aptos/etc \
    --name=aptos-fullnode aptoslabs/validator:mainnet aptos-node \
    -f /opt/aptos/etc/fullnode.yaml

Useful commands and links:

Looking at the logs:

docker ps

Copy container id and write the command:

docker logs [Container ID] --tail 100

For example:

docker logs 665c711d377e --tail 100

Run a Public Fullnode with the Aptos Source Code or Docker

Bootstrap Fullnode from Backup

Node Files For Testnet

You can find the latest block using the REST API using this: https://fullnode.devnet.aptoslabs.com/v1/spec#/operations/get_block_by_version.

  1. The index page will tell you the latest node version (e.g., ledger_version): https://fullnode.mainnet.aptoslabs.com/v1.

  2. Use the ledger_version to lookup the block that it belongs to, e.g.,: https://fullnode.mainnet.aptoslabs.com/v1/blocks/by_version/253141079

Thanks for reading!

1 Like

any rewards for doing NOde ?

I don’t think so in this case !

1 Like

There is no incentivized testnet ongoing, it’s for users who would love testing and then to keep going on mainnet.