Skip to main content

Sync

This guide will walk you through how to sync the chain from genesis or use a snapshot for a quicker sync.

☢️Setup for successful sync

Before you attempt to sync your node, confirm that you have properly set up your system configuration and built Terra core.

Sync from genesis

The process for syncing your full node from genesis will differ between the Pisco testnet and Phoenix mainnet networks. You may proceed with the instructions corresponding with your chosen network below.

Pisco testnet

If you would like to sync your node using the Pisco testnet, you will need to utilize version v2.0.0-rc.0 of terrad up until the block height of 838,500. To sync your node from block 838,500 onward, you will need to utilize version v2.1.0-beta.1 of terrad.

  1. To switch to version v2.0.0-rc.0 of terrad, change into your core directory and execute the following commands in your terminal:

_2
git checkout v2.0.0-rc.0
_2
make install

After running these commands, make sure that you have switched to the correct version of terrad by running the following command:


_1
terrad version

The result of this command should be v2.0.0-rc.0.

  1. After you have the correct terrad version, you will need to download the genesis file for Pisco in the terrad config directory:

_1
wget https://raw.githubusercontent.com/terra-money/testnet/master/pisco-1/genesis.json -O ~/.terra/config/genesis.json

  1. Next, update the persistent_peers setting with a list of stable persistent peers in your config.toml file.

  2. Finally, you can start the syncing process:


_1
terrad start

☢️Sync start times

Nodes take at least an hour to start syncing. This wait time is normal. Before troubleshooting a sync, please wait an hour for the sync to start.

Syncing will halt at block 838,500, at which point you will need to change the version of terrad and then resume the syncing process.

  1. To sync your Pisco testnet node from block 838,500 to the most recent block, you will need to navigate to the core directory and change your terrad version to v2.1.0-beta.1.

_2
git checkout v2.1.0-beta.1
_2
make install

Again, make sure that you have switched to the correct version of terrad by running the following command:


_1
terrad version

The result of this command should be v2.1.0.

  1. Now, you can resume the syncing process:

_1
terrad start

From here, you can monitor the sync. Make sure to check on your node periodically to ensure optimal performance.

Phoenix mainnet

If you would like to sync your node using the Phoenix mainnet, you will need to utilize version v2.0.0 of terrad up until the block height of 890,000. To sync your node from block 890,000 onward, you will need to utilize version v2.1.1 of terrad.

  1. To switch to version v2.0.0 of terrad, change into your core directory and execute the following commands in your terminal:

_2
git checkout v2.0.0
_2
make install

After running these commands, make sure that you have switched to the correct version of terrad by running the following command:


_1
terrad version

The result of this command should be v2.0.0.

  1. After you have the correct terrad version, you will need to download the genesis file for Phoenix in the terrad config directory:

_1
wget https://phoenix-genesis.s3.us-west-1.amazonaws.com/genesis.json -O ~/.terra/config/genesis.json

  1. Next, download the addrbook.json file containing a list of stable persistent peers into the ~/.terra/config/ directory:

_1
wget https://snapshots1.polkachu.com/addrbook/terra/addrbook.json -O ~/.terra/config/addrbook.json

  1. Finally, you can start the syncing process:

_1
terrad start

☢️Sync start times

Nodes take at least an hour to start syncing. This wait time is normal. Before troubleshooting a sync, please wait an hour for the sync to start.

Syncing will halt at block 890,000, at which point you will need to change the version of terrad and then resume the syncing process.

  1. To sync your Phoenix mainnet node from block 890,000 to the most recent block, you will need to navigate to the core directory and change your terrad version to v2.1.1.

_2
git checkout v2.1.1
_2
make install

Again, make sure that you have switched to the correct version of terrad by running the following command:


_1
terrad version

The result of this command should be v2.1.1.

  1. Now, you can resume the syncing process:

_1
terrad start

From here, you can monitor the sync. Make sure to check on your node periodically to ensure optimal performance.

Healthy Node Status Example


