# How to move node using snapshot

Hi guys, today I am going to tell you how to start validator node using snapshot, this is really useful when you need to move a node to another server.

{% hint style="info" %}
By default, nodes are configured for fast synchronization. The last state of the chain is reached in about 15-30 minutes. You may need a database that includes a larger amount of data stored in a snapshot (time for downloading and unpacking at least 2 hours. Size \~400GB)
{% endhint %}

## Set var

> It is assumed that you have already done the initial preparation of the server, including installing the docker, configuring the firewall, etc.

> Change "alice" to your username

```bash
echo export USERNAME=alice >> $HOME/.bash_profile
echo export WORKSPACE=mainnet >> $HOME/.bash_profile
source $HOME/.bash_profile
mkdir ~/$WORKSPACE
cd ~/$WORKSPACE
```

```bash
sudo apt-get install lz4
```

## Create database directory

The folder with the database must be in the folder where the container will be created at start, by default this is <mark style="color:purple;">**/var/lib/docker/volumes/**</mark>

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

You can check it with the command:

```bash
docker info|grep "Docker Root Dir"
```

For VFN:

```bash
mkdir -p /var/lib/docker/volumes/aptos-fullnode/_data/
```

For Validator:

```bash
mkdir -p /var/lib/docker/volumes/aptos-validator/_data/
```

## Download snapshot

{% hint style="info" %}
You can use one of the options of your choice:\
1\. Bwarelabs: <https://bwarelabs.com/snapshots/aptos>\
2\. Polkachu: <https://polkachu.com/aptos_snapshots/aptos>\
Check the latest snapshot on their website before proceeding to the next step
{% endhint %}

```bash
wget https://snapshots.bwarelabs.com/aptos/mainnet/aptos20240501.tar.lz4
```

### Decompress the archive to workspace directory:

```bash
lz4 -c -d aptos20240501.tar.lz4 | tar -x -C ~/$WORKSPACE
```

Then move files to data directory:

For VFN:

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

For Validator:

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

## Download the files needed to run VFN or Validator

<figure><img src="/files/Gxi4UlvVbWgRAvZuECRl" alt=""><figcaption><p>files for VFN</p></figcaption></figure>

<figure><img src="/files/YOiRvMdLVr3jYWSCpu6z" alt=""><figcaption><p>files for Validator</p></figcaption></figure>

{% hint style="info" %}
Remember to change the IP to the new one in the configuration file <mark style="color:purple;">\~/$WORKSPACE/alice/operator.yaml</mark>
{% endhint %}

### Start your node

VFN:

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

OR

Validator:

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

### Update on-chain network addresses and update on-chain consensus key (only for Validator)

> Change \<pool-address> to your pool-address

```bash
aptos node update-validator-network-addresses  \
  --pool-address <pool-address> \
  --operator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml \
  --profile mainnet-operator
```

```bash
aptos node update-consensus-key  \
  --pool-address <pool-address> \
  --operator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml \
  --profile mainnet-operator
```

All done. Now you can check the connection your node <https://aptos.dev/nodes/validator-node/operator/node-liveness-criteria>

## Delete the downloaded archive to save space

```
rm -v aptos20240501.tar.lz4
```

## More information can be found here

1. <https://aptos.dev/nodes/validator-node/operator/node-requirements>
2. <https://aptos.dev/nodes/full-node/bootstrap-fullnode>
3. <https://aptos.dev/nodes/validator-node/operator/connect-to-aptos-network>
4. <https://aptos.dev/nodes/validator-node/operator/running-validator-node/run-validator-node-using-docker>\ <br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cryptomolot.gitbook.io/cryptomolot-docs/mainnets/aptos/how-to-move-node-using-snapshot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
