↔️ Migrate validator
🔀 Migrate your validator to another server
For the correct migration of your validator to another server, where you have previously installed a node of the same project, you need to:
Transfer your wallet - make sure you have the mnemonic phrase of the wallet, which you received when creating the wallet (12 words).
Transfer your priv_validator_key.json - the private key responsible for signing transactions by your validator. If you do not transfer this file, your validator will not be able to sign transactions and will end up in jail.
It is also important to understand what actions can lead your validator to jail - this is especially important to understand if you want to transfer your validator and avoid these problems:
Missing blocks - if your validator is not working stably or you have incorrectly replaced your priv_validator_key.json and cannot sign blocks, your validator will end up in jail. The delegation rate will decrease, which varies depending on the blockchain project, usually between 0.01% and 0.5%. You have the opportunity to exit jail and continue working as a validator using the exit from jail command. Double signing - if your priv_validator_key.json is on 2 servers with 2 working nodes, your validator will attempt to sign the same blocks twice, which is strictly prohibited and will result in being jailed without the possibility of exit, as well as a 5% reduction in delegation rate.
🔀 Migration process
We currently have 2 servers: "Server 1" where our working node is located, and "Server 2" where we want to migrate the validator.
1️⃣ Install the node on "Server 2" and wait until it fully synchronizes with the latest block of the network.
Now we have: Server 1 - where our validator is running, and our priv_validator_key.json file is located, which we will transfer to Server 2. Server 2 - a server with a new node installed, containing its own new priv_validator_key.json file, which we don't need. Later, we will delete it and replace it with our own from Server 1
Private keys are stored in the directory: $HOME/.zrchain/config/priv_validator_key.json $HOME - the main directory of your server
2️⃣ Transferring the private key from Server 1 to Server 2: Copy the priv_validator_key.json file from Server 1 to the main directory $HOME
It is also recommended to view and record the contents of the priv_validator_key.json file using the command:
This will allow you to verify the correct value of the private key after transferring.
3️⃣ From the $HOME directory, we need to transfer the priv_validator_key.json file to another server, to the $HOME directory:
If you are using MobaxTerm, you can use a simple file transfer from Server 1 to your PC, and then drag the file from your PC to Server 2.
If you are using Termius, you can use the SFTP file transfer protocol, where you can also transfer the file to your PC.
Through scp: SCP (Secure Copy Protocol) is a protocol and command for secure file transfer between remote nodes via SSH. Use the command (only for scp)
You will need to enter 'yes' and also enter all the necessary passwords for transferring between servers.
4️⃣ After transferring, use the command to view the contents of the priv_validator_key.json file to make sure you have done everything correctly:
If you have successfully transferred the priv_validator_key.json file from Server 1 to Server 2 in the $HOME directory, proceed to the final step.
Now we have: Server 1 - where our validator is running, and our priv_validator_key.json file is located in the directories $HOME/.zrchain/config/priv_validator_key.json
Server 2 - a server where a new node is installed. Currently, it contains a newly generated private key, which we will replace, and our transferred priv_validator_key.json file in $HOME is waiting to be used.
The next steps need to be performed quickly but with full understanding to minimize missed blocks and ensure that the nodes on Server 1 and Server 2 are fully stopped, and we can start the node with our priv_validator_key.json on Server 2.
5️⃣ Stop the node on Server 1
6️⃣ Stop the node on Server 2
7️⃣ As a precaution, move the priv_validator_key.json file from $HOME/.empe-chain/config on Server 1 to another location:
8️⃣ On Server 2 1. Restore your wallet using a mnemonic phrase:
2. Transfer and replace our private key from $HOME to $HOME/.zrchain/config/
9️⃣ Start the node on Server 2 and view the logs to ensure that the node is functioning correctly
🎉 Done, your validator has been migrated. For reliability, you can delete your node from Server 1
Last updated