Backup your precious AVA node
Always do backups, same goes for your AVA-node.
tl;dr: “export keys you care about and back up your staker.key and staker.crt files (found in ~/.gecko/staking)” credit to Collin Cusce via Discord
I use Ubuntu on both ends, my local system and the server where the node lives.
I am going to use scp
to copy the files we need.
Let’s go.
Create backup folder
On my local machine I create a folder for the backup and change to it.
mkdir avabackup
cd avabackup
Backup ./gecko/staking
folder
Now we copy our ~/.gecko/staking
folder from the server to that directory.
- username: is your username on the server
- servername: the domain of the server or the IP-address
- the ‘:’ needs to stay in the command below
- after the column is the path to your gecko folder, here I assume it is in your home folder, otherwise it looks like
scp -pr username@servernameORserverIP:/path/to/.gecko/staking .
- the dot means we copy the folder to the directory we are right now (local machine)
scp -pr username@servernameORserverIP:.gecko/staking .
You may be asked for your ssh password.
You should see the staking
folder in your avabackup
folder.
ls -al
Backup username and password
Now we store some other stuff in a file called keys.txt
.
touch keys.txt
Open it with your editor of choice and write down your username
and password
you generated on your node.
Export your keys and user
Your node must be running!
We are going to make some API calls, the examples here use the local IP address on the server so you need to connect to your server and run them in a shell there.
But if you know the external IP address you can make the calls from the local machine and replace the IP in the calls.
User
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"keystore.exportUser",
"params" :{
"username" :"bob",
"password" :"creme fraiche"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Response:
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"user":"4CsUh5sfVwz2jNrJXBVpoPtDsb4tZksWykqmxC5CXoDEERyhoRryq62jYTETYh53y13v7NzeReisi"
}
}
Write down the response.
You will need your user password for the import, the username can be different, see docs.
X-Chain
You have to do it for every single key, if you have multiple!
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :3,
"method" :"avm.exportKey",
"params" :{
"username" :"myUsername",
"password":"myPassword",
"address": "X-7u5FQArVaMSgGZzeTE9ckheWtDhU5T3KS"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
Response:
{
"jsonrpc":"2.0",
"id" :3,
"result" :{
"privateKey":"2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"
}
}
Write down the response.
You will need your user password and username for the import, see docs.
P-Chain
You have to do it for every single key, if you have multiple!
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :3,
"method" :"platform.exportKey",
"params" :{
"username" :"bob",
"password":"loblaw",
"address": "7u5FQArVaMSgGZzeTE9ckheWtDhU5T3KS"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/platform
Response:
{
"jsonrpc":"2.0",
"id" :3,
"result" :{
"privateKey":"2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"
}
}
Write down the response.
You will need your user password and username for the import, see docs.
What we backuped
- .gecko/staking folder
- username
- password
- user
- X-Chain Keys
- P-Chain Keys
Please test your backup strategy.
Test your backup
Check your update. Try to spin up another server and try to reproduce your node there.
A backup is only good when you can restore everything with it!
Backup the backup
Now make a backup of the backup on an external drive and leave in another place.
Maybe you want to encrypt your backups as everybody with access to the backup has access to your AVA!
And backup your keys etc. of the encryption…
…
you know backups…