Backup Presearch Node Security Keys

You’ve had your nodes up and running since before the new 2000 PRE minimum stake. Or you want to be prepared now for if the minimum stake goes up again in the future. What you want to do is backup your nodes’ security keys so that if you ever need to transfer those nodes you can keep their minimum stake status and their stats.

On each server you have running a Presearch node, you need to copy the keys out of the running Docker instance to that server:

docker cp presearch-node:/app/node/.keys ~/presearch-node-keys

Then, you need to copy those keys from your server onto your local computer (replace {port} and {server_ip} below with your server’s SSH port and IP address, respectively):

mkdir -p ~/node-keys/
scp -r -P {port} {server_ip}:presearch-node-keys ~/node-keys/

What if you have a bunch of nodes? Surely you setup PSSH to manage all of your servers? If not, do that now and come back. If so, just keep going!

With PSSH, you can backup all of your keys at once. Run these commands from your local computer, just note that the first and third are long so make sure you get all of the text.

pssh -i -t 0 -h nodes.txt -l root 'docker cp presearch-node:/app/node/.keys ~/presearch-node-keys-$(hostname)'
mkdir -p ~/node-keys/
for server in $(cat nodes.txt); do ip=${server%:*} port=${server#*:}; scp -r -P ${port} "root@${ip}:presearch-node-keys-*" ~/node-keys/; done
ls -la ~/node-keys/

You now have all of your nodes’ private keys backed up locally in your home folder/node-keys.

This article was updated on 2022-08-17

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.