How to join validator set via snapshot

Hey guys, today I will tell you about how to join validator set with snapshot, that’s really useful case when you know that your node will have technical maintenance time. Because you will receive full data base. Fast sync is ± the same speed, maybe even longer. But fast sync omits syncing historical transactions.

Let’s start!

1.Get a server with recommended requirements ( check them out here 2 )

Рисунок2

1.2 Connect, configure as well as the main server with aptos validator:
Install the latest system updates.
Create a user, set up key login, open/close ports, etc.
Install docker and docker-compose. Optionally, you can install the Aptos CLI.

1.3 Create the same variables as you created on the main node.

echo export USERNAME=alice >> $HOME/.bash_profile

echo export WORKSPACE=mainnet >> $HOME/.bash_profile

source $HOME/.bash_profile

mkdir ~/$WORKSPACE

cd ~/$WORKSPACE

  1. Downloading a snapshot
    (more info here 3)
    We will download snapshots from here (thanks to these guys):
    mainnet: Aptos Node Snapshot | Polkachu 6
    mainnet and testnet: Snapshots - Bware Labs 5
    Next we need to create a folder where we will download the snapshot (blockchain database):

The folder with the database must be in the folder where the container will be created at start, by default this is /var/lib/docker/volumes/

If you have changed the root directory of the docker, you should use the directory you use

You can check it with the command:

docker info|grep “Docker Root Dir”

2.1 Create a directory where we will then download the blockchain database (Depending on what you want to run vfn or validator, the paths will look different)

For VFN:

mkdir -p /var/lib/docker/volumes/aptos-fullnode/_data/db/

For Validator:

mkdir -p /var/lib/docker/volumes/aptos-validator/_data/db/

Install the auxiliary software:

sudo apt install snapd -y

sudo snap install lz4

2.3 Download the snapshot (see above for links to the actual archive with the database):

wget -O aptos_126950751.tar.lz4 https://snapshots.polkachu.com/snapshots/aptos/aptos_126950751.tar.lz4 --inet4-only

Unpack the archive:

lz4 -c -d aptos_126950751.tar.lz4 | tar -x -C ~/$WORKSPACE

Downloading and unpacking takes about 2 hours (depends on your internet speed).

Then move the base to our directory, which will be used to start the node:

For VFN:

mv ~/$WORKSPACE/data/db/* /var/lib/docker/volumes/aptos-fullnode/_data/db/

For Validator:

mv ~/$WORKSPACE/data/db/* /var/lib/docker/volumes/aptos-validator/_data/db/

2.4 Download the files needed to run VFN or Validator

For VFN:
vfn

For Validator:
valik

Remember to change the IP to the new one in the configuration file ~/$WORKSPACE/alice/operator.yaml

And start our node:
VFN:

cd ~/$WORKSPACE && docker-compose -f docker-compose-fullnode.yaml up -d

Validator:

cd ~/$WORKSPACE && docker-compose up -d

All done. Now check the connection of the Connect to Aptos Network | Aptos Docs 3 node.

You can delete the downloaded archive to save space:

rm -v aptos_126950751.tar.lz4

Thanks for your attention and hope that was helpful!

23 Likes

Thank you for this clear and helpful guide!

12 Likes

Your always making reads enjoyable.

10 Likes

Always posting great stuff. Thank you

8 Likes

How hard is it to set a node? :thinking: :thinking:

10 Likes

Not that hard :slight_smile:

6 Likes

I find it complex whenever I’m trying to run a node, maybe this guide might help. Would give it a try and let you guys know how it goes

6 Likes

Good detailed info bro

9 Likes

do you have a guide?

4 Likes

this is super helpful for newbie to node in general … bookmark this !!!

5 Likes

Can anyone tell me wether or wether not will our previous interaction be considered

2 Likes