Transfer of Avalanche node between servers

aoritus
4 min readNov 16, 2020

--

In this article, we will look at how to transfer a node from one server to another with saving node ID.

A detailed video guide on starting a node from Avalanche Hub:

Official documentation is a good way to learn about running an Avalanche node.

Let’s start

We have two Ubuntu 20.04 servers, 1 server is running a validator node, 2 server empty. For transfer node from 1 server to 2nd we need copy staker files that contains our node ID and import keystore to transfer our wallet (not necessary if you validate node from web wallet).

Transfer staker files

Path of files that we need:

~/.avalanchego/staking/staker.crt
~/.avalanchego/staking/staker.key

One way to copy files from one server and move them to another is to use FileZilla with SFTP, software avalaible on Linux / macOS / Windows, but better way is using SCP. With SCP, files are transferred directly from one server to another, so you don’t need to save them on your local computer.

Use this command on server with running node, replacing user@ip to data of your empty server:

scp -P 22 -r ~/.avalanchego/staking/ user@11.11.11.11:~/.avalanchego/
succesfully transfered

Staker files copied from one server to another, migrating completed.

Get your node ID from different servers, it must be same:

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"info.getNodeID"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info

Do not try to run 2 nodes at same time with one ID, second will be dropped by network!

Transfer keystore

Export user from 1 server. Use command with your username / password:

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"keystore.exportUser",
"params" :{
"username":"USERNAME",
"password":"PASSWORD"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore

Import keystore to 2 server. Use command with your user after export, you can change username here but password must be same:

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"keystore.importUser",
"params" :{
"username":"USERNAME",
"password":"PASSWORD",
"user" :"4CsUh5sfVwz2jNrJXBVpoPtDsb4tZksWykqmxC5CXoDEERyhoRryq62jYTETYh53y13v7NzeReisi"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore

Keystore provides access to user-created wallets.

Backup

Backup meaning transfering staker files or directory from server to local computer. We can download files from server to local computer using FileZilla.

use sftp:// before ip of your server to connect

Instead of FileZilla we can use software from PuTTY - PSCP, on Windows you can open cmd (Win+R) and run:

pscp -r user@11.11.11.11:/home/$USER/.avalanchego/staking c:\temp

Staking folder will be copied on path c:\temp, so you can change it to any usable path.

Restore

Restore meaning upload from local computer to server.

We again can use FileZilla or PSCP to upload directory:

pscp -r c:\temp user@11.11.11.11:/home/$USER/.avalanchego

About Avalanche

Avalanche is an open-source platform for launching decentralized finance applications and enterprise blockchain deployments in one interoperable, highly scalable ecosystem. Developers who build on Avalanche can easily create powerful, reliable, and secure applications and custom blockchain networks with complex rulesets or build on existing private or public subnets.

Website | Whitepapers | Twitter | Discord | GitHub | Documentation | Forum | Avalanche-X | Telegram | Facebook | LinkedIn | Reddit | YouTube

--

--

No responses yet