_38
{
_38
"NodeInfo": {
_38
"protocol_version": {
_38
"p2p": "8",
_38
"block": "11",
_38
"app": "0"
_38
},
_38
"id": "821dc1401fd0270487b3e615c652181b4d4566dd",
_38
"listen_addr": "18.157.84.154:26656",
_38
"network": "pisco-1",
_38
"version": "v0.34.19-terra.2",
_38
"channels": "40202122233038606100",
_38
"moniker": "terradocs",
_38
"other": {
_38
"tx_index": "on",
_38
"rpc_address": "tcp://127.0.0.1:26657"
_38
}
_38
},
_38
"SyncInfo": {
_38
"latest_block_hash": "ED9F6D0855FD92A5BA2F91082CD49ADB18A07DCE3F747529D357071E5B7C0D4C",
_38
"latest_app_hash": "D621068882E7FC5045CDD957ADEABE9BF8E90F2092C9526E22BE4767940D128B",
_38
"latest_block_height": "260770",
_38
"latest_block_time": "2022-06-09T15:22:48.792283245Z",
_38
"earliest_block_hash": "F948EF10AA663D182309790C51E5A7A9125D7CF4D60D9E735994059DB7CAD4D4",
_38
"earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
_38
"earliest_block_height": "1",
_38
"earliest_block_time": "2022-05-23T06:00:00Z",
_38
"catching_up": false
_38
},
_38
"ValidatorInfo": {
_38
"Address": "04024A7F76485B0D2B99570EC7DA3E9A3B3735CC",
_38
"PubKey": {
_38
"type": "tendermint/PubKeyEd25519",
_38
"value": "KUqIsRD9yzPt7k9et+ClFp6h8wXwEIcb/TVZPrC57+I="
_38
},
_38
"VotingPower": "0"
_38
}
_38
}

Fast-sync for testing

Sometimes you may want to sync faster by foregoing checks. You may do so by adding the following flag to the terrad start command.

☢️caution

The following command should only be used by advanced users in non-production environments:


_1
terrad start --x-crisis-skip-assert-invariants

Sync from snapshot

You can significantly accelerate the synchronization process by providing terrad with a recent snapshot of the network state. Snapshots are made publicly available by members of the Terra community one example can be downloaded from Polkachu - Phoenix Mainnet. Polkachu - Pisco Testnet is provided by Polkachu, and not maintained as part of this documentation.

Before using snapshots

Certain files will need to be absent or deleted before downloading a snapshot. A quicksync replaces blockchain data with a custom snapshot. For most use cases, a "pruned" version is adequate. Pruned versions will have certain transactions removed from the archive to improve node performance. If you are running a node for archival purposes, you will want an archive or default download.

After choosing the appropriate download type, examine your node and ensure that .terra/data is empty.

Example:


_1
6:22PM INF Removed all blockchain history dir=/home/ubuntu/.terra/data

☢️caution

If you are a validator, ensure that you do not remove your private key.

Example of a removed private key:


_1
6:22PM INF Reset private validator file to genesis state keyFile=/home/ubuntu/.terra/config/priv_validator_key.json stateFile=/home/ubuntu/.terra/data/priv_validator_state.json

If you have an address book downloaded, you may keep it. Otherwise, you will need to download the appropriate addressbook.

With an address book downloaded, run the following:


_3
terrad start
_3
terrad status
_3
# It will take a few seconds for terrad to start.

Monitor the sync

Your node is catching up with the network by replaying all the transactions from genesis and recreating the blockchain state locally. You can verify this process by checking the latest_block_height in the SyncInfo of the terrad status response:


_7
{
_7
"SyncInfo": {
_7
"latest_block_height": "42", <-----
_7
"catching_up" : true
_7
},
_7
...
_7
}

Compare this height to the Latest Blocks by checking the API for the latest block heights on Phoenix, or Pisco to see your progress.

Sync complete

You can tell that your node is in sync with the network when SyncInfo.catching_up in the terrad status response returns false and the latest_block_height corresponds to the public network blockheight found on the API for either Phoenix, or Pisco.


_1
terrad status

Example:


_7
{
_7
"SyncInfo": {
_7
"latest_block_height": "7356350",
_7
"catching_up" : false
_7
},
_7
...
_7
}

Validators can view the status of the network using Terra Finder.

Congratulations!

You've successfully joined a network as a full node operator. If you are a validator, continue to manage a Terra validator for next steps.