Skip to main content

Updates and additional settings

Upgrade the testnet

These instructions are for full nodes running older testnets that would like to upgrade to the latest testnet.

1. Create Backups

Before you may upgrade your node to the latest version of testnet, you will first need to reset your data. However, resetting your data will affect your original priv_validator.json and cargo.toml files.

Make sure to create a backup of both of these files and then proceed to the next step.

2. Reset data

Remove the outdated files and reset the data:


_3
rm ~/.terra/config/genesis.json
_3
rm ~/.terra/config/addrbook.json
_3
terrad unsafe-reset-all

Your node is now in a pristine state. Be aware that the original priv_validator.json and config.toml files will be affected by this command. If you had any sentry nodes or full nodes set up before, your node will still try to connect to them, but may fail if they haven't also been upgraded.

🔥danger

Make sure that every node has a unique priv_validator.json. Do not copy the priv_validator.json from an old node to multiple new nodes. Running two nodes with the same priv_validator.json will cause you to double sign.

3. Software upgrade

Now it is time to upgrade the software. Go to the project directory and run:


_2
git checkout master && git pull
_2
make

💡tip

If you have issues at this step, please check that you have a compatible version of GO installed (v1.18+).

The previous command uses master as it contains the latest stable release. See the testnet repo for details on which version is needed for which testnet, and the Terra Core release page for details on each release.

Your full node is now cleanly upgraded!

Exporting state

Terra can export the entire application state to a JSON file. You can use this file for manual analysis or as the genesis file of a new network.

Export state:


_1
terrad export > [filename].json

You can also export a state from a particular height. The following command will export the state after the block height you specify:


_1
terrad export --height [height] > [filename].json

If you plan to start a new network from the exported state, export with the --for-zero-height flag:


_1
terrad export --height [height] --for-zero-height > [filename].json

💡tip

For more information on seeds and peers, visit the Tendermint documentation.

Optimizing Memory Management

Some users of the Terra node software may experience abnormal memory usage. This behaviour is endemic in the Cosmos SDK.

You can install jemalloc to assist in managing this issue.

Jemalloc provides better memory management than linux out of the box. You can learn more at

https://jemalloc.net/ .

To install jemalloc, run the following command:


_1
sudo apt-get install -y libjemalloc-dev

After installation, edit your terrad.service to match the following configuration.


_2
_2
sudo vim /etc/systemd/system/terrad.service


_28
_28
[Unit]
_28
_28
Description=Terrad
_28
_28
[Service]
_28
_28
Type=simple
_28
_28
User=ubuntu
_28
_28
ExecStart=/home/ubuntu/go/bin/terrad start --home /home/ubuntu/.terra --log_level error
_28
_28
WorkingDirectory=/home/ubuntu/.terra
_28
_28
Restart=always
_28
_28
RestartSec=1s
_28
_28
SyslogIdentifier=terrad
_28
_28
LimitNOFILE=65535
_28
_28
Environment=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
_28
_28
[Install]
_28
_28
WantedBy=multi-user.target

Additional Settings

seed_mode

In seed mode, your node constantly crawls the network and looks for peers. If another node requests addresses, it responds and disconnects. Seed mode will not work if the peer-exchange reactor is disabled.


_1
seed_mode = true

seeds

To manually identify seed nodes, edit the following setting in config.toml.


_2
# Comma separated list of seed nodes to connect to
_2

persistent_peers

The nodes you specify are the trusted persistent peers that can help anchor your node in the p2p network. If the connection fails, they are dialed and automatically redialed for 24 hours. The automatic redial functionality uses exponential backoff and stops after 24 hours of trying to connect.

If the value of persistent_peers_max_dial_period is more than zero, the pause between each call to each persistent peer will not exceed persistent_peers_max_dial_period during exponential backoff, and the automatic redial process continues.


_2
# Comma separated list of nodes to keep persistent connections to.
_2
persistent_peers = "[email protected]:26656,[email protected]:26656"

Rosetta

Integrate Terra with Coinbase via the Rosetta API. Rosetta is an open-source API that organizes blockchain data into a standardized format, making it easy for developers to build cross-chain applications. Instead of creating specific code for each chain, Rosetta allows different blockchains to integrate into any exchange that uses the Rosetta API.

For more information, visit the Rosetta docs site.