Sync
This guide will walk you through how to sync the chain from genesis or use a snapshot for a quicker 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 until block 2,777,777, you will need to utilize version v2.1.0-beta.1 of terrad. From block 2,777,777 onwards, utilize version v2.2.0 of terrad.
- To switch to version
v2.0.0-rc.0of terrad, change into yourcoredirectory and execute the following commands in your terminal:
_2git checkout v2.0.0-rc.0_2make install
After running these commands, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.0.0-rc.0.
- After you have the correct terrad version, you will need to download the genesis file for Pisco in the terrad config directory:
_1wget https://raw.githubusercontent.com/terra-money/testnet/master/pisco-1/genesis.json -O ~/.terra/config/genesis.json
-
Next, update the
persistent_peerssetting with a list of stable persistent peers in yourconfig.tomlfile. -
Now, you can start the syncing process:
_1terrad start
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.
- To sync your Pisco testnet node from block 838,500 to block 2,777,777, you will need to navigate to the
coredirectory and change your terrad version tov2.1.0-beta.1.
_2git checkout v2.1.0-beta.1_2make install
Again, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.1.0.
- Again, you can resume the syncing process:
_1terrad start
Syncing will halt at block 2,777,777, at which point you will need to change the version of terrad and then resume the syncing process.
- To sync your Pisco testnet node from block 2,777,777 to the most recent block, you will need to navigate to the
coredirectory and change your terrad version tov2.2.0.
_2git checkout v2.2.0_2make install
Again, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.2.0.
- Now, you can resume and finalize the syncing process:
_1terrad 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 to block 2,979,805, you will need to utilize version v2.1.1 of terrad. From block 2,979,805 onwards, utilize version v2.2.0 of terrad.
- To switch to version
v2.0.0of terrad, change into yourcoredirectory and execute the following commands in your terminal:
_2git checkout v2.0.0_2make install
After running these commands, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.0.0.
- After you have the correct terrad version, you will need to download the genesis file for Phoenix in the terrad config directory:
_1wget https://phoenix-genesis.s3.us-west-1.amazonaws.com/genesis.json -O ~/.terra/config/genesis.json
- Next, download the
addrbook.jsonfile containing a list of stable persistent peers into the~/.terra/config/directory:
_1wget https://snapshots1.polkachu.com/addrbook/terra/addrbook.json -O ~/.terra/config/addrbook.json
- Now, you can start the syncing process:
_1terrad start
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.
- To sync your Phoenix mainnet node from block 890,000 to block 2,979,805, you will need to navigate to the
coredirectory and change your terrad version tov2.1.1.
_2git checkout v2.1.1_2make install
Again, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.1.1.
- Again, you can resume the syncing process:
_1terrad start
Syncing will halt at block 2,979,805, at which point you will need to change the version of terrad and then resume the syncing process.
- To sync your Phoenix mainnet node from block 2,979,805 to the most recent block, you will need to navigate to the
coredirectory and change your terrad version tov2.2.0.
_2git checkout v2.2.0_2make install
Again, make sure that you have switched to the correct version of terrad by running the following command:
_1terrad version
The result of this command should be v2.2.0.
- Now, you can resume and finalize the syncing process:
_1terrad 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.
The following command should only be used by advanced users in non-production environments:
_1terrad 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:
_16:22PM INF Removed all blockchain history dir=/home/ubuntu/.terra/data
If you are a validator, ensure that you do not remove your private key.
Example of a removed private key:
_16: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:
_3terrad start_3terrad 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.
_1terrad 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.