# How to Replace Server

This section describes how miners can replace servers.

# Preparations

topio version: 1.14.0 git commit info: d42d833c2 git submodule: xbase:4b3b8a4|xdepends/GSL:8e6d4e2|xdepends/boringssl:10fef972e|xdepends/googletest:ec44c6c1|xdepends/gperftools:bf8b714|xdepends/jemalloc:46c0af68|xdepends/libevent:5df3037d|xdepends/xquic:53a8708| build date: Nov 17 2023 14:35:36 build options: release MD5:47491e1e1e7d65b5335699b0ffda1121

  1. Configure a new server

  2. In the newly purchased server Install TOPIO

If you have configured a new server and installed TOPIO, you can skip the preparations and start to Replace Server directly .

# 1. Configure a new server

Set up a server to run TOPIO. It is recommended that you rent a cloud server that can be accessed remotely from your personal computer via SSH terminals (such as Xshell).

Operating System Requirement

Operating System Version
Linux CentOS 7, 64-bit, Kernel Version 3.10 , and above (CentOS 8 included)
Ubuntu 16, 64-bit, Kernel Version 4.4, and above

Server Minimum Configuration

Different types of miners have different requirements for server configuration. Please refer to the following table for the minimum configuration.

Miner Type Minimum Hardware Configuration
edge 1CPU/1GB mem 40GB SSD 100Mb/s
validator 2CPU/2GB mem 60GB SSD 100Mb/s
advance 2CPU/4GB mem 100GB SSD 200Mb/s

Inbound Rules

Please make sure that the ports below are opened to the inbound traffic of the public network, otherwise the miner will not be able to join the TOP AI Network.

  • TCP: 19081, 19082, 19085, 8080
  • UDP: 9000, 9001

# 2. Install TOPIO

# Install "wget" Download Tool

Connect to the server and run the following command on the SSH terminal to install the "wget" download tool.

The CentOS and Ubuntu installation commands are as follows, use the corresponding commands according to your the operating system of your server.

  • CentOS

    sudo yum install wget -y
    
  • Ubuntu

    sudo apt install wget -y
    

# Download and Install TOPIO

Run the following command to download and install TOPIO:

Root users can directly run the following command, while non-root users need administrator privileges before running. You can click here to see how to add administrator privileges to non-root users.

wget https://github.com/telosprotocol/TOP-chain/releases/download/v1.14.0/topio-1.14.0-release.tar.gz -O topio-1.14.0-release.tar.gz && tar zxvf topio-1.14.0-release.tar.gz && cd topio-1.14.0-release && sudo bash install.sh && source /etc/profile && bash set_topio.sh && source ~/.bashrc && ulimit -n 65535

TOPIO is installed when the following information is printed:

install topio done
now run command to check md5: topio -v
now run command for help info: topio -h

Now you need to verify whether the installation was successful.

Verify installation result

Run topio -v on the SSH terminal, if the following content is printed, it means the TOPIO installation is successful:

topio version: 1.14.0
git commit info: d42d833c2
git submodule: xbase:4b3b8a4|xdepends/GSL:8e6d4e2|xdepends/boringssl:10fef972e|xdepends/googletest:ec44c6c1|xdepends/gperftools:bf8b714|xdepends/jemalloc:46c0af68|xdepends/libevent:5df3037d|xdepends/xquic:53a8708|
build date: Nov 17 2023 14:35:36
build options: release
MD5:47491e1e1e7d65b5335699b0ffda1121

# Replace Server

When the preparations are finished, you can start to replace the server.

# 1. Export the private key from the old server

  1. In the TOPIO of the old server, run topio wallet exportAccount, then the private key and the keystore file content will be printed.

    Sample:

    Export successfully.
    
    Keystore file: /root/topnetwork/keystore/T80000968927100f3cb7b23e8d477298311648978d8613
    Account Address: T80000968927100f3cb7b23e8d477298311648978d8613
    Private-Key: b0032f8057051b611a7c0ea373da4d7a6764351030ed497e6134fd9e11775b19
    
    {
       "account_address" : "T80000968927100f3cb7b23e8d477298311648978d8613",
       "address" : "968927100f3cb7b23e8d477298311648978d8613",
       "crypto" : {
          "cipher" : "aes-128-ctr",
          "cipherparams" : {
             "iv" : "e40a554c807b913c6e882e933ee6c103"
          },
          "ciphertext" : "762381ac2219511c647d27424761e81fecc14170eeff6e20412d6c9311149060",
          "kdf" : "scrypt",
          "kdfparams" : {
             "dklen" : 32,
             "n" : 262144,
             "p" : 1,
             "r" : 8,
             "salt" : "69c473d9a1ae16ad7cbab057101ccb9632d4109bf7f44e7ff2eba59e269f9932"
          },
          "mac" : "7d3c31b6aa3f43885682259e6e632b44799700cc7030bdbc1dddb2f587066dac"
       },
       "hint" : "",
       "id" : "b2951865-c391-9d98-ff85-83e149f88990",
       "key_type" : "owner",
       "public_key" : "BK2CfxnSP0cL9/dbi6b3krWUlQP1jP4EIHu5Y5c2vMBNLMYMOE8K3mqOubDPQXBXc/D4ydtR0LDyWUEyxHO/ZZU=",
       "version" : 3
    }
    
  2. Copy the printed wallet private key and keystore file content to the local for storage.

    In which:

    • Keystore file is the storage path of the keystore file in the old server.
    • Account Address is the wallet address.
    • Private-Key is your wallet private key.
    • The content in curly braces { } is the content of the keystore file.

After properly storing the wallet private key and keystore file content locally, you can go to the new server to import.

# 2. Import the private key in the new server

  1. Run the command to import private key:

    In the TOPIO of the new server, run topio wallet importAccount to import the private key.

    If you want to set a password when importing the private key, run topio wallet importAccount -p instead.

  2. (Optional) Set the password:

    If you choose to set a password when importing the private key, then input and set the password (input twice) when the following content appears.

    Please set a password for new worker keystore file. The password must consist of Numbers and Letters, 8 to 16 characters.
    
  3. Input the private key:

    When the following content appears, enter the private key you exported from the old server. Pasting is supported.

    Please input private key.
    
  4. Press Enter, the following content will be printed:

    Successfully import an account.
    

    The account address and public key will also be printed. At this time, the account has been successfully imported to the new server.

For new servers, it is recommended that you download the database before starting the node, which can reduce the time of data synchronization and start getting rewards early.

If your are an advanced miner, the database must be downloaded.

Run the following command in the SSH terminal:

topio db download https://top-mainnet-space.nyc3.digitaloceanspaces.com/db_20220323_v3_ebc276e0d5ef0b0f37fe6313c36c7655.tar.gz

In the returned message, if the download progress is 100% and the following content is included, the database is downloaded.

download database ok.

md5sum check ok.

# 4. Start node

After the account is successfully imported, the node process needs to be started to start mining.

In TOPIO, run the following command to start node process:

topio node startNode

If the following information is returned, the node process is started successfully.

Start node successfully.

Run the following command to query whether the node has successfully joined the network.

topio node isJoined
  • If it returns topio not ready, TOPIO is temporarily not ready, please retry one minute later.
  • If it returns YES, the node has successfully joined the network. It is now in the node candidate pool, waiting for election.
  • If it returns No, the node has failed to join the network, possibly due to network failure.