v4.2.1 Upgrade Instructions

For more information on past upgrades and instructions, refer to Upgrade Versions.

You may refer to this Countdown Timer which will countdown the time till the upgrade height.

cosmovisor is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, cosmovisor can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.

Go 1.19+ or later is required for the f(x)Core. Install go by following the official docs.

This upgrade tutorial is for mainnet v3.1.x upgrade to v4.2.1, if it is another upgrade or network, please select the corresponding upgrade tutorial

1. Install Cosmovisor

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest

Set up the Cosmovisor environment variables. Creates the folder structure required for using cosmovisor.

if you have used cosmovisor before, you can skip this step. Or you can use rm -rf $HOME/.fxcore/cosmovisor to reset

git clone https://github.com/functionx/fx-core.git
cd fx-core
git checkout release/v3.1.x
make build
export DAEMON_NAME=fxcored DAEMON_HOME=$HOME/.fxcore DAEMON_POLL_INTERVAL=1s UNSAFE_SKIP_BACKUP=true
cosmovisor init ./build/bin/fxcored
mkdir -p $HOME/.fxcore/cosmovisor/upgrades/fxv3/bin/
cp ./build/bin/fxcored $HOME/.fxcore/cosmovisor/upgrades/fxv3/bin/
cosmovisor version

2. Install the fxcore release

git clone https://github.com/functionx/fx-core.git
cd fx-core
git pull && git checkout release/v4.2.x
make build
mkdir -p $HOME/.fxcore/cosmovisor/upgrades/v4.2.x/bin
cp ./build/bin/fxcored $HOME/.fxcore/cosmovisor/upgrades/v4.2.x/bin/
cp ./build/bin/fxcored $(go env GOPATH)/bin/

To check that you did this correctly, ensure your versions of cosmovisor are the same:

export DAEMON_NAME=fxcored DAEMON_HOME=$HOME/.fxcore DAEMON_POLL_INTERVAL=1s UNSAFE_SKIP_BACKUP=true
cosmovisor version
cosmovisor version: v1.4.0
app version: release/v3.1.x-xxx

In addition, we have added the feature of the doctor command in the v4 version, which is used to check whether the environment you are currently running is correct. if you see the warning, please contact our technical support.

./build/bin/fxcored doctor
OR
fxcored doctor

If the node has not been started, the output of the doctor command will shown "Blockchain Data" section is unavailable.

3. Start your node

To keep the process always running. If you're on linux, you can do this by creating a service.

sudo tee /etc/systemd/system/fxcorevisor.service > /dev/null <<EOF
[Unit]
Description=fxCore Daemon
After=network-online.target

[Service]
User=root
ExecStart=$(which cosmovisor) run start --home=/root/.fxcore
Restart=always
RestartSec=3
LimitNOFILE=infinity

Environment="DAEMON_HOME=/root/.fxcore"
Environment="DAEMON_NAME=fxcored"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="DAEMON_POLL_INTERVAL=1s"

[Install]
WantedBy=multi-user.target
EOF

⚠️Before this, please make sure you have stopped fxcored and deleted the old fxcored.service file, if not, please execute the following command:

sudo systemctl stop fxcored
sudo rm -rf /etc/systemd/system/fxcored.service

Reload, enable and restart the node with daemon service file

sudo -S systemctl daemon-reload
sudo -S systemctl enable fxcorevisor
sudo -S systemctl restart fxcorevisor

Troubleshooting

Checking working environment

fxcored doctor

Accessing logs

journalctl -u fxcorevisor -f

Last updated